Javier Cicchelli 6da2e946ce [Libraries] Locations (#4)
This PR contains the work that implements the Locations service, which is used to retrieve location data from a remote server.

To give further details on what was done:
- [x] created the `APICore` and `Locations` libraries into the **Libraries** package;
- [x] defined the `Endpoint` and `Client` protocols;
- [x] implemented the `MakeURLRequestUseCase` use case;
- [x] implemented the `MockURLProtocol` protocol and the `MockURLResponse` models;
- [x] implemented the `Location` model;
- [x] implemented the `GetLocationsEndpoint` endpoint;
- [x] implemented the `LocationsClient` client;
- [x] implemented the `LocationsService` service.

Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Reviewed-on: rock-n-code/deep-linking-assignment#4
2023-04-10 15:31:22 +00:00

40 lines
744 B
Swift

//
// Location.swift
// Locations (Library)
//
// Created by Javier Cicchelli on 10/04/2023.
// Copyright © 2023 Röck+Cöde. All rights reserved.
//
public struct Location: Equatable {
// MARK: Properties
public let name: String?
public let latitude: Float
public let longitude: Float
// MARK: Initialisers
public init(
name: String? = nil,
latitude: Float,
longitude: Float
) {
self.name = name
self.latitude = latitude
self.longitude = longitude
}
}
// MARK: - Decodable
extension Location: Decodable {
enum CodingKeys: String, CodingKey {
case name
case latitude = "lat"
case longitude = "long"
}
}