Skip to content

Commit

Permalink
fix(specs): browse response required properties
Browse files Browse the repository at this point in the history
algolia/api-clients-automation#3348

Co-authored-by: Pierre Millot <pierre.millot@algolia.com>
  • Loading branch information
algolia-bot and millotp committed Jul 11, 2024
1 parent c666d86 commit 0082369
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 132 deletions.
38 changes: 38 additions & 0 deletions Sources/Ingestion/Models/DockerStreamsInput.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on
// https://github.com/algolia/api-clients-automation. DO NOT EDIT.

import Foundation
#if canImport(Core)
import Core
#endif

public struct DockerStreamsInput: Codable, JSONEncodable {
public var streams: AnyCodable

public init(streams: AnyCodable) {
self.streams = streams
}

public enum CodingKeys: String, CodingKey, CaseIterable {
case streams
}

// Encodable protocol methods

public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(self.streams, forKey: .streams)
}
}

extension DockerStreamsInput: Equatable {
public static func ==(lhs: DockerStreamsInput, rhs: DockerStreamsInput) -> Bool {
lhs.streams == rhs.streams
}
}

extension DockerStreamsInput: Hashable {
public func hash(into hasher: inout Hasher) {
hasher.combine(self.streams.hashValue)
}
}
54 changes: 0 additions & 54 deletions Sources/Ingestion/Models/OnDemandDateUtilsInput.swift

This file was deleted.

47 changes: 0 additions & 47 deletions Sources/Ingestion/Models/ScheduleDateUtilsInput.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Foundation

/// Input for a &#x60;streaming&#x60; task whose source is of type &#x60;ga4BigqueryExport&#x60; and for which extracted
/// data is continuously streamed.
public struct StreamingUtilsInput: Codable, JSONEncodable {
public struct StreamingInput: Codable, JSONEncodable {
public var mapping: MappingInput

public init(mapping: MappingInput) {
Expand All @@ -27,13 +27,13 @@ public struct StreamingUtilsInput: Codable, JSONEncodable {
}
}

extension StreamingUtilsInput: Equatable {
public static func ==(lhs: StreamingUtilsInput, rhs: StreamingUtilsInput) -> Bool {
extension StreamingInput: Equatable {
public static func ==(lhs: StreamingInput, rhs: StreamingInput) -> Bool {
lhs.mapping == rhs.mapping
}
}

extension StreamingUtilsInput: Hashable {
extension StreamingInput: Hashable {
public func hash(into hasher: inout Hasher) {
hasher.combine(self.mapping.hashValue)
}
Expand Down
31 changes: 12 additions & 19 deletions Sources/Ingestion/Models/TaskInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,16 @@ import Foundation

/// Configuration of the task, depending on its type.
public enum TaskInput: Codable, JSONEncodable, AbstractEncodable {
case onDemandDateUtilsInput(OnDemandDateUtilsInput)
case scheduleDateUtilsInput(ScheduleDateUtilsInput)
case streamingUtilsInput(StreamingUtilsInput)
case streamingInput(StreamingInput)
case dockerStreamsInput(DockerStreamsInput)
case shopifyInput(ShopifyInput)

public func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
switch self {
case let .onDemandDateUtilsInput(value):
case let .streamingInput(value):
try container.encode(value)
case let .scheduleDateUtilsInput(value):
try container.encode(value)
case let .streamingUtilsInput(value):
case let .dockerStreamsInput(value):
try container.encode(value)
case let .shopifyInput(value):
try container.encode(value)
Expand All @@ -29,12 +26,10 @@ public enum TaskInput: Codable, JSONEncodable, AbstractEncodable {

public init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()
if let value = try? container.decode(OnDemandDateUtilsInput.self) {
self = .onDemandDateUtilsInput(value)
} else if let value = try? container.decode(ScheduleDateUtilsInput.self) {
self = .scheduleDateUtilsInput(value)
} else if let value = try? container.decode(StreamingUtilsInput.self) {
self = .streamingUtilsInput(value)
if let value = try? container.decode(StreamingInput.self) {
self = .streamingInput(value)
} else if let value = try? container.decode(DockerStreamsInput.self) {
self = .dockerStreamsInput(value)
} else if let value = try? container.decode(ShopifyInput.self) {
self = .shopifyInput(value)
} else {
Expand All @@ -47,12 +42,10 @@ public enum TaskInput: Codable, JSONEncodable, AbstractEncodable {

public func GetActualInstance() -> Encodable {
switch self {
case let .onDemandDateUtilsInput(value):
value as OnDemandDateUtilsInput
case let .scheduleDateUtilsInput(value):
value as ScheduleDateUtilsInput
case let .streamingUtilsInput(value):
value as StreamingUtilsInput
case let .streamingInput(value):
value as StreamingInput
case let .dockerStreamsInput(value):
value as DockerStreamsInput
case let .shopifyInput(value):
value as ShopifyInput
}
Expand Down
8 changes: 4 additions & 4 deletions Sources/Ingestion/Models/Transformation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public struct Transformation: Codable, JSONEncodable {
/// The uniquely identified name of your transformation.
public var name: String
/// A descriptive name for your transformation of what it does.
public var description: String
public var description: String?
/// Date of creation in RFC 3339 format.
public var createdAt: String
/// Date of last update in RFC 3339 format.
Expand All @@ -24,7 +24,7 @@ public struct Transformation: Codable, JSONEncodable {
transformationID: String,
code: String,
name: String,
description: String,
description: String? = nil,
createdAt: String,
updatedAt: String? = nil
) {
Expand Down Expand Up @@ -52,7 +52,7 @@ public struct Transformation: Codable, JSONEncodable {
try container.encode(self.transformationID, forKey: .transformationID)
try container.encode(self.code, forKey: .code)
try container.encode(self.name, forKey: .name)
try container.encode(self.description, forKey: .description)
try container.encodeIfPresent(self.description, forKey: .description)
try container.encode(self.createdAt, forKey: .createdAt)
try container.encodeIfPresent(self.updatedAt, forKey: .updatedAt)
}
Expand All @@ -74,7 +74,7 @@ extension Transformation: Hashable {
hasher.combine(self.transformationID.hashValue)
hasher.combine(self.code.hashValue)
hasher.combine(self.name.hashValue)
hasher.combine(self.description.hashValue)
hasher.combine(self.description?.hashValue)
hasher.combine(self.createdAt.hashValue)
hasher.combine(self.updatedAt?.hashValue)
}
Expand Down
8 changes: 4 additions & 4 deletions Sources/Ingestion/Models/TransformationCreate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ public struct TransformationCreate: Codable, JSONEncodable {
/// The uniquely identified name of your transformation.
public var name: String
/// A descriptive name for your transformation of what it does.
public var description: String
public var description: String?

public init(code: String, name: String, description: String) {
public init(code: String, name: String, description: String? = nil) {
self.code = code
self.name = name
self.description = description
Expand All @@ -33,7 +33,7 @@ public struct TransformationCreate: Codable, JSONEncodable {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(self.code, forKey: .code)
try container.encode(self.name, forKey: .name)
try container.encode(self.description, forKey: .description)
try container.encodeIfPresent(self.description, forKey: .description)
}
}

Expand All @@ -49,6 +49,6 @@ extension TransformationCreate: Hashable {
public func hash(into hasher: inout Hasher) {
hasher.combine(self.code.hashValue)
hasher.combine(self.name.hashValue)
hasher.combine(self.description.hashValue)
hasher.combine(self.description?.hashValue)
}
}

0 comments on commit 0082369

Please sign in to comment.