diff --git a/records.go b/records.go index 6cb0f2c..8dd7ead 100644 --- a/records.go +++ b/records.go @@ -10,7 +10,7 @@ var ValidPriority = []int{0, 1, 5, 10, 20, 30, 40, 50, 60} // Record struct contains data returned by `list-records` type Record struct { - ID int `json:"id"` + ID string `json:"id"` Name string `json:"name"` Type string `json:"type"` Content string `json:"content"` @@ -75,7 +75,7 @@ func AddRecord(token string, domain string, record Record) (Record, error) { // RemoveRecord removes a given record from a given domain. // If there are no errors it will return `nil`. -func RemoveRecord(token string, domain string, id int) error { +func RemoveRecord(token string, domain string, id string) error { params := map[string]interface{}{ "domain": domain, "id": id, diff --git a/records_test.go b/records_test.go index 2daf1c8..01e36d7 100644 --- a/records_test.go +++ b/records_test.go @@ -21,28 +21,28 @@ func TestListRecordsExpected(t *testing.T) { "result": { "records": [ { - "id": 1337, + "id": "1337", "name": "_acme-challenge", "type": "TXT", "content": "long-string", "ttl": 10800 }, { - "id": 1338, + "id": "1338", "name": "@", "type": "A", "content": "1.2.3.4", "ttl": 3600 }, { - "id": 1339, + "id": "1339", "name": "@", "type": "AAAA", "content": "2001:0DB8:0000:0000:0000:8A2E:0370:7334", "ttl": 900 }, { - "id": 1340, + "id": "1340", "name": "@", "type": "MX", "content": "mail.protonmail.ch", @@ -70,28 +70,28 @@ func TestListRecordsExpected(t *testing.T) { expected := []Record{ { - ID: 1337, + ID: "1337", Name: "_acme-challenge", Type: "TXT", Content: "long-string", TTL: 10800, }, { - ID: 1338, + ID: "1338", Name: "@", Type: "A", Content: "1.2.3.4", TTL: 3600, }, { - ID: 1339, + ID: "1339", Name: "@", Type: "AAAA", Content: "2001:0DB8:0000:0000:0000:8A2E:0370:7334", TTL: 900, }, { - ID: 1340, + ID: "1340", Name: "@", Type: "MX", Content: "mail.protonmail.ch", @@ -140,7 +140,7 @@ func TestAddRecordExpected(t *testing.T) { testData := `{ "jsonrpc": "2.0", "result": { - "id": 1337, + "id": "1337", "name": "@", "type": "MX", "content": "testing.com", @@ -173,7 +173,7 @@ func TestAddRecordExpected(t *testing.T) { } expected := Record{ - ID: 1337, + ID: "1337", Name: "@", Type: "MX", Content: "testing.com", @@ -221,7 +221,7 @@ func TestAddRecordError(t *testing.T) { func TestRemoveRecordExpected(t *testing.T) { token := "test-token" domain := "testing.com" - id := 1337 + id := "1337" Client = &mocks.MockClient{} testData := `{ @@ -244,7 +244,7 @@ func TestRemoveRecordExpected(t *testing.T) { func TestRemoveRecordError(t *testing.T) { token := "test-token" domain := "testing.com" - id := 1337 + id := "1337" Client = &mocks.MockClient{} testData := `{ @@ -275,7 +275,7 @@ func TestEditRecordExpected(t *testing.T) { testData := `{ "jsonrpc": "2.0", "result": { - "id": 1337, + "id": "1337", "name": "@", "type": "MX", "content": "testing.com", @@ -294,7 +294,7 @@ func TestEditRecordExpected(t *testing.T) { priority := 10 editing := Record{ - ID: 1337, + ID: "1337", Name: "@", Type: "MX", Content: "testing.com", @@ -329,7 +329,7 @@ func TestEditRecordError(t *testing.T) { priority := 10 editing := Record{ - ID: 1337, + ID: "1337", Name: "@", Type: "MX", Content: "testing.com",