Skip to content

Commit 245cc0d

Browse files
Make APIRequestParameterType internal.
This types uses to encode all given attributes to heterogeneous array, so it should not be public.
1 parent 5db2272 commit 245cc0d

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

Sources/web3swift/API/Web3+APIRequestParameter.swift

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,15 @@
77

88
import Foundation
99

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.
1311
///
1412
/// 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.
1614
///
1715
/// Conformance of that protocol by a custom type will be silently failed to encode (e.g. there won't be in request).
1816
///
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 { }
2119

2220
protocol APIRequestParameterElementType: Encodable { }
2321

@@ -75,7 +73,7 @@ extension Bool: APIRequestParameterElementType { }
7573
//> [12,\"this\",12.2,[12.2,12.4]]`
7674
```
7775
*/
78-
public enum RequestParameter {
76+
enum RequestParameter {
7977
case int(Int)
8078
case intArray([Int])
8179

@@ -105,7 +103,7 @@ extension RequestParameter: RawRepresentable {
105103

106104
You're totally free to use explicit and more convenience member init as `RequestParameter.int(12)` in your code.
107105
*/
108-
public init?(rawValue: APIRequestParameterType) {
106+
init?(rawValue: APIRequestParameterType) {
109107
/// force casting in this switch is safe because
110108
/// each `rawValue` forced to casts only in exact case which is runs based on `rawValues` type
111109
// swiftlint:disable force_cast
@@ -133,7 +131,7 @@ extension RequestParameter: RawRepresentable {
133131
}
134132

135133
/// Returning associated value of the enum case.
136-
public var rawValue: APIRequestParameterType {
134+
var rawValue: APIRequestParameterType {
137135
// cases can't be merged, coz it cause compiler error since it couldn't predict what exact type on exact case will be returned.
138136
switch self {
139137
case let .int(value): return value
@@ -175,7 +173,7 @@ extension RequestParameter: Encodable {
175173
//> [12,\"this\",12.2,[12.2,12.4]]`
176174
```
177175
*/
178-
public func encode(to encoder: Encoder) throws {
176+
func encode(to encoder: Encoder) throws {
179177
var enumContainer = encoder.singleValueContainer()
180178
/// force casting in this switch is safe because
181179
/// each `rawValue` forced to casts only in exact case which is runs based on `rawValue` type

0 commit comments

Comments
 (0)