Skip to content

Commit

Permalink
Defined location lookup API models.
Browse files Browse the repository at this point in the history
  • Loading branch information
tacosontitan committed Jul 31, 2024
1 parent a03b6f3 commit 25f852a
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/Weatherstack/Locations/LocationLookupEndpoint.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (c) 2024 tacosontitan
// This file is part of the Weatherstack project, which is distributed under the MIT license.
// See LICENSE for more information.

using System.Net.Http;

using Weatherstack.Net;

namespace Weatherstack.Locations;

/// <summary>
/// Defines the
/// <see href="https://weatherstack.com/documentation#location_lookup">
/// location lookup
/// </see>
/// endpoint for the Weatherstack API.
/// </summary>
internal sealed class LocationLookupEndpoint()

Check failure on line 18 in src/Weatherstack/Locations/LocationLookupEndpoint.cs

View workflow job for this annotation

GitHub Actions / build

'LocationLookupEndpoint' is an internal class that is apparently never instantiated. If so, remove the code from the assembly. If this class is intended to contain only static members, make it 'static' (Module in Visual Basic). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1812)

Check failure on line 18 in src/Weatherstack/Locations/LocationLookupEndpoint.cs

View workflow job for this annotation

GitHub Actions / build

'LocationLookupEndpoint' is an internal class that is apparently never instantiated. If so, remove the code from the assembly. If this class is intended to contain only static members, make it 'static' (Module in Visual Basic). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1812)

Check failure on line 18 in src/Weatherstack/Locations/LocationLookupEndpoint.cs

View workflow job for this annotation

GitHub Actions / build

'LocationLookupEndpoint' is an internal class that is apparently never instantiated. If so, remove the code from the assembly. If this class is intended to contain only static members, make it 'static' (Module in Visual Basic). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1812)

Check failure on line 18 in src/Weatherstack/Locations/LocationLookupEndpoint.cs

View workflow job for this annotation

GitHub Actions / build

'LocationLookupEndpoint' is an internal class that is apparently never instantiated. If so, remove the code from the assembly. If this class is intended to contain only static members, make it 'static' (Module in Visual Basic). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1812)

Check failure on line 18 in src/Weatherstack/Locations/LocationLookupEndpoint.cs

View workflow job for this annotation

GitHub Actions / build

'LocationLookupEndpoint' is an internal class that is apparently never instantiated. If so, remove the code from the assembly. If this class is intended to contain only static members, make it 'static' (Module in Visual Basic). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1812)

Check failure on line 18 in src/Weatherstack/Locations/LocationLookupEndpoint.cs

View workflow job for this annotation

GitHub Actions / build

'LocationLookupEndpoint' is an internal class that is apparently never instantiated. If so, remove the code from the assembly. If this class is intended to contain only static members, make it 'static' (Module in Visual Basic). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1812)
: ApiEndpoint(
method: HttpMethod.Get,
url: "https://api.weatherstack.com/autocomplete");
22 changes: 22 additions & 0 deletions src/Weatherstack/Locations/LocationLookupRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) 2024 tacosontitan
// This file is part of the Weatherstack project, which is distributed under the MIT license.
// See LICENSE for more information.

using System.Text.Json.Serialization;

using Weatherstack.Net;

namespace Weatherstack.Locations;

/// <summary>
/// Represents a location lookup request within the Weatherstack API.
/// </summary>
public sealed class LocationLookupRequest
: ApiRequest
{
/// <summary>
/// Gets or sets number of results returned.
/// </summary>
[JsonPropertyName("results")]
public int? ResultCount { get; set; }
}
27 changes: 27 additions & 0 deletions src/Weatherstack/Locations/LocationLookupResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright (c) 2024 tacosontitan
// This file is part of the Weatherstack project, which is distributed under the MIT license.
// See LICENSE for more information.

using System.Collections.ObjectModel;
using System.Text.Json.Serialization;

using Weatherstack.Net;

namespace Weatherstack.Locations;

/// <summary>
/// Represents the response to be received from the
/// <see href="https://weatherstack.com/documentation#location_lookup">
/// location lookup
/// </see>
/// endpoint of the Weatherstack API.
/// </summary>
public sealed class LocationLookupResponse
: ApiResponse<LocationLookupRequest>
{
/// <summary>
/// Gets or sets the locations returned by the request.
/// </summary>
[JsonPropertyName("locations")]
public ReadOnlyCollection<Location>? Locations { get; set; }
}

0 comments on commit 25f852a

Please sign in to comment.