RoutesView

public class RoutesView : APIView

Undocumented

Browsing routes

  • Perform a search for routes matching the given parameters.

    Declaration

    Swift

    @discardableResult
    public func search(_ parameters: SearchInput<UserRouteSearch>, offset: Int, count: Int, completion: @escaping Zone5.ResultHandler<SearchResult<UserRoute>>) -> PendingRequest?

    Parameters

    parameters

    The criteria to use when performing the search.

    offset

    The pagination offset for the retrieved set of UserRoute values.

    count

    The number of UserRoute values to retrieve.

    completion

    Function called with the UserRoute results matching the given criteria, or the error if one occurred.

  • Get the next paginated set from the previous search.

    Declaration

    Swift

    @discardableResult
    public func next(offset: Int, count: Int, completion: @escaping Zone5.ResultHandler<SearchResult<UserRoute>>) -> PendingRequest?

    Parameters

    offset

    The pagination offset for the retrieved set of UserRoute values.

    count

    The number of UserRoute values to retrieve.

    completion

    Function called with the UserRoute results matching the given criteria, or the error if one occurred.

  • Get a summary view of a route (just route meta-data, does not include raw points)

    Declaration

    Swift

    @discardableResult
    public func summaryView(of identifier: UserRouteServerIdentifier, completion: @escaping Zone5.ResultHandler<UserRoute>) -> PendingRequest?

    Parameters

    routeID

    The identifier for the route, either the route’s id or uuid.

    completion

    Function called with the UserRoute summary, or the error if one occurred.

  • Get a detailed view of a route (just route meta-data, does not include raw points)

    Declaration

    Swift

    @discardableResult
    public func detailedView(of identifier: UserRouteServerIdentifier, completion: @escaping Zone5.ResultHandler<UserRoute>) -> PendingRequest?

    Parameters

    routeID

    The identifier for the route, either the route’s id or uuid.

    completion

    Function called with the detailed UserRoute value, or the error if one occurred.

Downloading files

  • Download a PNG map image of the route.

    Note

    The cached file is deleted upon return of the completion handler, and so the file should be copied to an alternate location before performing any asynchronous tasks, or before returning from the closure.

    Declaration

    Swift

    @discardableResult
    public func downloadPNG(for identifier: UserRouteServerIdentifier, completion: @escaping Zone5.ResultHandler<URL>) -> PendingRequest?

    Parameters

    routeID

    The identifier for the route to be downloaded, either the route’s id or uuid.

    completion

    Function called with the location of the downloaded file on disk, or the error if one occurred.

  • Download a FIT version of the route. The resulting file includes all data points (location, elevation, elapsed distance etc), directions (if any), and course point markers.

    Note

    The cached file is deleted upon return of the completion handler, and so the file should be copied to an alternate location before performing any asynchronous tasks, or before returning from the closure.

    Declaration

    Swift

    @discardableResult
    public func downloadFIT(for identifier: UserRouteServerIdentifier, completion: @escaping Zone5.ResultHandler<URL>) -> PendingRequest?

    Parameters

    routeID

    The identifier for the route to be downloaded, either the route’s id or uuid.

    completion

    Function called with the location of the downloaded file on disk, or the error if one occurred.

  • Download a GPX version of the route.

    Note

    The cached file is deleted upon return of the completion handler, and so the file should be copied to an alternate location before performing any asynchronous tasks, or before returning from the closure.

    Declaration

    Swift

    @discardableResult
    public func downloadGPX(for identifier: UserRouteServerIdentifier, completion: @escaping Zone5.ResultHandler<URL>) -> PendingRequest?

    Parameters

    routeUUID

    The identifier for the route to be downloaded, either the route’s id or uuid.

    completion

    Function called with the location of the downloaded file on disk, or the error if one occurred.

  • Download a Stages Dash1 SRO Route file.

    Note

    The cached file is deleted upon return of the completion handler, and so the file should be copied to an alternate location before performing any asynchronous tasks, or before returning from the closure.

    Declaration

    Swift

    @discardableResult
    public func downloadStagesSRO(for routeID: Int64, completion: @escaping Zone5.ResultHandler<URL>) -> PendingRequest?

    Parameters

    routeID

    The identifier for the route to be downloaded.

    completion

    Function called with the location of the downloaded file on disk, or the error if one occurred.

  • Download a Stages Dash2 Route FIT file.

    Note

    The cached file is deleted upon return of the completion handler, and so the file should be copied to an alternate location before performing any asynchronous tasks, or before returning from the closure.

    Declaration

    Swift

    @discardableResult
    public func downloadStagesFIT(for routeID: Int64, completion: @escaping Zone5.ResultHandler<URL>) -> PendingRequest?

    Parameters

    routeID

    The identifier for the route to be downloaded.

    completion

    Function called with the location of the downloaded file on disk, or the error if one occurred.

