[swift5][client] fix non public visibility modifier for NullEncodable (#11903)

* [swift5][client] fix non public visibility modifier for NullEncodable

* [swift5][client] fix non public visibility modifier for NullEncodable
This commit is contained in:
Bruno Coelho 2022-03-18 01:58:52 +00:00 committed by GitHub
parent 3b7ea5ca53
commit 8e68ff71c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -35,14 +35,14 @@ extension CaseIterableDefaultsLast {
/// A flexible type that can be encoded (`.encodeNull` or `.encodeValue`)
/// or not encoded (`.encodeNothing`). Intended for request payloads.
public enum NullEncodable<Wrapped: Hashable>: Hashable {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum NullEncodable<Wrapped: Hashable>: Hashable {
case encodeNothing
case encodeNull
case encodeValue(Wrapped)
}
extension NullEncodable: Codable where Wrapped: Codable {
public init(from decoder: Decoder) throws {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()
if let value = try? container.decode(Wrapped.self) {
self = .encodeValue(value)
@ -53,7 +53,7 @@ extension NullEncodable: Codable where Wrapped: Codable {
}
}
public func encode(to encoder: Encoder) throws {
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
switch self {
case .encodeNothing: return

View File

@ -34,14 +34,14 @@ extension CaseIterableDefaultsLast {
/// A flexible type that can be encoded (`.encodeNull` or `.encodeValue`)
/// or not encoded (`.encodeNothing`). Intended for request payloads.
public enum NullEncodable<Wrapped: Hashable>: Hashable {
internal enum NullEncodable<Wrapped: Hashable>: Hashable {
case encodeNothing
case encodeNull
case encodeValue(Wrapped)
}
extension NullEncodable: Codable where Wrapped: Codable {
public init(from decoder: Decoder) throws {
internal init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()
if let value = try? container.decode(Wrapped.self) {
self = .encodeValue(value)
@ -52,7 +52,7 @@ extension NullEncodable: Codable where Wrapped: Codable {
}
}
public func encode(to encoder: Encoder) throws {
internal func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
switch self {
case .encodeNothing: return