|
7 | 7 |
|
8 | 8 | import Foundation
|
9 | 9 |
|
10 |
| -/// Protocol to restrict supported types which can be passed into `JSONRPCRequest` to a node. |
11 |
| -/// |
12 |
| -/// You **must not** conform any type to that protocol. |
| 10 | +/// Protocol to restrict supported types which can be passed into `RequestParameter` to a node. |
13 | 11 | ///
|
14 | 12 | /// Due to internal logic and swift itself restrictions, there's lack of encoding generic types
|
15 |
| -/// so current implementation of `JSONRPCParameter`s belongs on hardcoded supported types. |
| 13 | +/// so current implementation of `RequestParameter`s belongs on hardcoded supported types. |
16 | 14 | ///
|
17 | 15 | /// Conformance of that protocol by a custom type will be silently failed to encode (e.g. there won't be in request).
|
18 | 16 | ///
|
19 |
| -/// Please see `RPCParameter` documentation for more details. |
20 |
| -public protocol APIRequestParameterType: Encodable { } |
| 17 | +/// Please see `RequestParameter` documentation for more details. |
| 18 | +protocol APIRequestParameterType: Encodable { } |
21 | 19 |
|
22 | 20 | protocol APIRequestParameterElementType: Encodable { }
|
23 | 21 |
|
@@ -75,7 +73,7 @@ extension Bool: APIRequestParameterElementType { }
|
75 | 73 | //> [12,\"this\",12.2,[12.2,12.4]]`
|
76 | 74 | ```
|
77 | 75 | */
|
78 |
| -public enum RequestParameter { |
| 76 | +enum RequestParameter { |
79 | 77 | case int(Int)
|
80 | 78 | case intArray([Int])
|
81 | 79 |
|
@@ -105,7 +103,7 @@ extension RequestParameter: RawRepresentable {
|
105 | 103 |
|
106 | 104 | You're totally free to use explicit and more convenience member init as `RequestParameter.int(12)` in your code.
|
107 | 105 | */
|
108 |
| - public init?(rawValue: APIRequestParameterType) { |
| 106 | + init?(rawValue: APIRequestParameterType) { |
109 | 107 | /// force casting in this switch is safe because
|
110 | 108 | /// each `rawValue` forced to casts only in exact case which is runs based on `rawValues` type
|
111 | 109 | // swiftlint:disable force_cast
|
@@ -133,7 +131,7 @@ extension RequestParameter: RawRepresentable {
|
133 | 131 | }
|
134 | 132 |
|
135 | 133 | /// Returning associated value of the enum case.
|
136 |
| - public var rawValue: APIRequestParameterType { |
| 134 | + var rawValue: APIRequestParameterType { |
137 | 135 | // cases can't be merged, coz it cause compiler error since it couldn't predict what exact type on exact case will be returned.
|
138 | 136 | switch self {
|
139 | 137 | case let .int(value): return value
|
@@ -175,7 +173,7 @@ extension RequestParameter: Encodable {
|
175 | 173 | //> [12,\"this\",12.2,[12.2,12.4]]`
|
176 | 174 | ```
|
177 | 175 | */
|
178 |
| - public func encode(to encoder: Encoder) throws { |
| 176 | + func encode(to encoder: Encoder) throws { |
179 | 177 | var enumContainer = encoder.singleValueContainer()
|
180 | 178 | /// force casting in this switch is safe because
|
181 | 179 | /// each `rawValue` forced to casts only in exact case which is runs based on `rawValue` type
|
|
0 commit comments