diff --git a/Gopkg.lock b/Gopkg.lock index bbf1f362..d599d5aa 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -474,6 +474,14 @@ revision = "d8152159450570012552f924a0ae6ab3d8c617e0" version = "v0.6.0" +[[projects]] + digest = "1:a1e8eda841bca324a6b4d88824d625b3ba8d86bf9ec68677d595c02d7502918b" + name = "github.com/nrdcg/namesilo" + packages = ["."] + pruneopts = "NUT" + revision = "a9d275011759a070d795b7d0ea99cc590915823f" + version = "v0.2.0" + [[projects]] digest = "1:482e6a8662dcfd8dc7ebf28b8a1a293b6d453f71bda13e370b3949cb487e6dd6" name = "github.com/oracle/oci-go-sdk" @@ -910,6 +918,7 @@ "github.com/namedotcom/go/namecom", "github.com/nrdcg/auroradns", "github.com/nrdcg/goinwx", + "github.com/nrdcg/namesilo", "github.com/oracle/oci-go-sdk/common", "github.com/oracle/oci-go-sdk/dns", "github.com/ovh/go-ovh/ovh", diff --git a/Gopkg.toml b/Gopkg.toml index a0c06adc..c4717326 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -128,3 +128,7 @@ [[constraint]] name = "github.com/cpu/goacmedns" branch = "master" + +[[constraint]] + name = "github.com/nrdcg/namesilo" + version = "0.2.0" diff --git a/README.md b/README.md index d78bc6a7..fec72b03 100644 --- a/README.md +++ b/README.md @@ -53,9 +53,8 @@ Detailed documentation is available [here](https://go-acme.github.io/lego/dns). | [Google Cloud](https://go-acme.github.io/lego/dns/gcloud/) | [Hosting.de](https://go-acme.github.io/lego/dns/hostingde/) | [HTTP request](https://go-acme.github.io/lego/dns/httpreq/) | [Internet Initiative Japan](https://go-acme.github.io/lego/dns/iij/) | | [INWX](https://go-acme.github.io/lego/dns/inwx/) | [Joker](https://go-acme.github.io/lego/dns/joker/) | [Joohoi's ACME-DNS](https://go-acme.github.io/lego/dns/acme-dns) | [Linode (deprecated)](https://go-acme.github.io/lego/dns/linode/) | | [Linode (v4)](https://go-acme.github.io/lego/dns/linodev4/) | [Manual](https://go-acme.github.io/lego/dns/manual/) | [MyDNS.jp](https://go-acme.github.io/lego/dns/mydnsjp/) | [Name.com](https://go-acme.github.io/lego/dns/namedotcom/) | -| [Namecheap](https://go-acme.github.io/lego/dns/namecheap/) | [Netcup](https://go-acme.github.io/lego/dns/netcup/) | [NIFCloud](https://go-acme.github.io/lego/dns/nifcloud/) | [NS1](https://go-acme.github.io/lego/dns/ns1/) | -| [Open Telekom Cloud](https://go-acme.github.io/lego/dns/otc/) | [Oracle Cloud](https://go-acme.github.io/lego/dns/oraclecloud/) | [OVH](https://go-acme.github.io/lego/dns/ovh/) | [PowerDNS](https://go-acme.github.io/lego/dns/pdns/) | -| [Rackspace](https://go-acme.github.io/lego/dns/rackspace/) | [RFC2136](https://go-acme.github.io/lego/dns/rfc2136/) | [Sakura Cloud](https://go-acme.github.io/lego/dns/sakuracloud/) | [Selectel](https://go-acme.github.io/lego/dns/selectel/) | -| [Stackpath](https://go-acme.github.io/lego/dns/stackpath/) | [TransIP](https://go-acme.github.io/lego/dns/transip/) | [VegaDNS](https://go-acme.github.io/lego/dns/vegadns/) | [Vscale](https://go-acme.github.io/lego/dns/vscale/) | -| [Versio](https://go-acme.github.io/lego/dns/versio/) | [Vultr](https://go-acme.github.io/lego/dns/vultr/) -| [Zone.ee](https://go-acme.github.io/lego/dns/zoneee/) | | | +| [Namecheap](https://go-acme.github.io/lego/dns/namecheap/) | [Namesilo](https://www.namesilo.com) | [Netcup](https://go-acme.github.io/lego/dns/netcup/) | [NIFCloud](https://go-acme.github.io/lego/dns/nifcloud/) | +| [NS1](https://go-acme.github.io/lego/dns/ns1/) | [Open Telekom Cloud](https://go-acme.github.io/lego/dns/otc/) | [Oracle Cloud](https://go-acme.github.io/lego/dns/oraclecloud/) | [OVH](https://go-acme.github.io/lego/dns/ovh/) | +| [PowerDNS](https://go-acme.github.io/lego/dns/pdns/) | [Rackspace](https://go-acme.github.io/lego/dns/rackspace/) | [RFC2136](https://go-acme.github.io/lego/dns/rfc2136/) | [Sakura Cloud](https://go-acme.github.io/lego/dns/sakuracloud/) | +| [Selectel](https://go-acme.github.io/lego/dns/selectel/) | [Stackpath](https://go-acme.github.io/lego/dns/stackpath/) | [TransIP](https://go-acme.github.io/lego/dns/transip/) | [VegaDNS](https://go-acme.github.io/lego/dns/vegadns/) | +| [Vscale](https://go-acme.github.io/lego/dns/vscale/) | [Versio](https://go-acme.github.io/lego/dns/versio/) | [Vultr](https://go-acme.github.io/lego/dns/vultr/) | [Zone.ee](https://go-acme.github.io/lego/dns/zoneee/) | diff --git a/cmd/zz_gen_cmd_dnshelp.go b/cmd/zz_gen_cmd_dnshelp.go index e1d16ef0..8ef2e4d1 100644 --- a/cmd/zz_gen_cmd_dnshelp.go +++ b/cmd/zz_gen_cmd_dnshelp.go @@ -55,6 +55,7 @@ func allDNSCodes() string { "mydnsjp", "namecheap", "namedotcom", + "namesilo", "netcup", "nifcloud", "ns1", @@ -893,6 +894,25 @@ func displayDNSHelp(name string) { fmt.Fprintln(w) fmt.Fprintln(w, `More information: https://go-acme.github.io/lego/dns/namedotcom`) + case "namesilo": + // generated from: providers/dns/namesilo/namesilo.toml + fmt.Fprintln(w, `Configuration for Namesilo.`) + fmt.Fprintln(w, `Code: 'namesilo'`) + fmt.Fprintln(w, `Since: 'v2.7.0'`) + fmt.Fprintln(w) + + fmt.Fprintln(w, `Credentials:`) + fmt.Fprintln(w, ` - "NAMESILO_API_KEY": Client ID`) + fmt.Fprintln(w) + + fmt.Fprintln(w, `Additional Configuration:`) + fmt.Fprintln(w, ` - "NAMESILO_POLLING_INTERVAL": Time between DNS propagation check`) + fmt.Fprintln(w, ` - "NAMESILO_PROPAGATION_TIMEOUT": Maximum waiting time for DNS propagation, it is better to set larger than 15m`) + fmt.Fprintln(w, ` - "NAMESILO_TTL": The TTL of the TXT record used for the DNS challenge, should be in [3600, 2592000]`) + + fmt.Fprintln(w) + fmt.Fprintln(w, `More information: https://go-acme.github.io/lego/dns/namesilo`) + case "netcup": // generated from: providers/dns/netcup/netcup.toml fmt.Fprintln(w, `Configuration for Netcup.`) diff --git a/docs/content/dns/zz_gen_namesilo.md b/docs/content/dns/zz_gen_namesilo.md new file mode 100644 index 00000000..32d95c2e --- /dev/null +++ b/docs/content/dns/zz_gen_namesilo.md @@ -0,0 +1,62 @@ +--- +title: "Namesilo" +date: 2019-03-03T16:39:46+01:00 +draft: false +slug: namesilo +--- + + + + + +Since: v2.7.0 + +Configuration for [Namesilo](https://www.namesilo.com/). + + + + +- Code: `namesilo` + +Here is an example bash command using the Namesilo provider: + +```bash +NAMESILO_API_KEY=b9841238feb177a84330febba8a83208921177bffe733 \ +lego --dns namesilo --domains my.domain.com --email my@email.com run +``` + + + + +## Credentials + +| Environment Variable Name | Description | +|-----------------------|-------------| +| `NAMESILO_API_KEY` | Client ID | + +The environment variable names can be suffixed by `_FILE` to reference a file instead of a value. +More information [here](/lego/dns/#configuration-and-credentials). + + +## Additional Configuration + +| Environment Variable Name | Description | +|--------------------------------|-------------| +| `NAMESILO_POLLING_INTERVAL` | Time between DNS propagation check | +| `NAMESILO_PROPAGATION_TIMEOUT` | Maximum waiting time for DNS propagation, it is better to set larger than 15m | +| `NAMESILO_TTL` | The TTL of the TXT record used for the DNS challenge, should be in [3600, 2592000] | + +The environment variable names can be suffixed by `_FILE` to reference a file instead of a value. +More information [here](/lego/dns/#configuration-and-credentials). + + + + +## More information + +- [API documentation](https://www.namesilo.com/api_reference.php) +- [Go client](https://github.com/nrdcg/namesilo) + + + + diff --git a/providers/dns/dns_providers.go b/providers/dns/dns_providers.go index dd50b601..0743f097 100644 --- a/providers/dns/dns_providers.go +++ b/providers/dns/dns_providers.go @@ -44,6 +44,7 @@ import ( "github.com/go-acme/lego/providers/dns/mydnsjp" "github.com/go-acme/lego/providers/dns/namecheap" "github.com/go-acme/lego/providers/dns/namedotcom" + "github.com/go-acme/lego/providers/dns/namesilo" "github.com/go-acme/lego/providers/dns/netcup" "github.com/go-acme/lego/providers/dns/nifcloud" "github.com/go-acme/lego/providers/dns/ns1" @@ -148,6 +149,8 @@ func NewDNSChallengeProviderByName(name string) (challenge.Provider, error) { return namecheap.NewDNSProvider() case "namedotcom": return namedotcom.NewDNSProvider() + case "namesilo": + return namesilo.NewDNSProvider() case "netcup": return netcup.NewDNSProvider() case "nifcloud": diff --git a/providers/dns/namesilo/namesilo.go b/providers/dns/namesilo/namesilo.go new file mode 100644 index 00000000..b308eabf --- /dev/null +++ b/providers/dns/namesilo/namesilo.go @@ -0,0 +1,142 @@ +// Package namesilo implements a DNS provider for solving the DNS-01 challenge using namesilo DNS. +package namesilo + +import ( + "errors" + "fmt" + "strings" + "time" + + "github.com/go-acme/lego/challenge/dns01" + "github.com/go-acme/lego/platform/config/env" + "github.com/nrdcg/namesilo" +) + +const ( + defaultTTL = 3600 + maxTTL = 2592000 +) + +// Config is used to configure the creation of the DNSProvider +type Config struct { + APIKey string + PropagationTimeout time.Duration + PollingInterval time.Duration + TTL int +} + +// NewDefaultConfig returns a default configuration for the DNSProvider +func NewDefaultConfig() *Config { + return &Config{ + PropagationTimeout: env.GetOrDefaultSecond("NAMESILO_PROPAGATION_TIMEOUT", dns01.DefaultPropagationTimeout), + PollingInterval: env.GetOrDefaultSecond("NAMESILO_POLLING_INTERVAL", dns01.DefaultPollingInterval), + TTL: env.GetOrDefaultInt("NAMESILO_TTL", defaultTTL), + } +} + +// DNSProvider is an implementation of the acme.ChallengeProvider interface. +type DNSProvider struct { + client *namesilo.Client + config *Config +} + +// NewDNSProvider returns a DNSProvider instance configured for namesilo. +// API_KEY must be passed in the environment variables: NAMESILO_API_KEY. +// +// See: https://www.namesilo.com/api_reference.php +func NewDNSProvider() (*DNSProvider, error) { + values, err := env.Get("NAMESILO_API_KEY") + if err != nil { + return nil, fmt.Errorf("namesilo: %v", err) + } + + config := NewDefaultConfig() + config.APIKey = values["NAMESILO_API_KEY"] + + return NewDNSProviderConfig(config) +} + +// NewDNSProviderConfig return a DNSProvider instance configured for DNSimple. +func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { + if config == nil { + return nil, errors.New("namesilo: the configuration of the DNS provider is nil") + } + + if config.TTL < defaultTTL || config.TTL > maxTTL { + return nil, fmt.Errorf("namesilo: TTL should be in [%d, %d]", defaultTTL, maxTTL) + } + + transport, err := namesilo.NewTokenTransport(config.APIKey) + if err != nil { + return nil, fmt.Errorf("namesilo: %v", err) + } + + return &DNSProvider{client: namesilo.NewClient(transport.Client()), config: config}, nil +} + +// Present creates a TXT record to fulfill the dns-01 challenge. +func (d *DNSProvider) Present(domain, token, keyAuth string) error { + fqdn, value := dns01.GetRecord(domain, keyAuth) + + zoneName, err := getZoneNameByDomain(domain) + if err != nil { + return fmt.Errorf("namesilo: %v", err) + } + + _, err = d.client.DnsAddRecord(&namesilo.DnsAddRecordParams{ + Domain: zoneName, + Type: "TXT", + Host: getRecordName(fqdn, zoneName), + Value: value, + TTL: d.config.TTL, + }) + if err != nil { + return fmt.Errorf("namesilo: failed to add record %v", err) + } + return nil +} + +// CleanUp removes the TXT record matching the specified parameters. +func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { + fqdn, _ := dns01.GetRecord(domain, keyAuth) + + zoneName, err := getZoneNameByDomain(domain) + if err != nil { + return fmt.Errorf("namesilo: %v", err) + } + + resp, err := d.client.DnsListRecords(&namesilo.DnsListRecordsParams{Domain: zoneName}) + if err != nil { + return fmt.Errorf("namesilo: %v", err) + } + + var lastErr error + name := getRecordName(fqdn, zoneName) + for _, r := range resp.Reply.ResourceRecord { + if r.Type == "TXT" && r.Host == name { + _, err := d.client.DnsDeleteRecord(&namesilo.DnsDeleteRecordParams{Domain: zoneName, ID: r.RecordID}) + if err != nil { + lastErr = fmt.Errorf("namesilo: %v", err) + } + } + } + return lastErr +} + +// Timeout returns the timeout and interval to use when checking for DNS propagation. +// Adjusting here to cope with spikes in propagation times. +func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { + return d.config.PropagationTimeout, d.config.PollingInterval +} + +func getZoneNameByDomain(domain string) (string, error) { + zone, err := dns01.FindZoneByFqdn(dns01.ToFqdn(domain)) + if err != nil { + return "", fmt.Errorf("failed to find zone for domain: %s, %v", domain, err) + } + return dns01.UnFqdn(zone), nil +} + +func getRecordName(domain, zone string) string { + return strings.TrimSuffix(dns01.ToFqdn(domain), "."+dns01.ToFqdn(zone)) +} diff --git a/providers/dns/namesilo/namesilo.toml b/providers/dns/namesilo/namesilo.toml new file mode 100644 index 00000000..89a455c4 --- /dev/null +++ b/providers/dns/namesilo/namesilo.toml @@ -0,0 +1,22 @@ +Name = "Namesilo" +Description = '''''' +URL = "https://www.namesilo.com/" +Code = "namesilo" +Since = "v2.7.0" + +Example = ''' +NAMESILO_API_KEY=b9841238feb177a84330febba8a83208921177bffe733 \ +lego --dns namesilo --domains my.domain.com --email my@email.com run +''' + +[Configuration] + [Configuration.Credentials] + NAMESILO_API_KEY = "Client ID" + [Configuration.Additional] + NAMESILO_POLLING_INTERVAL = "Time between DNS propagation check" + NAMESILO_PROPAGATION_TIMEOUT = "Maximum waiting time for DNS propagation, it is better to set larger than 15m" + NAMESILO_TTL = "The TTL of the TXT record used for the DNS challenge, should be in [3600, 2592000]" + +[Links] + API = "https://www.namesilo.com/api_reference.php" + GoClient = "https://github.com/nrdcg/namesilo" diff --git a/providers/dns/namesilo/namesilo_test.go b/providers/dns/namesilo/namesilo_test.go new file mode 100644 index 00000000..ac85f1a0 --- /dev/null +++ b/providers/dns/namesilo/namesilo_test.go @@ -0,0 +1,135 @@ +package namesilo + +import ( + "testing" + "time" + + "github.com/go-acme/lego/platform/tester" + "github.com/stretchr/testify/require" +) + +var envTest = tester.NewEnvTest( + "NAMESILO_TTL", + "NAMESILO_API_KEY"). + WithDomain("NAMESILO_DOMAIN") + +func TestNewDNSProvider(t *testing.T) { + testCases := []struct { + desc string + envVars map[string]string + expected string + }{ + { + desc: "success", + envVars: map[string]string{ + "NAMESILO_API_KEY": "A", + }, + }, + { + desc: "missing API key", + envVars: map[string]string{}, + expected: "namesilo: some credentials information are missing: NAMESILO_API_KEY", + }, + { + desc: "unsupported TTL", + envVars: map[string]string{ + "NAMESILO_API_KEY": "A", + "NAMESILO_TTL": "180", + }, + expected: "namesilo: TTL should be in [3600, 2592000]", + }, + } + + for _, test := range testCases { + t.Run(test.desc, func(t *testing.T) { + defer envTest.RestoreEnv() + envTest.ClearEnv() + + envTest.Apply(test.envVars) + + p, err := NewDNSProvider() + + if len(test.expected) == 0 { + require.NoError(t, err) + require.NotNil(t, p) + require.NotNil(t, p.config) + } else { + require.EqualError(t, err, test.expected) + } + }) + } +} + +func TestNewDNSProviderConfig(t *testing.T) { + testCases := []struct { + desc string + apiKey string + ttl int + expected string + }{ + { + desc: "success", + apiKey: "A", + ttl: defaultTTL, + }, + { + desc: "missing API key", + ttl: defaultTTL, + expected: "namesilo: credentials missing: API key", + }, + { + desc: "unavailable TTL", + apiKey: "A", + ttl: 100, + expected: "namesilo: TTL should be in [3600, 2592000]", + }, + } + + for _, test := range testCases { + t.Run(test.desc, func(t *testing.T) { + config := NewDefaultConfig() + config.APIKey = test.apiKey + config.TTL = test.ttl + + p, err := NewDNSProviderConfig(config) + + if len(test.expected) == 0 { + require.NoError(t, err) + require.NotNil(t, p) + require.NotNil(t, p.config) + } else { + require.EqualError(t, err, test.expected) + } + }) + } +} + +func TestLivePresent(t *testing.T) { + if !envTest.IsLiveTest() { + t.Skip("skipping live test") + } + + envTest.RestoreEnv() + + provider, err := NewDNSProvider() + require.NoError(t, err) + + err = provider.Present(envTest.GetDomain(), "", "123d==") + require.NoError(t, err) +} + +func TestLiveCleanUp(t *testing.T) { + if !envTest.IsLiveTest() { + t.Skip("skipping live test") + } + + envTest.RestoreEnv() + + provider, err := NewDNSProvider() + require.NoError(t, err) + + time.Sleep(1 * time.Second) + + err = provider.CleanUp(envTest.GetDomain(), "", "123d==") + require.NoError(t, err) +} diff --git a/vendor/github.com/nrdcg/namesilo/LICENSE b/vendor/github.com/nrdcg/namesilo/LICENSE new file mode 100644 index 00000000..a612ad98 --- /dev/null +++ b/vendor/github.com/nrdcg/namesilo/LICENSE @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/vendor/github.com/nrdcg/namesilo/auth.go b/vendor/github.com/nrdcg/namesilo/auth.go new file mode 100644 index 00000000..aac5ea09 --- /dev/null +++ b/vendor/github.com/nrdcg/namesilo/auth.go @@ -0,0 +1,57 @@ +package namesilo + +import ( + "fmt" + "net/http" +) + +// TokenTransport HTTP transport for API authentication. +type TokenTransport struct { + apiKey string + + // Transport is the underlying HTTP transport to use when making requests. + // It will default to http.DefaultTransport if nil. + Transport http.RoundTripper +} + +// NewTokenTransport Creates a HTTP transport for API authentication. +func NewTokenTransport(apiKey string) (*TokenTransport, error) { + if apiKey == "" { + return nil, fmt.Errorf("credentials missing: API key") + } + + return &TokenTransport{apiKey: apiKey}, nil +} + +// RoundTrip executes a single HTTP transaction +func (t *TokenTransport) RoundTrip(req *http.Request) (*http.Response, error) { + enrichedReq := &http.Request{} + *enrichedReq = *req + + enrichedReq.Header = make(http.Header, len(req.Header)) + for k, s := range req.Header { + enrichedReq.Header[k] = append([]string(nil), s...) + } + + if t.apiKey != "" { + query := enrichedReq.URL.Query() + query.Set("version", "1") + query.Set("type", "xml") + query.Set("key", t.apiKey) + enrichedReq.URL.RawQuery = query.Encode() + } + + return t.transport().RoundTrip(enrichedReq) +} + +// Client Creates a new HTTP client +func (t *TokenTransport) Client() *http.Client { + return &http.Client{Transport: t} +} + +func (t *TokenTransport) transport() http.RoundTripper { + if t.Transport != nil { + return t.Transport + } + return http.DefaultTransport +} diff --git a/vendor/github.com/nrdcg/namesilo/model.go b/vendor/github.com/nrdcg/namesilo/model.go new file mode 100644 index 00000000..155ac00d --- /dev/null +++ b/vendor/github.com/nrdcg/namesilo/model.go @@ -0,0 +1,768 @@ +package namesilo + +import "encoding/xml" + +// Request Base request representation. +type Request struct { + Operation string `xml:"operation"` + IP string `xml:"ip"` +} + +// Reply Base reply representation. +type Reply struct { + Code string `xml:"code"` + Detail string `xml:"detail"` +} + +// Operation was generated 2019-03-20 19:35:05. +type Operation struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply Reply `xml:"reply"` +} + +// AddAccountFunds was generated 2019-03-20 19:35:05. +type AddAccountFunds struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply AddAccountFundsReply `xml:"reply"` +} + +// AddAccountFundsReply A reply representation. +type AddAccountFundsReply struct { + Reply + NewBalance string `xml:"new_balance"` +} + +// AddAutoRenewal was generated 2019-03-20 19:35:05. +type AddAutoRenewal struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply Reply `xml:"reply"` +} + +// AddPrivacy was generated 2019-03-20 19:35:05. +type AddPrivacy struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply Reply `xml:"reply"` +} + +// AddRegisteredNameServer was generated 2019-03-20 19:35:05. +type AddRegisteredNameServer struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply Reply `xml:"reply"` +} + +// ChangeNameServers was generated 2019-03-20 19:35:05. +type ChangeNameServers struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply Reply `xml:"reply"` +} + +// CheckRegisterAvailability was generated 2019-03-20 19:35:05. +type CheckRegisterAvailability struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply CheckRegisterAvailabilityReply `xml:"reply"` +} + +// CheckRegisterAvailabilityReply A reply representation. +type CheckRegisterAvailabilityReply struct { + Reply + Available struct { + Domain []string `xml:"domain"` + } `xml:"available"` + Unavailable struct { + Domain string `xml:"domain"` + } `xml:"unavailable"` + Invalid struct { + Domain string `xml:"domain"` + } `xml:"invalid"` +} + +// CheckTransferAvailability was generated 2019-03-20 19:35:05. +type CheckTransferAvailability struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply CheckTransferAvailabilityReply `xml:"reply"` +} + +// CheckTransferAvailabilityReply A reply representation. +type CheckTransferAvailabilityReply struct { + Reply + Available struct { + Domain []string `xml:"domain"` + } `xml:"available"` + Unavailable struct { + Domain []struct { + Name string `xml:",chardata"` + Reason string `xml:"reason,attr"` + } `xml:"domain"` + } `xml:"unavailable"` +} + +// CheckTransferStatus was generated 2019-03-20 19:35:05. +type CheckTransferStatus struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply CheckTransferStatusReply `xml:"reply"` +} + +// CheckTransferStatusReply A reply representation. +type CheckTransferStatusReply struct { + Reply + Date string `xml:"date"` + Status string `xml:"status"` + Message string `xml:"message"` +} + +// ConfigureEmailForward was generated 2019-03-20 19:35:05. +type ConfigureEmailForward struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply ConfigureEmailForwardReply `xml:"reply"` +} + +// ConfigureEmailForwardReply A reply representation. +type ConfigureEmailForwardReply struct { + Reply + Message string `xml:"message"` +} + +// ContactAdd was generated 2019-03-20 19:35:05. +type ContactAdd struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply ContactAddReply `xml:"reply"` +} + +// ContactAddReply A reply representation. +type ContactAddReply struct { + Reply + ContactID string `xml:"contact_id"` +} + +// ContactDomainAssociate was generated 2019-03-20 19:35:05. +type ContactDomainAssociate struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply Reply `xml:"reply"` +} + +// ContactList was generated 2019-03-20 19:35:05. +type ContactList struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply ContactListReply `xml:"reply"` +} + +// ContactListReply A reply representation. +type ContactListReply struct { + Reply + Contact []Contact `xml:"contact"` +} + +// Contact A contact representation. +type Contact struct { + ContactID string `xml:"contact_id"` + DefaultProfile string `xml:"default_profile"` + Nickname string `xml:"nickname"` + Company string `xml:"company"` + FirstName string `xml:"first_name"` + LastName string `xml:"last_name"` + Address string `xml:"address"` + Address2 string `xml:"address2"` + City string `xml:"city"` + State string `xml:"state"` + Zip string `xml:"zip"` + Country string `xml:"country"` + Email string `xml:"email"` + Phone string `xml:"phone"` + Fax string `xml:"fax"` + Usnc string `xml:"usnc"` + Usap string `xml:"usap"` + Calf string `xml:"calf"` + Caln string `xml:"caln"` + Caag string `xml:"caag"` + Cawd string `xml:"cawd"` +} + +// ContactUpdate was generated 2019-03-20 19:35:05. +type ContactUpdate struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply Reply `xml:"reply"` +} + +// ContactDelete was generated 2019-03-20 19:35:05. +type ContactDelete struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply Reply `xml:"reply"` +} + +// DeleteEmailForward was generated 2019-03-20 19:35:05. +type DeleteEmailForward struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply DeleteEmailForwardReply `xml:"reply"` +} + +// DeleteEmailForwardReply A reply representation. +type DeleteEmailForwardReply struct { + Reply + Message string `xml:"message"` +} + +// DeleteRegisteredNameServer was generated 2019-03-20 19:35:05. +type DeleteRegisteredNameServer struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply Reply `xml:"reply"` +} + +// DnsAddRecord was generated 2019-03-20 19:35:05. +type DnsAddRecord struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply DnsAddRecordReply `xml:"reply"` +} + +// DnsAddRecordReply A reply representation. +type DnsAddRecordReply struct { + Reply + RecordID string `xml:"record_id"` +} + +// DnsDeleteRecord was generated 2019-03-20 19:35:05. +type DnsDeleteRecord struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply Reply `xml:"reply"` +} + +// DnsListRecords was generated 2019-03-20 19:35:05. +type DnsListRecords struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply DnsListRecordsReply `xml:"reply"` +} + +// DnsListRecordsReply A reply representation. +type DnsListRecordsReply struct { + Reply + ResourceRecord []ResourceRecord `xml:"resource_record"` +} + +// ResourceRecord A Resource Record representation. +type ResourceRecord struct { + RecordID string `xml:"record_id"` + Type string `xml:"type"` + Host string `xml:"host"` + Value string `xml:"value"` + TTL string `xml:"ttl"` + Distance string `xml:"distance"` +} + +// DnsSecAddRecord was generated 2019-03-20 19:35:05. +type DnsSecAddRecord struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply Reply `xml:"reply"` +} + +// DnsSecDeleteRecord was generated 2019-03-20 19:35:05. +type DnsSecDeleteRecord struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply Reply `xml:"reply"` +} + +// DnsSecListRecords was generated 2019-03-20 19:35:05. +type DnsSecListRecords struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply DnsSecListRecordsReply `xml:"reply"` +} + +// DnsSecListRecordsReply A reply representation. +type DnsSecListRecordsReply struct { + Reply + DsRecord []DsRecord `xml:"ds_record"` +} + +// DsRecord A DsRecord representation. +type DsRecord struct { + Digest string `xml:"digest"` + DigestType string `xml:"digest_type"` + Algorithm string `xml:"algorithm"` + KeyTag string `xml:"key_tag"` +} + +// DnsUpdateRecord was generated 2019-03-20 19:35:05. +type DnsUpdateRecord struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply DnsUpdateRecordReply `xml:"reply"` +} + +// DnsUpdateRecordReply A reply representation. +type DnsUpdateRecordReply struct { + Reply + RecordID string `xml:"record_id"` +} + +// DomainForwardSubDomainDelete was generated 2019-03-20 19:35:05. +type DomainForwardSubDomainDelete struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply Reply `xml:"reply"` +} + +// DomainForwardSubDomain was generated 2019-03-20 19:35:05. +type DomainForwardSubDomain struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply DomainForwardSubDomainReply `xml:"reply"` +} + +// DomainForwardSubDomainReply A reply representation. +type DomainForwardSubDomainReply struct { + Reply + Message string `xml:"message"` +} + +// DomainForward was generated 2019-03-20 19:35:05. +type DomainForward struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply Reply `xml:"reply"` +} + +// DomainLock was generated 2019-03-20 19:35:05. +type DomainLock struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply Reply `xml:"reply"` +} + +// DomainUnlock was generated 2019-03-20 19:35:05. +type DomainUnlock struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply Reply `xml:"reply"` +} + +// EmailVerification was generated 2019-03-20 19:35:05. +type EmailVerification struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply EmailVerificationReply `xml:"reply"` +} + +// EmailVerificationReply A reply representation. +type EmailVerificationReply struct { + Reply + Message string `xml:"message"` +} + +// GetAccountBalance was generated 2019-03-20 19:35:05. +type GetAccountBalance struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply GetAccountBalanceReply `xml:"reply"` +} + +// GetAccountBalanceReply A reply representation. +type GetAccountBalanceReply struct { + Reply + Balance string `xml:"balance"` +} + +// GetDomainInfo was generated 2019-03-20 19:35:05. +type GetDomainInfo struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply GetDomainInfoReply `xml:"reply"` +} + +// GetDomainInfoReply A reply representation. +type GetDomainInfoReply struct { + Reply + Created string `xml:"created"` + Expires string `xml:"expires"` + Status string `xml:"status"` + Locked string `xml:"locked"` + Private string `xml:"private"` + AutoRenew string `xml:"auto_renew"` + TrafficType string `xml:"traffic_type"` + EmailVerificationRequired string `xml:"email_verification_required"` + Portfolio string `xml:"portfolio"` + ForwardURL string `xml:"forward_url"` + ForwardType string `xml:"forward_type"` + Nameservers []Nameserver `xml:"nameservers>nameserver"` + ContactIDs ContactIDs `xml:"contact_ids"` +} + +// Nameserver A Nameserver representation. +type Nameserver struct { + Name string `xml:",chardata"` + Position string `xml:"position,attr"` +} + +// ContactIDs A Contact IDs representation. +type ContactIDs struct { + Registrant string `xml:"registrant"` + Administrative string `xml:"administrative"` + Technical string `xml:"technical"` + Billing string `xml:"billing"` +} + +// GetPrices was generated 2019-03-20 19:35:05. +type GetPrices struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply GetPricesReply `xml:"reply"` +} + +// GetPricesReply A reply representation. +type GetPricesReply struct { + Reply + Com ComNet `xml:"com"` + Net ComNet `xml:"net"` +} + +// ComNet A Com/Net representation. +type ComNet struct { + Registration string `xml:"registration"` + Transfer string `xml:"transfer"` + Renew string `xml:"renew"` +} + +// ListDomains was generated 2019-03-20 19:35:05. +type ListDomains struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply ListDomainsReply `xml:"reply"` +} + +// ListDomainsReply A reply representation. +type ListDomainsReply struct { + Reply + Domains struct { + Domain []string `xml:"domain"` + } `xml:"domains"` +} + +// ListEmailForwards was generated 2019-03-20 19:35:05. +type ListEmailForwards struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply ListEmailForwardsReply `xml:"reply"` +} + +// ListEmailForwardsReply A reply representation. +type ListEmailForwardsReply struct { + Reply + Addresses []Address `xml:"addresses"` +} + +// Address An Address representation. +type Address struct { + Email string `xml:"email"` + ForwardsTo []string `xml:"forwards_to"` +} + +// ListOrders was generated 2019-03-20 19:35:05. +type ListOrders struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply ListOrdersReply `xml:"reply"` +} + +// ListOrdersReply A reply representation. +type ListOrdersReply struct { + Reply + Order []Order `xml:"order"` +} + +// Order An Order representation. +type Order struct { + OrderNumber string `xml:"order_number"` + OrderDate string `xml:"order_date"` + Method string `xml:"method"` + Total string `xml:"total"` +} + +// ListRegisteredNameServers was generated 2019-03-20 19:35:05. +type ListRegisteredNameServers struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply ListRegisteredNameServersReply `xml:"reply"` +} + +// ListRegisteredNameServersReply A reply representation. +type ListRegisteredNameServersReply struct { + Reply + Hosts []Host `xml:"hosts"` +} + +// Host A Host representation. +type Host struct { + Host string `xml:"host"` + IP []string `xml:"ip"` +} + +// MarketplaceActiveSalesOverview was generated 2019-03-20 19:35:05. +type MarketplaceActiveSalesOverview struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply MarketplaceActiveSalesOverviewReply `xml:"reply"` +} + +// MarketplaceActiveSalesOverviewReply A reply representation. +type MarketplaceActiveSalesOverviewReply struct { + Reply + SaleDetails []SaleDetail `xml:"sale_details"` +} + +// SaleDetail A Sale Detail representation. +type SaleDetail struct { + Domain string `xml:"domain"` + Status string `xml:"status"` + Reserve string `xml:"reserve"` + BuyNow string `xml:"buy_now"` + Portfolio string `xml:"portfolio"` + SaleType string `xml:"sale_type"` + PayPlanOffered string `xml:"pay_plan_offered"` + EndDate string `xml:"end_date"` + AutoExtendDays string `xml:"auto_extend_days"` + TimeRemaining string `xml:"time_remaining"` + Private string `xml:"private"` + ActiveBidOrOffer string `xml:"active_bid_or_offer"` +} + +// MarketplaceAddOrModifySale was generated 2019-03-20 19:35:05. +type MarketplaceAddOrModifySale struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply MarketplaceAddOrModifySaleReply `xml:"reply"` +} + +// MarketplaceAddOrModifySaleReply A reply representation. +type MarketplaceAddOrModifySaleReply struct { + Reply + Message string `xml:"message"` +} + +// MarketplaceLandingPageUpdate was generated 2019-03-20 19:35:05. +type MarketplaceLandingPageUpdate struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply Reply `xml:"reply"` +} + +// ModifyRegisteredNameServer was generated 2019-03-20 19:35:05. +type ModifyRegisteredNameServer struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply Reply `xml:"reply"` +} + +// OrderDetails was generated 2019-03-20 19:35:05. +type OrderDetails struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply OrderDetailsReply `xml:"reply"` +} + +// OrderDetailsReply A reply representation. +type OrderDetailsReply struct { + Reply + OrderDate string `xml:"order_date"` + Method string `xml:"method"` + Total string `xml:"total"` + OrderDetails []OrderDetail `xml:"order_details"` +} + +// OrderDetail An Order Detail representation. +type OrderDetail struct { + Description string `xml:"description"` + YearsQty string `xml:"years_qty"` + Price string `xml:"price"` + Subtotal string `xml:"subtotal"` + Status string `xml:"status"` + CreditedDate string `xml:"credited_date,omitempty"` + CreditedAmount string `xml:"credited_amount,omitempty"` +} + +// PortfolioAdd was generated 2019-03-20 19:35:05. +type PortfolioAdd struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply Reply `xml:"reply"` +} + +// PortfolioDelete was generated 2019-03-20 19:35:05. +type PortfolioDelete struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply Reply `xml:"reply"` +} + +// PortfolioDomainAssociate was generated 2019-03-20 19:35:05. +type PortfolioDomainAssociate struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply PortfolioDomainAssociateReply `xml:"reply"` +} + +// PortfolioDomainAssociateReply A reply representation. +type PortfolioDomainAssociateReply struct { + Reply + Message string `xml:"message"` +} + +// PortfolioList was generated 2019-03-20 19:35:05. +type PortfolioList struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply PortfolioListReply `xml:"reply"` +} + +// PortfolioListReply A reply representation. +type PortfolioListReply struct { + Reply + Portfolios Portfolios `xml:"portfolios"` +} + +// Portfolios A Portfolios representation. +type Portfolios struct { + Name string `xml:"name"` + Code string `xml:"code"` +} + +// RegisterDomainDrop was generated 2019-03-20 19:35:05. +type RegisterDomainDrop struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply RegisterDomainDropReply `xml:"reply"` +} + +// RegisterDomainDropReply A reply representation. +type RegisterDomainDropReply struct { + Reply + Message string `xml:"message"` + Domain string `xml:"domain"` + OrderAmount string `xml:"order_amount"` +} + +// RegisterDomain was generated 2019-03-20 19:35:05. +type RegisterDomain struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply RegisterDomainReply `xml:"reply"` +} + +// RegisterDomainReply A reply representation. +type RegisterDomainReply struct { + Reply + Message string `xml:"message"` + Domain string `xml:"domain"` + OrderAmount string `xml:"order_amount"` +} + +// RegistrantVerificationStatus was generated 2019-03-20 19:35:05. +type RegistrantVerificationStatus struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply RegistrantVerificationStatusReply `xml:"reply"` +} + +// RegistrantVerificationStatusReply A reply representation. +type RegistrantVerificationStatusReply struct { + Reply + Emails []RegistrantEmail `xml:"email"` +} + +// RegistrantEmail A email representation. +type RegistrantEmail struct { + EmailAddress string `xml:"email_address"` + Domains string `xml:"domains"` + Verified string `xml:"verified"` +} + +// RemoveAutoRenewal was generated 2019-03-20 19:35:05. +type RemoveAutoRenewal struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply Reply `xml:"reply"` +} + +// RemovePrivacy was generated 2019-03-20 19:35:05. +type RemovePrivacy struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply Reply `xml:"reply"` +} + +// RenewDomain was generated 2019-03-20 19:35:05. +type RenewDomain struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply RenewDomainReply `xml:"reply"` +} + +// RenewDomainReply A reply representation. +type RenewDomainReply struct { + Reply + Message string `xml:"message"` + Domain string `xml:"domain"` + OrderAmount string `xml:"order_amount"` +} + +// RetrieveAuthCode was generated 2019-03-20 19:35:05. +type RetrieveAuthCode struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply Reply `xml:"reply"` +} + +// TransferDomain was generated 2019-03-20 19:35:05. +type TransferDomain struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply TransferDomainReply `xml:"reply"` +} + +// TransferDomainReply A reply representation. +type TransferDomainReply struct { + Reply + Message string `xml:"message"` + Domain string `xml:"domain"` + OrderAmount string `xml:"order_amount"` +} + +// TransferUpdateChangeEPPCode was generated 2019-03-20 19:35:05. +type TransferUpdateChangeEPPCode struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply Reply `xml:"reply"` +} + +// TransferUpdateResendAdminEmail was generated 2019-03-20 19:35:05. +type TransferUpdateResendAdminEmail struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply Reply `xml:"reply"` +} + +// TransferUpdateResubmitToRegistry was generated 2019-03-20 19:35:05. +type TransferUpdateResubmitToRegistry struct { + XMLName xml.Name `xml:"namesilo"` + Request Request `xml:"request"` + Reply Reply `xml:"reply"` +} diff --git a/vendor/github.com/nrdcg/namesilo/namesilo.go b/vendor/github.com/nrdcg/namesilo/namesilo.go new file mode 100644 index 00000000..47ea7769 --- /dev/null +++ b/vendor/github.com/nrdcg/namesilo/namesilo.go @@ -0,0 +1,60 @@ +// Package namesilo A Go client library for accessing the Namesilo API. +package namesilo + +import ( + "fmt" + "net/http" + "net/url" + + querystring "github.com/google/go-querystring/query" +) + +const ( + // DefaultAPIEndpoint The default API endpoint. + DefaultAPIEndpoint = "https://www.namesilo.com/api" + + // SandboxAPIEndpoint The sandbox API endpoint. + SandboxAPIEndpoint = "https://sandbox.namesilo.com/api" +) + +// Response Codes +const ( + SuccessfulAPIOperation = "300" + SuccessfulRegistration = "301" + SuccessfulOrder = "302" +) + +// Client the Namesilo client. +type Client struct { + Endpoint string + HTTPClient *http.Client +} + +// NewClient Creates a Namesilo client. +func NewClient(httpClient *http.Client) *Client { + if httpClient == nil { + httpClient = http.DefaultClient + } + + return &Client{ + Endpoint: DefaultAPIEndpoint, + HTTPClient: httpClient, + } +} + +func (c *Client) get(name string, params interface{}) (*http.Response, error) { + uri, err := url.Parse(fmt.Sprintf("%s/%s", c.Endpoint, name)) + if err != nil { + return nil, err + } + + if params != nil { + v, err := querystring.Values(params) + if err != nil { + return nil, err + } + uri.RawQuery = v.Encode() + } + + return c.HTTPClient.Get(uri.String()) +} diff --git a/vendor/github.com/nrdcg/namesilo/params.go b/vendor/github.com/nrdcg/namesilo/params.go new file mode 100644 index 00000000..234ad7df --- /dev/null +++ b/vendor/github.com/nrdcg/namesilo/params.go @@ -0,0 +1,520 @@ +package namesilo + +// AddAccountFundsParams Parameters for operation addAccountFunds. +type AddAccountFundsParams struct { + Amount string `url:"amount"` + PaymentID string `url:"payment_id"` +} + +// AddAutoRenewalParams Parameters for operation addAutoRenewal. +type AddAutoRenewalParams struct { + Domain string `url:"domain"` // Required +} + +// AddPrivacyParams Parameters for operation addPrivacy. +type AddPrivacyParams struct { + Domain string `url:"domain"` // Required +} + +// AddRegisteredNameServerParams Parameters for operation addRegisteredNameServer. +type AddRegisteredNameServerParams struct { + Domain string `url:"domain"` // required + NewHost string `url:"new_host"` // Required + IP1 string `url:"ip1"` // Required + + IP2 string `url:"ip2"` // Optional + IP3 string `url:"ip3"` // Optional + IP4 string `url:"ip4"` // Optional + IP5 string `url:"ip5"` // Optional + IP6 string `url:"ip6"` // Optional + IP7 string `url:"ip7"` // Optional + IP8 string `url:"ip8"` // Optional + IP9 string `url:"ip9"` // Optional + IP10 string `url:"ip10"` // Optional + IP11 string `url:"ip11"` // Optional + IP12 string `url:"ip12"` // Optional + IP13 string `url:"ip13"` // Optional +} + +// ChangeNameServersParams Parameters for operation changeNameServers. +type ChangeNameServersParams struct { + Domains string `url:"domain"` // Required (A comma-delimited list of up to 200 domains) + + NameServer1 string `url:"ns1"` // Required + NameServer2 string `url:"ns2"` // Required + + NameServer3 string `url:"ns3"` + NameServer4 string `url:"ns4"` + NameServer5 string `url:"ns5"` + NameServer6 string `url:"ns6"` + NameServer7 string `url:"ns7"` + NameServer8 string `url:"ns8"` + NameServer9 string `url:"ns9"` + NameServer10 string `url:"ns10"` + NameServer11 string `url:"ns11"` + NameServer12 string `url:"ns12"` + NameServer13 string `url:"ns13"` +} + +// CheckRegisterAvailabilityParams Parameters for operation checkRegisterAvailability. +type CheckRegisterAvailabilityParams struct { + Domains string `url:"domains"` // Required (A comma-delimited list of domains to check) +} + +// CheckTransferAvailabilityParams Parameters for operation checkTransferAvailability. +type CheckTransferAvailabilityParams struct { + Domains string `url:"domains"` // Required (A comma-delimited list of domains to check) +} + +// CheckTransferStatusParams Parameters for operation checkTransferStatus. +type CheckTransferStatusParams struct { + Domain string `url:"domain"` // Required +} + +// ConfigureEmailForwardParams Parameters for operation configureEmailForward. +type ConfigureEmailForwardParams struct { + Domain string `url:"domain"` // Required + Email string `url:"email"` // Required + Forward1 string `url:"forward1"` // Required + + Forward2 string `url:"forward12"` // Optional + Forward3 string `url:"forward13"` // Optional + Forward4 string `url:"forward14"` // Optional + Forward5 string `url:"forward15"` // Optional +} + +// ContactAddParams Parameters for operation contactAdd. +type ContactAddParams struct { + FirstName string `url:"fn"` // Contact Information + LastName string `url:"ln"` // Contact Information + MailingAddress string `url:"ad"` // Contact Information + MailingCity string `url:"cy"` // Contact Information + MailingStateProvinceTerritory string `url:"st"` // Contact Information + MailingZipPostalCode string `url:"zp"` // Contact Information + MailingCountry string `url:"ct"` // Contact Information + EmailAddress string `url:"em"` // Contact Information + PhoneNumber string `url:"ph"` // Contact Information + + Company string `url:"cp"` // Contact Information + MailingAddress2 string `url:"ad2"` // Contact Information + Fax string `url:"fx"` // Contact Information + + USNexusCategory string `url:"usnc"` // Contact Information + USApplicationPurpose string `url:"usap"` // Contact Information + + CIRALegalForm string `url:"calf"` // CIRA + CIRALanguage string `url:"caln"` // CIRA + CIRAAgreementVersion string `url:"caag"` // CIRA + CIRAWHOISDisplay string `url:"cawd"` // CIRA +} + +// ContactDeleteParams Parameters for operation contactDelete. +type ContactDeleteParams struct { + ContactID string `url:"contact_id"` +} + +// ContactDomainAssociateParams Parameters for operation contactDomainAssociate. +type ContactDomainAssociateParams struct { + Domain string `url:"domain"` // Required + + Registrant string `url:"registrant"` // Optional + Administrative string `url:"administrative"` // Optional + Billing string `url:"billing"` // Optional + Technical string `url:"technical"` // Optional + + ContactID string `url:"contact_id"` // Contact ID +} + +// ContactListParams Parameters for operation contactList. +type ContactListParams struct { + ContactID string `url:"contact_id"` // Optional +} + +// ContactUpdateParams Parameters for operation contactUpdate. +type ContactUpdateParams struct { + FirstName string `url:"fn"` // Contact Information + LastName string `url:"ln"` // Contact Information + MailingAddress string `url:"ad"` // Contact Information + MailingCity string `url:"cy"` // Contact Information + MailingStateProvinceTerritory string `url:"st"` // Contact Information + MailingZipPostalCode string `url:"zp"` // Contact Information + MailingCountry string `url:"ct"` // Contact Information + EmailAddress string `url:"em"` // Contact Information + PhoneNumber string `url:"ph"` // Contact Information + + Company string `url:"cp"` // Contact Information + MailingAddress2 string `url:"ad2"` // Contact Information + Fax string `url:"fx"` // Contact Information + + USNexusCategory string `url:"usnc"` // Contact Information + USApplicationPurpose string `url:"usap"` // Contact Information + + CIRALegalForm string `url:"calf"` // CIRA + CIRALanguage string `url:"caln"` // CIRA + CIRAAgreementVersion string `url:"caag"` // CIRA + CIRAWHOISDisplay string `url:"cawd"` // CIRA +} + +// DeleteEmailForwardParams Parameters for operation deleteEmailForward. +type DeleteEmailForwardParams struct { + Domain string `url:"domain"` // Required + Email string `url:"email"` // Required +} + +// DeleteRegisteredNameServerParams Parameters for operation deleteRegisteredNameServer. +type DeleteRegisteredNameServerParams struct { + Domain string `url:"domain"` // required + CurrentHost string `url:"current_host"` // Required +} + +// DnsAddRecordParams Parameters for operation dnsAddRecord. +type DnsAddRecordParams struct { + Domain string `url:"domain"` // Required + + Type string `url:"rrtype"` // Possible values are "A", "AAAA", "CNAME", "MX" and "TXT" + Host string `url:"rrhost"` + Value string `url:"rrvalue"` + Distance int `url:"rrdistance"` + TTL int `url:"rrttl"` +} + +// DnsDeleteRecordParams Parameters for operation dnsDeleteRecord. +type DnsDeleteRecordParams struct { + Domain string `url:"domain"` // Required + + ID string `url:"rrid"` +} + +// DnsListRecordsParams Parameters for operation dnsListRecords. +type DnsListRecordsParams struct { + Domain string `url:"domain"` // Required +} + +// DnsSecAddRecordParams Parameters for operation dnsSecAddRecord. +type DnsSecAddRecordParams struct { + Domain string `url:"domain"` // Required + + Digest string `url:"digest"` + KeyTag string `url:"keyTag"` + DigestType string `url:"digestType"` + Alg string `url:"alg"` +} + +// DnsSecDeleteRecordParams Parameters for operation dnsSecDeleteRecord. +type DnsSecDeleteRecordParams struct { + Domain string `url:"domain"` // Required + + Digest string `url:"digest"` + KeyTag string `url:"keyTag"` + DigestType string `url:"digestType"` + Alg string `url:"alg"` +} + +// DnsSecListRecordsParams Parameters for operation dnsSecListRecords. +type DnsSecListRecordsParams struct { + Domain string `url:"domain"` // Required +} + +// DnsUpdateRecordParams Parameters for operation dnsUpdateRecord. +type DnsUpdateRecordParams struct { + Domain string `url:"domain"` // Required + + ID string `url:"rrid"` + Host string `url:"rrhost"` + Value string `url:"rrvalue"` + Distance int `url:"rrdistance"` + TTL int `url:"rrttl"` +} + +// DomainForwardParams Parameters for operation domainForward. +type DomainForwardParams struct { + Domain string `url:"domain"` // Required + Protocol string `url:"protocol"` // Required + Address string `url:"address"` // Required + Method string `url:"method"` // Required + + MetaTitle string `url:"meta_title"` // Optional + MetaDescription string `url:"meta_description"` // Optional + MetaKeywords string `url:"meta_keywords"` // Optional + +} + +// DomainForwardSubDomainParams Parameters for operation domainForwardSubDomain. +type DomainForwardSubDomainParams struct { + Domain string `url:"domain"` // Required + SubDomain string `url:"sub_domain"` // Required + Protocol string `url:"protocol"` // Required + Address string `url:"address"` // Required + Method string `url:"method"` // Required + + MetaTitle string `url:"meta_title"` // Optional + MetaDescription string `url:"meta_description"` // Optional + MetaKeywords string `url:"meta_keywords"` // Optional +} + +// DomainForwardSubDomainDeleteParams Parameters for operation domainForwardSubDomainDelete. +type DomainForwardSubDomainDeleteParams struct { + Domain string `url:"domain"` // Required + SubDomain string `url:"sub_domain"` // Required +} + +// DomainLockParams Parameters for operation domainLock. +type DomainLockParams struct { + Domain string `url:"domain"` // Required +} + +// DomainUnlockParams Parameters for operation domainUnlock. +type DomainUnlockParams struct { + Domain string `url:"domain"` // Required +} + +// EmailVerificationParams Parameters for operation emailVerification. +type EmailVerificationParams struct { + Email string `url:"email"` // Required +} + +// GetAccountBalanceParams Parameters for operation getAccountBalance. +type GetAccountBalanceParams struct{} + +// GetDomainInfoParams Parameters for operation getDomainInfo. +type GetDomainInfoParams struct { + Domain string `url:"domain"` // Required +} + +// GetPricesParams Parameters for operation getPrices. +type GetPricesParams struct { + RetailPrices string `url:"retail_prices"` // Required + RegistrationDomains string `url:"registration_domains"` // Required +} + +// ListDomainsParams Parameters for operation listDomains. +type ListDomainsParams struct { + Portfolio string `url:"portfolio"` // Optional +} + +// ListEmailForwardsParams Parameters for operation listEmailForwards. +type ListEmailForwardsParams struct { + Domain string `url:"domain"` // Required +} + +// ListOrdersParams Parameters for operation listOrders. +type ListOrdersParams struct{} + +// ListRegisteredNameServersParams Parameters for operation listRegisteredNameServers. +type ListRegisteredNameServersParams struct { + Domain string `url:"domain"` // required +} + +// MarketplaceActiveSalesOverviewParams Parameters for operation marketplaceActiveSalesOverview. +type MarketplaceActiveSalesOverviewParams struct{} + +// MarketplaceAddOrModifySaleParams Parameters for operation marketplaceAddOrModifySale. +type MarketplaceAddOrModifySaleParams struct { + Domain string `url:"domain"` // Required + Action string `url:"action"` // Required + SaleType string `url:"sale_type"` // Required + + Reserve string `url:"reserve"` // Optional + ShowReserve int32 `url:"show_reserve"` // Optional + BuyNow string `url:"buy_now"` // Optional + PaymentPlanOffered int32 `url:"payment_plan_offered"` // Optional + PaymentPlanMonths int32 `url:"payment_plan_months"` // Optional + PaymentPlanDownPayment string `url:"payment_plan_down_payment"` // Optional + EndDate string `url:"end_date"` // Optional + EndDateUseMaximum int32 `url:"end_date_use_maximum"` // Optional + NotifyBuyers int32 `url:"notify_buyers"` // Optional + Category1 string `url:"category1"` // Optional + Description string `url:"description"` // Optional + UseForSaleLandingPage int32 `url:"use_for_sale_landing_page"` // Optional + MpUseOurNameservers int32 `url:"mp_use_our_nameservers"` // Optional + Password string `url:"password"` // Optional + CancelSale int32 `url:"cancel_sale"` // Optional +} + +// MarketplaceLandingPageUpdateParams Parameters for operation marketplaceLandingPageUpdate. +type MarketplaceLandingPageUpdateParams struct { + Domain string `url:"domain"` // Required + + MpTemplate int32 `url:"mp_template"` // Optional + MpBgcolor string `url:"mp_bgcolor"` // Optional + MpTextcolor string `url:"mp_textcolor"` // Optional + MpShowBuyNow int32 `url:"mp_show_buy_now"` // Optional + MpShowMoreInfo int32 `url:"mp_show_more_info"` // Optional + MpShowRenewalPrice int32 `url:"mp_show_renewal_price"` // Optional + MpShowOtherForSale int32 `url:"mp_show_other_for_sale"` // Optional + MpOtherDomainLinks string `url:"mp_other_domain_links"` // Optional + MpMessage string `url:"mp_message"` // Optional +} + +// ModifyRegisteredNameServerParams Parameters for operation modifyRegisteredNameServer. +type ModifyRegisteredNameServerParams struct { + Domain string `url:"domain"` // required + CurrentHost string `url:"current_host"` // Required + NewHost string `url:"new_host"` // Required + IP1 string `url:"ip1"` // Required + + IP2 string `url:"ip2"` // Optional + IP3 string `url:"ip3"` // Optional + IP4 string `url:"ip4"` // Optional + IP5 string `url:"ip5"` // Optional + IP6 string `url:"ip6"` // Optional + IP7 string `url:"ip7"` // Optional + IP8 string `url:"ip8"` // Optional + IP9 string `url:"ip9"` // Optional + IP10 string `url:"ip10"` // Optional + IP11 string `url:"ip11"` // Optional + IP12 string `url:"ip12"` // Optional + IP13 string `url:"ip13"` // Optional +} + +// OrderDetailsParams Parameters for operation orderDetails. +type OrderDetailsParams struct { + OrderNumber int `url:"order_number"` +} + +// PortfolioAddParams Parameters for operation portfolioAdd. +type PortfolioAddParams struct { + Portfolio string `url:"portfolio"` // Required +} + +// PortfolioDeleteParams Parameters for operation portfolioDelete. +type PortfolioDeleteParams struct { + Portfolio string `url:"portfolio"` // Required +} + +// PortfolioDomainAssociateParams Parameters for operation portfolioDomainAssociate. +type PortfolioDomainAssociateParams struct { + Portfolio string `url:"portfolio"` // Required + Domains string `url:"domains"` // Required (Comma-delimited list) +} + +// PortfolioListParams Parameters for operation portfolioList. +type PortfolioListParams struct{} + +// RegisterDomainParams Parameters for operation registerDomain. +type RegisterDomainParams struct { + Domain string `url:"domain"` // Required + Years int32 `url:"years"` // Required + + PaymentID string `url:"payment_id"` // Optional + Private int32 `url:"private"` // Optional + AutoRenew int32 `url:"auto_renew"` // Optional + Portfolio string `url:"portfolio"` // Optional + Coupon string `url:"coupon"` // Optional + + NameServer1 string `url:"ns1"` + NameServer2 string `url:"ns2"` + NameServer3 string `url:"ns3"` + NameServer4 string `url:"ns4"` + NameServer5 string `url:"ns5"` + NameServer6 string `url:"ns6"` + NameServer7 string `url:"ns7"` + NameServer8 string `url:"ns8"` + NameServer9 string `url:"ns9"` + NameServer10 string `url:"ns10"` + NameServer11 string `url:"ns11"` + NameServer12 string `url:"ns12"` + NameServer13 string `url:"ns13"` + + FirstName string `url:"fn"` // Contact Information + LastName string `url:"ln"` // Contact Information + MailingAddress string `url:"ad"` // Contact Information + MailingCity string `url:"cy"` // Contact Information + MailingStateProvinceTerritory string `url:"st"` // Contact Information + MailingZipPostalCode string `url:"zp"` // Contact Information + MailingCountry string `url:"ct"` // Contact Information + EmailAddress string `url:"em"` // Contact Information + PhoneNumber string `url:"ph"` // Contact Information + + Company string `url:"cp"` // Contact Information + MailingAddress2 string `url:"ad2"` // Contact Information + Fax string `url:"fx"` // Contact Information + + USNexusCategory string `url:"usnc"` // Contact Information + USApplicationPurpose string `url:"usap"` // Contact Information + + ContactID string `url:"contact_id"` // Contact ID +} + +// RegisterDomainDropParams Parameters for operation registerDomainDrop. +type RegisterDomainDropParams struct { + Domain string `url:"domain"` // Required + Years int32 `url:"years"` // Required + + Private int32 `url:"private"` // Optional + AutoRenew int32 `url:"auto_renew"` // Optional +} + +// RegistrantVerificationStatusParams Parameters for operation registrantVerificationStatus. +type RegistrantVerificationStatusParams struct{} + +// RemoveAutoRenewalParams Parameters for operation removeAutoRenewal. +type RemoveAutoRenewalParams struct { + Domain string `url:"domain"` // Required +} + +// RemovePrivacyParams Parameters for operation removePrivacy. +type RemovePrivacyParams struct { + Domain string `url:"domain"` // Required +} + +// RenewDomainParams Parameters for operation renewDomain. +type RenewDomainParams struct { + Domain string `url:"domain"` // Required + Years int32 `url:"years"` // Required + + PaymentID string `url:"payment_id"` // Optional + Coupon string `url:"coupon"` // Optional +} + +// RetrieveAuthCodeParams Parameters for operation retrieveAuthCode. +type RetrieveAuthCodeParams struct { + Domain string `url:"domain"` // Required +} + +// TransferDomainParams Parameters for operation transferDomain. +type TransferDomainParams struct { + Domain string `url:"domain"` // Required + + PaymentID string `url:"payment_id"` // Optional + Auth string `url:"auth"` // Optional + Private int32 `url:"private"` // Optional + AutoRenew int32 `url:"auto_renew"` // Optional + Portfolio string `url:"portfolio"` // Optional + Coupon string `url:"coupon"` // Optional + + FirstName string `url:"fn"` // Contact Information + LastName string `url:"ln"` // Contact Information + MailingAddress string `url:"ad"` // Contact Information + MailingCity string `url:"cy"` // Contact Information + MailingStateProvinceTerritory string `url:"st"` // Contact Information + MailingZipPostalCode string `url:"zp"` // Contact Information + MailingCountry string `url:"ct"` // Contact Information + EmailAddress string `url:"em"` // Contact Information + PhoneNumber string `url:"ph"` // Contact Information + + Company string `url:"cp"` // Contact Information + MailingAddress2 string `url:"ad2"` // Contact Information + Fax string `url:"fx"` // Contact Information + + USNexusCategory string `url:"usnc"` // Contact Information + USApplicationPurpose string `url:"usap"` // Contact Information + + ContactID string `url:"contact_id"` // Contact ID +} + +// TransferUpdateChangeEPPCodeParams Parameters for operation transferUpdateChangeEPPCode. +type TransferUpdateChangeEPPCodeParams struct { + Domain string `url:"domain"` // Required + Auth string `url:"auth"` // Required +} + +// TransferUpdateResendAdminEmailParams Parameters for operation transferUpdateResendAdminEmail. +type TransferUpdateResendAdminEmailParams struct { + Domain string `url:"domain"` // Required +} + +// TransferUpdateResubmitToRegistryParams Parameters for operation transferUpdateResubmitToRegistry. +type TransferUpdateResubmitToRegistryParams struct { + Domain string `url:"domain"` // Required +} diff --git a/vendor/github.com/nrdcg/namesilo/zz_gen_client.go b/vendor/github.com/nrdcg/namesilo/zz_gen_client.go new file mode 100644 index 00000000..efb77731 --- /dev/null +++ b/vendor/github.com/nrdcg/namesilo/zz_gen_client.go @@ -0,0 +1,2192 @@ +package namesilo + +import ( + "encoding/xml" + "fmt" + "io/ioutil" + "net/http" +) + +// AddAccountFunds Execute operation addAccountFunds. +func (c *Client) AddAccountFunds(params *AddAccountFundsParams) (*AddAccountFunds, error) { + resp, err := c.get("addAccountFunds", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &AddAccountFunds{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// AddAutoRenewal Execute operation addAutoRenewal. +func (c *Client) AddAutoRenewal(params *AddAutoRenewalParams) (*AddAutoRenewal, error) { + resp, err := c.get("addAutoRenewal", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &AddAutoRenewal{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// AddPrivacy Execute operation addPrivacy. +func (c *Client) AddPrivacy(params *AddPrivacyParams) (*AddPrivacy, error) { + resp, err := c.get("addPrivacy", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &AddPrivacy{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// AddRegisteredNameServer Execute operation addRegisteredNameServer. +func (c *Client) AddRegisteredNameServer(params *AddRegisteredNameServerParams) (*AddRegisteredNameServer, error) { + resp, err := c.get("addRegisteredNameServer", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &AddRegisteredNameServer{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// ChangeNameServers Execute operation changeNameServers. +func (c *Client) ChangeNameServers(params *ChangeNameServersParams) (*ChangeNameServers, error) { + resp, err := c.get("changeNameServers", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &ChangeNameServers{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// CheckRegisterAvailability Execute operation checkRegisterAvailability. +func (c *Client) CheckRegisterAvailability(params *CheckRegisterAvailabilityParams) (*CheckRegisterAvailability, error) { + resp, err := c.get("checkRegisterAvailability", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &CheckRegisterAvailability{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// CheckTransferAvailability Execute operation checkTransferAvailability. +func (c *Client) CheckTransferAvailability(params *CheckTransferAvailabilityParams) (*CheckTransferAvailability, error) { + resp, err := c.get("checkTransferAvailability", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &CheckTransferAvailability{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// CheckTransferStatus Execute operation checkTransferStatus. +func (c *Client) CheckTransferStatus(params *CheckTransferStatusParams) (*CheckTransferStatus, error) { + resp, err := c.get("checkTransferStatus", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &CheckTransferStatus{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// ConfigureEmailForward Execute operation configureEmailForward. +func (c *Client) ConfigureEmailForward(params *ConfigureEmailForwardParams) (*ConfigureEmailForward, error) { + resp, err := c.get("configureEmailForward", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &ConfigureEmailForward{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// ContactAdd Execute operation contactAdd. +func (c *Client) ContactAdd(params *ContactAddParams) (*ContactAdd, error) { + resp, err := c.get("contactAdd", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &ContactAdd{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// ContactDelete Execute operation contactDelete. +func (c *Client) ContactDelete(params *ContactDeleteParams) (*ContactDelete, error) { + resp, err := c.get("contactDelete", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &ContactDelete{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// ContactDomainAssociate Execute operation contactDomainAssociate. +func (c *Client) ContactDomainAssociate(params *ContactDomainAssociateParams) (*ContactDomainAssociate, error) { + resp, err := c.get("contactDomainAssociate", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &ContactDomainAssociate{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// ContactList Execute operation contactList. +func (c *Client) ContactList(params *ContactListParams) (*ContactList, error) { + resp, err := c.get("contactList", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &ContactList{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// ContactUpdate Execute operation contactUpdate. +func (c *Client) ContactUpdate(params *ContactUpdateParams) (*ContactUpdate, error) { + resp, err := c.get("contactUpdate", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &ContactUpdate{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// DeleteEmailForward Execute operation deleteEmailForward. +func (c *Client) DeleteEmailForward(params *DeleteEmailForwardParams) (*DeleteEmailForward, error) { + resp, err := c.get("deleteEmailForward", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &DeleteEmailForward{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// DeleteRegisteredNameServer Execute operation deleteRegisteredNameServer. +func (c *Client) DeleteRegisteredNameServer(params *DeleteRegisteredNameServerParams) (*DeleteRegisteredNameServer, error) { + resp, err := c.get("deleteRegisteredNameServer", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &DeleteRegisteredNameServer{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// DnsAddRecord Execute operation dnsAddRecord. +func (c *Client) DnsAddRecord(params *DnsAddRecordParams) (*DnsAddRecord, error) { + resp, err := c.get("dnsAddRecord", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &DnsAddRecord{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// DnsDeleteRecord Execute operation dnsDeleteRecord. +func (c *Client) DnsDeleteRecord(params *DnsDeleteRecordParams) (*DnsDeleteRecord, error) { + resp, err := c.get("dnsDeleteRecord", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &DnsDeleteRecord{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// DnsListRecords Execute operation dnsListRecords. +func (c *Client) DnsListRecords(params *DnsListRecordsParams) (*DnsListRecords, error) { + resp, err := c.get("dnsListRecords", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &DnsListRecords{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// DnsSecAddRecord Execute operation dnsSecAddRecord. +func (c *Client) DnsSecAddRecord(params *DnsSecAddRecordParams) (*DnsSecAddRecord, error) { + resp, err := c.get("dnsSecAddRecord", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &DnsSecAddRecord{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// DnsSecDeleteRecord Execute operation dnsSecDeleteRecord. +func (c *Client) DnsSecDeleteRecord(params *DnsSecDeleteRecordParams) (*DnsSecDeleteRecord, error) { + resp, err := c.get("dnsSecDeleteRecord", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &DnsSecDeleteRecord{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// DnsSecListRecords Execute operation dnsSecListRecords. +func (c *Client) DnsSecListRecords(params *DnsSecListRecordsParams) (*DnsSecListRecords, error) { + resp, err := c.get("dnsSecListRecords", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &DnsSecListRecords{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// DnsUpdateRecord Execute operation dnsUpdateRecord. +func (c *Client) DnsUpdateRecord(params *DnsUpdateRecordParams) (*DnsUpdateRecord, error) { + resp, err := c.get("dnsUpdateRecord", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &DnsUpdateRecord{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// DomainForward Execute operation domainForward. +func (c *Client) DomainForward(params *DomainForwardParams) (*DomainForward, error) { + resp, err := c.get("domainForward", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &DomainForward{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// DomainForwardSubDomain Execute operation domainForwardSubDomain. +func (c *Client) DomainForwardSubDomain(params *DomainForwardSubDomainParams) (*DomainForwardSubDomain, error) { + resp, err := c.get("domainForwardSubDomain", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &DomainForwardSubDomain{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// DomainForwardSubDomainDelete Execute operation domainForwardSubDomainDelete. +func (c *Client) DomainForwardSubDomainDelete(params *DomainForwardSubDomainDeleteParams) (*DomainForwardSubDomainDelete, error) { + resp, err := c.get("domainForwardSubDomainDelete", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &DomainForwardSubDomainDelete{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// DomainLock Execute operation domainLock. +func (c *Client) DomainLock(params *DomainLockParams) (*DomainLock, error) { + resp, err := c.get("domainLock", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &DomainLock{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// DomainUnlock Execute operation domainUnlock. +func (c *Client) DomainUnlock(params *DomainUnlockParams) (*DomainUnlock, error) { + resp, err := c.get("domainUnlock", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &DomainUnlock{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// EmailVerification Execute operation emailVerification. +func (c *Client) EmailVerification(params *EmailVerificationParams) (*EmailVerification, error) { + resp, err := c.get("emailVerification", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &EmailVerification{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// GetAccountBalance Execute operation getAccountBalance. +func (c *Client) GetAccountBalance(params *GetAccountBalanceParams) (*GetAccountBalance, error) { + resp, err := c.get("getAccountBalance", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &GetAccountBalance{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// GetDomainInfo Execute operation getDomainInfo. +func (c *Client) GetDomainInfo(params *GetDomainInfoParams) (*GetDomainInfo, error) { + resp, err := c.get("getDomainInfo", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &GetDomainInfo{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// GetPrices Execute operation getPrices. +func (c *Client) GetPrices(params *GetPricesParams) (*GetPrices, error) { + resp, err := c.get("getPrices", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &GetPrices{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// ListDomains Execute operation listDomains. +func (c *Client) ListDomains(params *ListDomainsParams) (*ListDomains, error) { + resp, err := c.get("listDomains", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &ListDomains{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// ListEmailForwards Execute operation listEmailForwards. +func (c *Client) ListEmailForwards(params *ListEmailForwardsParams) (*ListEmailForwards, error) { + resp, err := c.get("listEmailForwards", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &ListEmailForwards{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// ListOrders Execute operation listOrders. +func (c *Client) ListOrders(params *ListOrdersParams) (*ListOrders, error) { + resp, err := c.get("listOrders", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &ListOrders{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// ListRegisteredNameServers Execute operation listRegisteredNameServers. +func (c *Client) ListRegisteredNameServers(params *ListRegisteredNameServersParams) (*ListRegisteredNameServers, error) { + resp, err := c.get("listRegisteredNameServers", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &ListRegisteredNameServers{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// MarketplaceActiveSalesOverview Execute operation marketplaceActiveSalesOverview. +func (c *Client) MarketplaceActiveSalesOverview(params *MarketplaceActiveSalesOverviewParams) (*MarketplaceActiveSalesOverview, error) { + resp, err := c.get("marketplaceActiveSalesOverview", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &MarketplaceActiveSalesOverview{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// MarketplaceAddOrModifySale Execute operation marketplaceAddOrModifySale. +func (c *Client) MarketplaceAddOrModifySale(params *MarketplaceAddOrModifySaleParams) (*MarketplaceAddOrModifySale, error) { + resp, err := c.get("marketplaceAddOrModifySale", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &MarketplaceAddOrModifySale{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// MarketplaceLandingPageUpdate Execute operation marketplaceLandingPageUpdate. +func (c *Client) MarketplaceLandingPageUpdate(params *MarketplaceLandingPageUpdateParams) (*MarketplaceLandingPageUpdate, error) { + resp, err := c.get("marketplaceLandingPageUpdate", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &MarketplaceLandingPageUpdate{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// ModifyRegisteredNameServer Execute operation modifyRegisteredNameServer. +func (c *Client) ModifyRegisteredNameServer(params *ModifyRegisteredNameServerParams) (*ModifyRegisteredNameServer, error) { + resp, err := c.get("modifyRegisteredNameServer", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &ModifyRegisteredNameServer{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// OrderDetails Execute operation orderDetails. +func (c *Client) OrderDetails(params *OrderDetailsParams) (*OrderDetails, error) { + resp, err := c.get("orderDetails", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &OrderDetails{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// PortfolioAdd Execute operation portfolioAdd. +func (c *Client) PortfolioAdd(params *PortfolioAddParams) (*PortfolioAdd, error) { + resp, err := c.get("portfolioAdd", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &PortfolioAdd{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// PortfolioDelete Execute operation portfolioDelete. +func (c *Client) PortfolioDelete(params *PortfolioDeleteParams) (*PortfolioDelete, error) { + resp, err := c.get("portfolioDelete", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &PortfolioDelete{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// PortfolioDomainAssociate Execute operation portfolioDomainAssociate. +func (c *Client) PortfolioDomainAssociate(params *PortfolioDomainAssociateParams) (*PortfolioDomainAssociate, error) { + resp, err := c.get("portfolioDomainAssociate", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &PortfolioDomainAssociate{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// PortfolioList Execute operation portfolioList. +func (c *Client) PortfolioList(params *PortfolioListParams) (*PortfolioList, error) { + resp, err := c.get("portfolioList", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &PortfolioList{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// RegisterDomain Execute operation registerDomain. +func (c *Client) RegisterDomain(params *RegisterDomainParams) (*RegisterDomain, error) { + resp, err := c.get("registerDomain", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &RegisterDomain{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// RegisterDomainDrop Execute operation registerDomainDrop. +func (c *Client) RegisterDomainDrop(params *RegisterDomainDropParams) (*RegisterDomainDrop, error) { + resp, err := c.get("registerDomainDrop", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &RegisterDomainDrop{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// RegistrantVerificationStatus Execute operation registrantVerificationStatus. +func (c *Client) RegistrantVerificationStatus(params *RegistrantVerificationStatusParams) (*RegistrantVerificationStatus, error) { + resp, err := c.get("registrantVerificationStatus", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &RegistrantVerificationStatus{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// RemoveAutoRenewal Execute operation removeAutoRenewal. +func (c *Client) RemoveAutoRenewal(params *RemoveAutoRenewalParams) (*RemoveAutoRenewal, error) { + resp, err := c.get("removeAutoRenewal", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &RemoveAutoRenewal{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// RemovePrivacy Execute operation removePrivacy. +func (c *Client) RemovePrivacy(params *RemovePrivacyParams) (*RemovePrivacy, error) { + resp, err := c.get("removePrivacy", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &RemovePrivacy{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// RenewDomain Execute operation renewDomain. +func (c *Client) RenewDomain(params *RenewDomainParams) (*RenewDomain, error) { + resp, err := c.get("renewDomain", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &RenewDomain{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// RetrieveAuthCode Execute operation retrieveAuthCode. +func (c *Client) RetrieveAuthCode(params *RetrieveAuthCodeParams) (*RetrieveAuthCode, error) { + resp, err := c.get("retrieveAuthCode", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &RetrieveAuthCode{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// TransferDomain Execute operation transferDomain. +func (c *Client) TransferDomain(params *TransferDomainParams) (*TransferDomain, error) { + resp, err := c.get("transferDomain", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &TransferDomain{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// TransferUpdateChangeEPPCode Execute operation transferUpdateChangeEPPCode. +func (c *Client) TransferUpdateChangeEPPCode(params *TransferUpdateChangeEPPCodeParams) (*TransferUpdateChangeEPPCode, error) { + resp, err := c.get("transferUpdateChangeEPPCode", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &TransferUpdateChangeEPPCode{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// TransferUpdateResendAdminEmail Execute operation transferUpdateResendAdminEmail. +func (c *Client) TransferUpdateResendAdminEmail(params *TransferUpdateResendAdminEmailParams) (*TransferUpdateResendAdminEmail, error) { + resp, err := c.get("transferUpdateResendAdminEmail", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &TransferUpdateResendAdminEmail{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +} + +// TransferUpdateResubmitToRegistry Execute operation transferUpdateResubmitToRegistry. +func (c *Client) TransferUpdateResubmitToRegistry(params *TransferUpdateResubmitToRegistryParams) (*TransferUpdateResubmitToRegistry, error) { + resp, err := c.get("transferUpdateResubmitToRegistry", params) + if err != nil { + return nil, err + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("error: HTTP status code %v", resp.StatusCode) + } + + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + + op := &TransferUpdateResubmitToRegistry{} + err = xml.Unmarshal(bytes, op) + if err != nil { + return nil, fmt.Errorf("failed to decode: %v: %s", err, bytes) + } + + switch op.Reply.Code { + case SuccessfulAPIOperation: + // Successful API operation + return op, nil + case SuccessfulRegistration: + // Successful registration, but not all provided hosts were valid resulting in our nameservers being used + return op, nil + case SuccessfulOrder: + // Successful order, but there was an error with the contact information provided so your account default contact profile was used + return op, nil + default: + // error + return op, fmt.Errorf("code: %s, details: %s", op.Reply.Code, op.Reply.Detail) + } +}