Request

public protocol Request

JSON-RPC 2.0 request type.

Implementers should provide Decodable response types, example:

struct MyResponse: Decodable {
    let hello: String
    let foo: Int
}
struct MyRequest: Steem.Request {
    typealias Response = MyResponse
    let method = "my_method"
    let params: RequestParams<String>
    init(name: String) {
        self.params = RequestParams(["hello": name])
    }
}
  • Response type.

    Declaration

    Swift

    associatedtype Response : Decodable
  • Request parameter type.

    Declaration

    Swift

    associatedtype Params : Encodable
  • JSON-RPC 2.0 method to call.

    Declaration

    Swift

    var method: String { get }
  • params Default implementation

    JSON-RPC 2.0 parameters

    Default Implementation

    Declaration

    Swift

    var params: Params? { get }