Skip to content

Commit

Permalink
feat(specs): add secrets authentications to ingestion (generated)
Browse files Browse the repository at this point in the history
algolia/api-clients-automation#4054

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Clément Vannicatte <[email protected]>
  • Loading branch information
algolia-bot and shortcuts committed Oct 30, 2024
1 parent d642979 commit f4b28d8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Sources/Ingestion/Models/AuthInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public enum AuthInput: Codable, JSONEncodable, AbstractEncodable {
case authAPIKey(AuthAPIKey)
case authAlgolia(AuthAlgolia)
case authAlgoliaInsights(AuthAlgoliaInsights)
case dictionaryOfStringToString([String: String])

public func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
Expand All @@ -29,6 +30,8 @@ public enum AuthInput: Codable, JSONEncodable, AbstractEncodable {
try container.encode(value)
case let .authAlgoliaInsights(value):
try container.encode(value)
case let .dictionaryOfStringToString(value):
try container.encode(value)
}
}

Expand All @@ -46,6 +49,8 @@ public enum AuthInput: Codable, JSONEncodable, AbstractEncodable {
self = .authAlgolia(value)
} else if let value = try? container.decode(AuthAlgoliaInsights.self) {
self = .authAlgoliaInsights(value)
} else if let value = try? container.decode([String: String].self) {
self = .dictionaryOfStringToString(value)
} else {
throw DecodingError.typeMismatch(
Self.Type.self,
Expand All @@ -68,6 +73,8 @@ public enum AuthInput: Codable, JSONEncodable, AbstractEncodable {
value as AuthAlgolia
case let .authAlgoliaInsights(value):
value as AuthAlgoliaInsights
case let .dictionaryOfStringToString(value):
value as [String: String]
}
}
}
Expand Down
1 change: 1 addition & 0 deletions Sources/Ingestion/Models/AuthenticationType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public enum AuthenticationType: String, Codable, CaseIterable {
case oauth
case algolia
case algoliaInsights
case secrets
}

extension AuthenticationType: Hashable {}

0 comments on commit f4b28d8

Please sign in to comment.