Skip to content

PathParameter

Josh Wright edited this page Jan 14, 2021 · 3 revisions

PathParameter

Represents a dynamic parameter inside the URL. Parameter placeholders should be prefaced with a colon (:​) in the route string. Something like :​user_id in the path /v1/users/:​user_id.

public struct PathParameter: Equatable

Inheritance

Equatable

Properties

parameter

The escaped parameter that was matched, without the colon. Something like user_id if :​user_id was in the path.

let parameter: String

stringValue

The actual string value of the parameter.

let stringValue: String

Methods

uuid()

Decodes a UUID from this parameter's value or throws if the string is an invalid UUID.

public func uuid() throws -> UUID

Throws

A PathParameter.DecodingError if the value string is not convertible to a UUID.

Returns

The decoded UUID.

string()

Returns the String value of this parameter.

public func string() -> String

Returns

the value of this parameter.

int()

Decodes an Int from this parameter's value or throws if the string can't be converted to an Int.

public func int() throws -> Int

Throws

a PathParameter.DecodingError if the value string is not convertible to a Int.

Returns

the decoded Int.

Alchemy
Types
Protocols
Global Typealiases
Global Variables
Global Functions
Fusion
Types
Protocols
Papyrus
Types
Protocols
Clone this wiki locally