-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: swift package setup and OSRM models
- Loading branch information
Showing
21 changed files
with
1,698 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// swift-tools-version: 5.9 | ||
// The swift-tools-version declares the minimum version of Swift required to build this package. | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "OSRM", | ||
platforms: [ | ||
.iOS(.v13) | ||
], | ||
products: [ | ||
.library( | ||
name: "OSRM", | ||
targets: ["OSRM"] | ||
) | ||
], | ||
targets: [ | ||
.target( | ||
name: "OSRM", | ||
dependencies: [ | ||
"AnyCodable" | ||
] | ||
) | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,15 @@ | ||
# osrm-openapi | ||
OpenAPI spec for generating OSRM Models | ||
# OSRM OpenAPI | ||
|
||
OpenAPI spec and generation script to build OSRM Models for various platforms. | ||
|
||
## Building OSRM Models | ||
|
||
```sh | ||
./generate_models.sh swift | ||
``` | ||
|
||
* `--clean` delete the .build and generated folder. | ||
|
||
## References | ||
|
||
- OSRM Open API Initial Source - <https://github.com/1papaya/osrm-openapi> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// | ||
// Annotation.swift | ||
// | ||
// Generated by openapi-generator | ||
// https://openapi-generator.tech | ||
// | ||
|
||
import Foundation | ||
#if canImport(AnyCodable) | ||
import AnyCodable | ||
#endif | ||
|
||
public struct Annotation: Codable, Hashable { | ||
/** The distance, in metres, between each pair of coordinates */ | ||
public var distance: [Double]? | ||
/** The duration between each pair of coordinates, in seconds */ | ||
public var duration: [Double]? | ||
public var datasources: [Int]? | ||
public var nodes: [Int]? | ||
public var weight: [Int]? | ||
public var speed: [Double]? | ||
public var metadata: AnnotationMetadata? | ||
|
||
public init(distance: [Double]? = nil, duration: [Double]? = nil, datasources: [Int]? = nil, nodes: [Int]? = nil, weight: [Int]? = nil, speed: [Double]? = nil, metadata: AnnotationMetadata? = nil) { | ||
self.distance = distance | ||
self.duration = duration | ||
self.datasources = datasources | ||
self.nodes = nodes | ||
self.weight = weight | ||
self.speed = speed | ||
self.metadata = metadata | ||
} | ||
|
||
public enum CodingKeys: String, CodingKey, CaseIterable { | ||
case distance | ||
case duration | ||
case datasources | ||
case nodes | ||
case weight | ||
case speed | ||
case metadata | ||
} | ||
|
||
// Encodable protocol methods | ||
|
||
public func encode(to encoder: Encoder) throws { | ||
var container = encoder.container(keyedBy: CodingKeys.self) | ||
try container.encodeIfPresent(distance, forKey: .distance) | ||
try container.encodeIfPresent(duration, forKey: .duration) | ||
try container.encodeIfPresent(datasources, forKey: .datasources) | ||
try container.encodeIfPresent(nodes, forKey: .nodes) | ||
try container.encodeIfPresent(weight, forKey: .weight) | ||
try container.encodeIfPresent(speed, forKey: .speed) | ||
try container.encodeIfPresent(metadata, forKey: .metadata) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// AnnotationMetadata.swift | ||
// | ||
// Generated by openapi-generator | ||
// https://openapi-generator.tech | ||
// | ||
|
||
import Foundation | ||
#if canImport(AnyCodable) | ||
import AnyCodable | ||
#endif | ||
|
||
public struct AnnotationMetadata: Codable, Hashable { | ||
public var datasourceNames: [String]? | ||
|
||
public init(datasourceNames: [String]? = nil) { | ||
self.datasourceNames = datasourceNames | ||
} | ||
|
||
public enum CodingKeys: String, CodingKey, CaseIterable { | ||
case datasourceNames = "datasource_names" | ||
} | ||
|
||
// Encodable protocol methods | ||
|
||
public func encode(to encoder: Encoder) throws { | ||
var container = encoder.container(keyedBy: CodingKeys.self) | ||
try container.encodeIfPresent(datasourceNames, forKey: .datasourceNames) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// | ||
// ApiResponse.swift | ||
// | ||
// Generated by openapi-generator | ||
// https://openapi-generator.tech | ||
// | ||
|
||
import Foundation | ||
#if canImport(AnyCodable) | ||
import AnyCodable | ||
#endif | ||
|
||
public struct ApiResponse: Codable, Hashable { | ||
public enum Code: String, Codable, CaseIterable { | ||
case ok = "Ok" | ||
case invalidUrl = "InvalidUrl" | ||
case invalidService = "InvalidService" | ||
case invalidVersion = "InvalidVersion" | ||
case invalidOptions = "InvalidOptions" | ||
case invalidQuery = "InvalidQuery" | ||
case invalidValue = "InvalidValue" | ||
case noSegment = "NoSegment" | ||
case tooBig = "TooBig" | ||
case noRoute = "NoRoute" | ||
case noTable = "NoTable" | ||
case notImplemented = "NotImplemented" | ||
case noTrips = "NoTrips" | ||
} | ||
|
||
public var code: Code | ||
public var message: String? | ||
public var dataVersion: Date? | ||
|
||
public init(code: Code, message: String? = nil, dataVersion: Date? = nil) { | ||
self.code = code | ||
self.message = message | ||
self.dataVersion = dataVersion | ||
} | ||
|
||
public enum CodingKeys: String, CodingKey, CaseIterable { | ||
case code | ||
case message | ||
case dataVersion = "data_version" | ||
} | ||
|
||
// Encodable protocol methods | ||
|
||
public func encode(to encoder: Encoder) throws { | ||
var container = encoder.container(keyedBy: CodingKeys.self) | ||
try container.encode(code, forKey: .code) | ||
try container.encodeIfPresent(message, forKey: .message) | ||
try container.encodeIfPresent(dataVersion, forKey: .dataVersion) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// | ||
// Intersection.swift | ||
// | ||
// Generated by openapi-generator | ||
// https://openapi-generator.tech | ||
// | ||
|
||
import Foundation | ||
#if canImport(AnyCodable) | ||
import AnyCodable | ||
#endif | ||
|
||
public struct Intersection: Codable, Hashable { | ||
public var location: [Double]? | ||
public var bearings: [Int]? | ||
public var classes: [String]? | ||
public var entry: [Bool]? | ||
public var _in: Int? | ||
public var out: Int? | ||
public var lanes: [Lane]? | ||
|
||
public init(location: [Double]? = nil, bearings: [Int]? = nil, classes: [String]? = nil, entry: [Bool]? = nil, _in: Int? = nil, out: Int? = nil, lanes: [Lane]? = nil) { | ||
self.location = location | ||
self.bearings = bearings | ||
self.classes = classes | ||
self.entry = entry | ||
self._in = _in | ||
self.out = out | ||
self.lanes = lanes | ||
} | ||
|
||
public enum CodingKeys: String, CodingKey, CaseIterable { | ||
case location | ||
case bearings | ||
case classes | ||
case entry | ||
case _in = "in" | ||
case out | ||
case lanes | ||
} | ||
|
||
// Encodable protocol methods | ||
|
||
public func encode(to encoder: Encoder) throws { | ||
var container = encoder.container(keyedBy: CodingKeys.self) | ||
try container.encodeIfPresent(location, forKey: .location) | ||
try container.encodeIfPresent(bearings, forKey: .bearings) | ||
try container.encodeIfPresent(classes, forKey: .classes) | ||
try container.encodeIfPresent(entry, forKey: .entry) | ||
try container.encodeIfPresent(_in, forKey: ._in) | ||
try container.encodeIfPresent(out, forKey: .out) | ||
try container.encodeIfPresent(lanes, forKey: .lanes) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// Lane.swift | ||
// | ||
// Generated by openapi-generator | ||
// https://openapi-generator.tech | ||
// | ||
|
||
import Foundation | ||
#if canImport(AnyCodable) | ||
import AnyCodable | ||
#endif | ||
|
||
public struct Lane: Codable, Hashable { | ||
public var indications: [String]? | ||
public var valid: Bool? | ||
|
||
public init(indications: [String]? = nil, valid: Bool? = nil) { | ||
self.indications = indications | ||
self.valid = valid | ||
} | ||
|
||
public enum CodingKeys: String, CodingKey, CaseIterable { | ||
case indications | ||
case valid | ||
} | ||
|
||
// Encodable protocol methods | ||
|
||
public func encode(to encoder: Encoder) throws { | ||
var container = encoder.container(keyedBy: CodingKeys.self) | ||
try container.encodeIfPresent(indications, forKey: .indications) | ||
try container.encodeIfPresent(valid, forKey: .valid) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// | ||
// NearestResponse.swift | ||
// | ||
// Generated by openapi-generator | ||
// https://openapi-generator.tech | ||
// | ||
|
||
import Foundation | ||
#if canImport(AnyCodable) | ||
import AnyCodable | ||
#endif | ||
|
||
public struct NearestResponse: Codable, Hashable { | ||
public enum Code: String, Codable, CaseIterable { | ||
case ok = "Ok" | ||
case invalidUrl = "InvalidUrl" | ||
case invalidService = "InvalidService" | ||
case invalidVersion = "InvalidVersion" | ||
case invalidOptions = "InvalidOptions" | ||
case invalidQuery = "InvalidQuery" | ||
case invalidValue = "InvalidValue" | ||
case noSegment = "NoSegment" | ||
case tooBig = "TooBig" | ||
case noRoute = "NoRoute" | ||
case noTable = "NoTable" | ||
case notImplemented = "NotImplemented" | ||
case noTrips = "NoTrips" | ||
} | ||
|
||
public var code: Code | ||
public var message: String? | ||
public var dataVersion: Date? | ||
public var waypoints: [NearestWaypoint]? | ||
|
||
public init(code: Code, message: String? = nil, dataVersion: Date? = nil, waypoints: [NearestWaypoint]? = nil) { | ||
self.code = code | ||
self.message = message | ||
self.dataVersion = dataVersion | ||
self.waypoints = waypoints | ||
} | ||
|
||
public enum CodingKeys: String, CodingKey, CaseIterable { | ||
case code | ||
case message | ||
case dataVersion = "data_version" | ||
case waypoints | ||
} | ||
|
||
// Encodable protocol methods | ||
|
||
public func encode(to encoder: Encoder) throws { | ||
var container = encoder.container(keyedBy: CodingKeys.self) | ||
try container.encode(code, forKey: .code) | ||
try container.encodeIfPresent(message, forKey: .message) | ||
try container.encodeIfPresent(dataVersion, forKey: .dataVersion) | ||
try container.encodeIfPresent(waypoints, forKey: .waypoints) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// | ||
// NearestWaypoint.swift | ||
// | ||
// Generated by openapi-generator | ||
// https://openapi-generator.tech | ||
// | ||
|
||
import Foundation | ||
#if canImport(AnyCodable) | ||
import AnyCodable | ||
#endif | ||
|
||
public struct NearestWaypoint: Codable, Hashable { | ||
public var name: String? | ||
public var location: [Double]? | ||
public var distance: Double? | ||
public var hint: String? | ||
public var nodes: [Int]? | ||
|
||
public init(name: String? = nil, location: [Double]? = nil, distance: Double? = nil, hint: String? = nil, nodes: [Int]? = nil) { | ||
self.name = name | ||
self.location = location | ||
self.distance = distance | ||
self.hint = hint | ||
self.nodes = nodes | ||
} | ||
|
||
public enum CodingKeys: String, CodingKey, CaseIterable { | ||
case name | ||
case location | ||
case distance | ||
case hint | ||
case nodes | ||
} | ||
|
||
// Encodable protocol methods | ||
|
||
public func encode(to encoder: Encoder) throws { | ||
var container = encoder.container(keyedBy: CodingKeys.self) | ||
try container.encodeIfPresent(name, forKey: .name) | ||
try container.encodeIfPresent(location, forKey: .location) | ||
try container.encodeIfPresent(distance, forKey: .distance) | ||
try container.encodeIfPresent(hint, forKey: .hint) | ||
try container.encodeIfPresent(nodes, forKey: .nodes) | ||
} | ||
} |
Oops, something went wrong.