Modifying routes

  • Create a new route from the given JSON file. The JSON file should follow the expected structure, e.g.:

    {
      "course_points": [
          // lat, lng, elapsed distance (m), fit course point type (ordinal), text
          [-420945877, 1778923344, 4572, 0, "Head northeast on Lady Denman Dr<br>Walk your bicycle"],
          ...
      ],
      "records": [
          // lat, lng, elapsed distance (m), altitude (m), grade (%)
          [-420751495, 1779320598, 0, 0, 0],
          ...
      ]
    }
    

    Declaration

    Swift

    @discardableResult
    public func createRoute(fromJSON fileURL: URL, metadata: UserRoute, completion: @escaping Zone5.ResultHandler<UserRoute>) -> PendingRequest?

    Parameters

    fileURL

    The URL for a JSON-formatted route file.

    metadata

    The metadata for the created route.

    completion

    Function called with the created route, or the error if one occurred.

  • Create a new route from the given FIT file.

    Declaration

    Swift

    @discardableResult
    public func createRoute(fromFIT fileURL: URL, metadata: UserRoute, completion: @escaping Zone5.ResultHandler<UserRoute>) -> PendingRequest?

    Parameters

    fileURL

    The URL for a FIT-based route file.

    metadata

    The metadata for the created route.

    completion

    Function called with the created route, or the error if one occurred.

  • Create a new route from an existing activity matching the given fileID.

    Note

    Actual conversation occurs asynchronously. The route will be available once it has been processed.

    Declaration

    Swift

    @discardableResult
    public func createRoute(fromActivity fileID: Int64, completion: @escaping Zone5.ResultHandler<UserRoute>) -> PendingRequest?

    Parameters

    routeID

    The fileID for the activity to be cloned.

    completion

    Function called with the created route, or the error if one occurred.

  • Create a new route from an existing route matching the given routeID.

    Note

    Actual conversation occurs asynchronously. The route will be available once it has been processed.

    Declaration

    Swift

    @discardableResult
    public func createRoute(fromRoute routeID: Int64, completion: @escaping Zone5.ResultHandler<UserRoute>) -> PendingRequest?

    Parameters

    routeID

    The identifier for the route to be cloned.

    completion

    Function called with the created route, or the error if one occurred.

  • Update a route from the given JSON file. The JSON file should follow the expected structure, e.g.:

    {
      "course_points": [
          // lat, lng, elapsed distance (m), fit course point type (ordinal), text
          [-420945877, 1778923344, 4572, 0, "Head northeast on Lady Denman Dr<br>Walk your bicycle"],
          ...
      ],
      "records": [
          // lat, lng, elapsed distance (m), altitude (m), grade (%)
          [-420751495, 1779320598, 0, 0, 0],
          ...
      ]
    }
    

    Declaration

    Swift

    @discardableResult
    public func updateRoute(with routeID: Int64, fromJSON fileURL: URL, metadata: UserRoute, completion: @escaping Zone5.ResultHandler<UserRoute>) -> PendingRequest?

    Parameters

    routeID

    The identifier for the route to be updated.

    fileURL

    The URL for a JSON-formatted route file for updating the route.

    metadata

    The updated metadata for the route.

    completion

    Function called with the updated route, or the error if one occurred.

  • Update a route from the given FIT file.

    Declaration

    Swift

    @discardableResult
    public func updateRoute(with routeID: Int64, fromFIT fileURL: URL, metadata: UserRoute, completion: @escaping Zone5.ResultHandler<UserRoute>) -> PendingRequest?

    Parameters

    routeID

    The identifier for the route to be updated.

    fileURL

    The URL for a FIT-based route file for updating the route.

    metadata

    The updated metadata for the route.

    completion

    Function called with the updated route, or the error if one occurred.

  • Update the meta-data of this route, i.e. set equipment, terrain, name, description, tags, etc. Partial/shallow updates are supported.

    Declaration

    Swift

    @discardableResult
    public func updateMetadata(for routeID: Int64, metadata: UserRoute, completion: @escaping Zone5.ResultHandler<Bool>) -> PendingRequest?

    Parameters

    routeID

    The identifier for the route to be updated.

    metadata

    The updated metadata for the route.

    completion

    Function called with the updated route, or the error if one occurred.

  • Delete a route.

    Declaration

    Swift

    @discardableResult
    public func delete(routeID: Int64, completion: @escaping Zone5.ResultHandler<Bool>) -> PendingRequest?

    Parameters

    routeID

    The identifier for the route to be deleted.

    completion

    Function called with the result of the deletion attempt, or the error if one occurred.