Skip to content

Commit 6a48f95

Browse files
authored
Remove record type enumerations (#210)
1 parent 4c01546 commit 6a48f95

File tree

4 files changed

+16
-39
lines changed

4 files changed

+16
-39
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ This project uses [Semantic Versioning 2.0.0](http://semver.org/).
44

55
## main
66

7+
### Changed
8+
9+
- `ZoneRecord.Type` and `FilterByType()` changed from enum to `string`
10+
711
### Removed
812

13+
- Removed `ZoneRecordType` enumeration
914
- Removed deprecated `GetWhoisPrivacy` (dnsimple/dnsimple-developer#919)
1015
- Removed deprecated `RenewWhoisPrivacy` (dnsimple/dnsimple-developer#919)
1116

src/dnsimple-test/Services/ZoneRecordsTest.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public void ZoneRecordData()
7474
record.Content, Is.EqualTo("ns1.dnsimple.com admin.dnsimple.com 1458642070 86400 7200 604800 300"));
7575
Assert.That(record.Ttl, Is.EqualTo(3600));
7676
Assert.That(record.Priority, Is.Null);
77-
Assert.That(record.Type, Is.EqualTo(ZoneRecordType.SOA));
77+
Assert.That(record.Type, Is.EqualTo("SOA"));
7878
Assert.That(record.Regions, Contains.Item("global"));
7979
Assert.That(record.SystemRecord, Is.True);
8080
Assert.That(record.CreatedAt, Is.EqualTo(CreatedAt));
@@ -124,7 +124,7 @@ public void ListRecordsWithOptions(long account, string zoneId,
124124
}
125125
}.FilterByName("example")
126126
.FilterByExactName("boom")
127-
.FilterByType(ZoneRecordType.SOA)
127+
.FilterByType("SOA")
128128
.SortById(Order.asc)
129129
.SortByName(Order.desc)
130130
.SortByContent(Order.asc)
@@ -148,7 +148,7 @@ public void CreateZoneRecord(string fixture, long accountId,
148148
var record = new ZoneRecord
149149
{
150150
Name = name,
151-
Type = ZoneRecordType.A,
151+
Type = "A",
152152
Content = "127.0.0.1",
153153
Ttl = 600,
154154
};
@@ -164,7 +164,7 @@ public void CreateZoneRecord(string fixture, long accountId,
164164
Assert.That(created.Name, Is.EqualTo(name));
165165
Assert.That(created.Content, Is.EqualTo("127.0.0.1"));
166166
Assert.That(created.Ttl, Is.EqualTo(600));
167-
Assert.That(created.Type, Is.EqualTo(ZoneRecordType.A));
167+
Assert.That(created.Type, Is.EqualTo("A"));
168168
Assert.That(created.Regions, Contains.Item("global"));
169169

170170
Assert.That(client.HttpMethodUsed(), Is.EqualTo(Method.POST));
@@ -191,7 +191,7 @@ public void GetZoneRecord(long accountId, string zoneId, long recordId,
191191
Assert.That(record.Content, Is.EqualTo("mxa.example.com"));
192192
Assert.That(record.Ttl, Is.EqualTo(600));
193193
Assert.That(record.Priority, Is.EqualTo(10));
194-
Assert.That(record.Type, Is.EqualTo(ZoneRecordType.MX));
194+
Assert.That(record.Type, Is.EqualTo("MX"));
195195
Assert.That(record.Regions, Contains.Item("SV1"));
196196
Assert.That(record.Regions, Contains.Item("IAD"));
197197
Assert.That(record.SystemRecord, Is.False);
@@ -229,7 +229,7 @@ public void UpdateZoneRecord(long accountId, string zoneId,
229229
Assert.That(record.Content, Is.EqualTo("mxb.example.com"));
230230
Assert.That(record.Ttl, Is.EqualTo(3600));
231231
Assert.That(record.Priority, Is.EqualTo(20));
232-
Assert.That(record.Type, Is.EqualTo(ZoneRecordType.MX));
232+
Assert.That(record.Type, Is.EqualTo("MX"));
233233
Assert.That(record.Regions, Contains.Item("global"));
234234
Assert.That(record.SystemRecord, Is.False);
235235

@@ -339,7 +339,7 @@ public void ZoneRecordsListOptions()
339339
}
340340
}.FilterByName("example")
341341
.FilterByExactName("boom")
342-
.FilterByType(ZoneRecordType.SOA)
342+
.FilterByType("SOA")
343343
.SortById(Order.asc)
344344
.SortByName(Order.desc)
345345
.SortByContent(Order.asc)

src/dnsimple/Services/ListOptions/ZoneRecordsListOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ public ZoneRecordsListOptions FilterByExactName(string name)
3434
/// </summary>
3535
/// <param name="type">The record type we want to filter by</param>
3636
/// <returns>The instance of the <c>ZoneRecordsListOptions</c></returns>
37-
public ZoneRecordsListOptions FilterByType(ZoneRecordType type)
37+
public ZoneRecordsListOptions FilterByType(string type)
3838
{
39-
AddFilter(new Filter { Field = "type", Value = type.ToString() });
39+
AddFilter(new Filter { Field = "type", Value = type });
4040
return this;
4141
}
4242

src/dnsimple/Services/ZoneRecords.cs

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -125,34 +125,6 @@ public SimpleResponse<ZoneDistribution> CheckRecordDistribution( long accountId,
125125
}
126126
}
127127

128-
/// <summary>
129-
/// Represents a zone record type.
130-
/// </summary>
131-
public enum ZoneRecordType
132-
{
133-
A,
134-
AAAA,
135-
ALIAS,
136-
CAA,
137-
CDNSKEY,
138-
CDS,
139-
CNAME,
140-
DNSKEY,
141-
DS,
142-
HINFO,
143-
MX,
144-
NAPTR,
145-
NS,
146-
POOL,
147-
PTR,
148-
SOA,
149-
SPF,
150-
SRV,
151-
SSHFP,
152-
TXT,
153-
URL
154-
}
155-
156128
/// <summary>
157129
/// Represents a Region.
158130
///
@@ -185,7 +157,7 @@ public struct ZoneRecord
185157
public string Content { get; set; }
186158
public long Ttl { get; set; }
187159
public long? Priority { get; set; }
188-
public ZoneRecordType Type { get; set; }
160+
public string Type { get; set; }
189161
public List<string> Regions { get; set; }
190162
public bool SystemRecord { get; set; }
191163
public DateTime CreatedAt { get; set; }
@@ -211,7 +183,7 @@ internal class ZoneRecordToSend
211183
internal ZoneRecordToSend(ZoneRecord record)
212184
{
213185
Name = record.Name;
214-
Type = record.Type.ToString();
186+
Type = record.Type;
215187
Content = record.Content;
216188
Ttl = record.Ttl;
217189
Priority = record.Priority;

0 commit comments

Comments
 (0)