Skip to content

Commit

Permalink
feat: add GetDnsRecordAsync method to CloudflareService
Browse files Browse the repository at this point in the history
  • Loading branch information
alperensert committed Apr 8, 2024
1 parent 6d355bc commit 37bff3c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/CloudflareDnsync.Services/CloudflareService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ public Task<CloudflareResponse<List<DnsRecord>>> GetDnsRecordsAsync(
$"zones/{zoneId}/dns_records?page={page}&per_page={perPage}&type=A",
cancellationToken: cancellationToken);

public Task<CloudflareResponse<DnsRecord>> GetDnsRecordAsync(
string zoneId,
string recordId,
CancellationToken cancellationToken = default)
=> SendAsync<CloudflareResponse<DnsRecord>>(
HttpMethod.Get,
$"zones/{zoneId}/dns_records/{recordId}",
cancellationToken: cancellationToken);

public Task<CloudflareResponse<DnsRecord>> UpdateDnsRecordAsync(
string zoneId,
string recordId,
Expand Down
15 changes: 15 additions & 0 deletions src/CloudflareDnsync.Services/ICloudflareService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,21 @@ Task<CloudflareResponse<List<DnsRecord>>> GetDnsRecordsAsync(
int perPage = 20,
CancellationToken cancellationToken = default);

/// <summary>
/// Retrieves a DNS record for a zone from Cloudflare.
/// </summary>
/// <param name="zoneId">The ID of the dns record's zone.</param>
/// <param name="recordId">The ID of the dns record.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>
/// A task that represents the asynchronous operation.
/// The task result contains the Cloudflare response containing the DNS record.
/// </returns>
Task<CloudflareResponse<DnsRecord>> GetDnsRecordAsync(
string zoneId,
string recordId,
CancellationToken cancellationToken = default);

/// <summary>
/// Updates a DNS record for a zone in Cloudflare.
/// </summary>
Expand Down

0 comments on commit 37bff3c

Please sign in to comment.