-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Extract
IntegrationMappingPartnerItemSlack
to `IntegrationMapp…
…ingPartnerItemSlackUnion` (box/box-codegen#530) (#165) Co-authored-by: box-sdk-build <box-sdk-build@box.com>
- Loading branch information
1 parent
5d87629
commit d51df9a
Showing
4 changed files
with
63 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{ "engineHash": "594b60f", "specHash": "137da0d", "version": "0.3.0" } | ||
{ "engineHash": "6a7e147", "specHash": "137da0d", "version": "0.3.0" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...mas/IntegrationMappingPartnerItemSlackUnion/IntegrationMappingPartnerItemSlackUnion.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import Foundation | ||
|
||
public enum IntegrationMappingPartnerItemSlackUnion: Codable { | ||
case integrationMappingPartnerItemSlack(IntegrationMappingPartnerItemSlack) | ||
|
||
private enum DiscriminatorCodingKey: String, CodingKey { | ||
case type | ||
} | ||
|
||
public init(from decoder: Decoder) throws { | ||
if let container = try? decoder.container(keyedBy: DiscriminatorCodingKey.self) { | ||
if let discriminator_0 = try? container.decode(String.self, forKey: .type) { | ||
switch discriminator_0 { | ||
case "channel": | ||
if let content = try? IntegrationMappingPartnerItemSlack(from: decoder) { | ||
self = .integrationMappingPartnerItemSlack(content) | ||
return | ||
} | ||
|
||
default: | ||
throw DecodingError.typeMismatch(IntegrationMappingPartnerItemSlackUnion.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "The Decoded object contains an unexpected value for key type")) | ||
|
||
} | ||
} | ||
|
||
} | ||
|
||
throw DecodingError.typeMismatch(IntegrationMappingPartnerItemSlackUnion.self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "The type of the decoded object cannot be determined.")) | ||
|
||
} | ||
|
||
public func encode(to encoder: Encoder) throws { | ||
switch self { | ||
case .integrationMappingPartnerItemSlack(let integrationMappingPartnerItemSlack): | ||
try integrationMappingPartnerItemSlack.encode(to: encoder) | ||
} | ||
} | ||
|
||
} |