Skip to content

Commit 6697f06

Browse files
algolia-botKalmar99Jonas Kalmar Rønningmillotp
committed
feat(specs): add support for widgets / banners in search for the csharp client (generated)
algolia/api-clients-automation#3870 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Jonas <[email protected]> Co-authored-by: Jonas Kalmar Rønning <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
1 parent 0d25698 commit 6697f06

14 files changed

+516
-4
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on
2+
// https://github.com/algolia/api-clients-automation. DO NOT EDIT.
3+
4+
import Foundation
5+
#if canImport(Core)
6+
import Core
7+
#endif
8+
9+
/// a search banner with image and url.
10+
public struct RecommendBanner: Codable, JSONEncodable {
11+
public var image: RecommendBannerImage?
12+
public var link: RecommendBannerLink?
13+
14+
public init(image: RecommendBannerImage? = nil, link: RecommendBannerLink? = nil) {
15+
self.image = image
16+
self.link = link
17+
}
18+
19+
public enum CodingKeys: String, CodingKey, CaseIterable {
20+
case image
21+
case link
22+
}
23+
24+
// Encodable protocol methods
25+
26+
public func encode(to encoder: Encoder) throws {
27+
var container = encoder.container(keyedBy: CodingKeys.self)
28+
try container.encodeIfPresent(self.image, forKey: .image)
29+
try container.encodeIfPresent(self.link, forKey: .link)
30+
}
31+
}
32+
33+
extension RecommendBanner: Equatable {
34+
public static func ==(lhs: RecommendBanner, rhs: RecommendBanner) -> Bool {
35+
lhs.image == rhs.image &&
36+
lhs.link == rhs.link
37+
}
38+
}
39+
40+
extension RecommendBanner: Hashable {
41+
public func hash(into hasher: inout Hasher) {
42+
hasher.combine(self.image?.hashValue)
43+
hasher.combine(self.link?.hashValue)
44+
}
45+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on
2+
// https://github.com/algolia/api-clients-automation. DO NOT EDIT.
3+
4+
import Foundation
5+
#if canImport(Core)
6+
import Core
7+
#endif
8+
9+
/// image of a search banner.
10+
public struct RecommendBannerImage: Codable, JSONEncodable {
11+
public var urls: RecommendBannerImageUrl?
12+
public var title: String?
13+
14+
public init(urls: RecommendBannerImageUrl? = nil, title: String? = nil) {
15+
self.urls = urls
16+
self.title = title
17+
}
18+
19+
public enum CodingKeys: String, CodingKey, CaseIterable {
20+
case urls
21+
case title
22+
}
23+
24+
// Encodable protocol methods
25+
26+
public func encode(to encoder: Encoder) throws {
27+
var container = encoder.container(keyedBy: CodingKeys.self)
28+
try container.encodeIfPresent(self.urls, forKey: .urls)
29+
try container.encodeIfPresent(self.title, forKey: .title)
30+
}
31+
}
32+
33+
extension RecommendBannerImage: Equatable {
34+
public static func ==(lhs: RecommendBannerImage, rhs: RecommendBannerImage) -> Bool {
35+
lhs.urls == rhs.urls &&
36+
lhs.title == rhs.title
37+
}
38+
}
39+
40+
extension RecommendBannerImage: Hashable {
41+
public func hash(into hasher: inout Hasher) {
42+
hasher.combine(self.urls?.hashValue)
43+
hasher.combine(self.title?.hashValue)
44+
}
45+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on
2+
// https://github.com/algolia/api-clients-automation. DO NOT EDIT.
3+
4+
import Foundation
5+
#if canImport(Core)
6+
import Core
7+
#endif
8+
9+
/// url for a search banner image.
10+
public struct RecommendBannerImageUrl: Codable, JSONEncodable {
11+
public var url: String?
12+
13+
public init(url: String? = nil) {
14+
self.url = url
15+
}
16+
17+
public enum CodingKeys: String, CodingKey, CaseIterable {
18+
case url
19+
}
20+
21+
// Encodable protocol methods
22+
23+
public func encode(to encoder: Encoder) throws {
24+
var container = encoder.container(keyedBy: CodingKeys.self)
25+
try container.encodeIfPresent(self.url, forKey: .url)
26+
}
27+
}
28+
29+
extension RecommendBannerImageUrl: Equatable {
30+
public static func ==(lhs: RecommendBannerImageUrl, rhs: RecommendBannerImageUrl) -> Bool {
31+
lhs.url == rhs.url
32+
}
33+
}
34+
35+
extension RecommendBannerImageUrl: Hashable {
36+
public func hash(into hasher: inout Hasher) {
37+
hasher.combine(self.url?.hashValue)
38+
}
39+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on
2+
// https://github.com/algolia/api-clients-automation. DO NOT EDIT.
3+
4+
import Foundation
5+
#if canImport(Core)
6+
import Core
7+
#endif
8+
9+
/// link for a banner defined in merchandising studio.
10+
public struct RecommendBannerLink: Codable, JSONEncodable {
11+
public var url: String?
12+
13+
public init(url: String? = nil) {
14+
self.url = url
15+
}
16+
17+
public enum CodingKeys: String, CodingKey, CaseIterable {
18+
case url
19+
}
20+
21+
// Encodable protocol methods
22+
23+
public func encode(to encoder: Encoder) throws {
24+
var container = encoder.container(keyedBy: CodingKeys.self)
25+
try container.encodeIfPresent(self.url, forKey: .url)
26+
}
27+
}
28+
29+
extension RecommendBannerLink: Equatable {
30+
public static func ==(lhs: RecommendBannerLink, rhs: RecommendBannerLink) -> Bool {
31+
lhs.url == rhs.url
32+
}
33+
}
34+
35+
extension RecommendBannerLink: Hashable {
36+
public func hash(into hasher: inout Hasher) {
37+
hasher.combine(self.url?.hashValue)
38+
}
39+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on
2+
// https://github.com/algolia/api-clients-automation. DO NOT EDIT.
3+
4+
import Foundation
5+
#if canImport(Core)
6+
import Core
7+
#endif
8+
9+
/// banners defined in the merchandising studio for the given search.
10+
public struct RecommendBanners: Codable, JSONEncodable {
11+
public var banners: RecommendBanner?
12+
13+
public init(banners: RecommendBanner? = nil) {
14+
self.banners = banners
15+
}
16+
17+
public enum CodingKeys: String, CodingKey, CaseIterable {
18+
case banners
19+
}
20+
21+
// Encodable protocol methods
22+
23+
public func encode(to encoder: Encoder) throws {
24+
var container = encoder.container(keyedBy: CodingKeys.self)
25+
try container.encodeIfPresent(self.banners, forKey: .banners)
26+
}
27+
}
28+
29+
extension RecommendBanners: Equatable {
30+
public static func ==(lhs: RecommendBanners, rhs: RecommendBanners) -> Bool {
31+
lhs.banners == rhs.banners
32+
}
33+
}
34+
35+
extension RecommendBanners: Hashable {
36+
public func hash(into hasher: inout Hasher) {
37+
hasher.combine(self.banners?.hashValue)
38+
}
39+
}

Sources/Recommend/Models/RecommendRenderingContent.swift

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,22 @@ import Foundation
1111
public struct RecommendRenderingContent: Codable, JSONEncodable {
1212
public var facetOrdering: RecommendFacetOrdering?
1313
public var redirect: RecommendRedirectURL?
14+
public var widgets: RecommendWidgets?
1415

15-
public init(facetOrdering: RecommendFacetOrdering? = nil, redirect: RecommendRedirectURL? = nil) {
16+
public init(
17+
facetOrdering: RecommendFacetOrdering? = nil,
18+
redirect: RecommendRedirectURL? = nil,
19+
widgets: RecommendWidgets? = nil
20+
) {
1621
self.facetOrdering = facetOrdering
1722
self.redirect = redirect
23+
self.widgets = widgets
1824
}
1925

2026
public enum CodingKeys: String, CodingKey, CaseIterable {
2127
case facetOrdering
2228
case redirect
29+
case widgets
2330
}
2431

2532
// Encodable protocol methods
@@ -28,19 +35,22 @@ public struct RecommendRenderingContent: Codable, JSONEncodable {
2835
var container = encoder.container(keyedBy: CodingKeys.self)
2936
try container.encodeIfPresent(self.facetOrdering, forKey: .facetOrdering)
3037
try container.encodeIfPresent(self.redirect, forKey: .redirect)
38+
try container.encodeIfPresent(self.widgets, forKey: .widgets)
3139
}
3240
}
3341

3442
extension RecommendRenderingContent: Equatable {
3543
public static func ==(lhs: RecommendRenderingContent, rhs: RecommendRenderingContent) -> Bool {
3644
lhs.facetOrdering == rhs.facetOrdering &&
37-
lhs.redirect == rhs.redirect
45+
lhs.redirect == rhs.redirect &&
46+
lhs.widgets == rhs.widgets
3847
}
3948
}
4049

4150
extension RecommendRenderingContent: Hashable {
4251
public func hash(into hasher: inout Hasher) {
4352
hasher.combine(self.facetOrdering?.hashValue)
4453
hasher.combine(self.redirect?.hashValue)
54+
hasher.combine(self.widgets?.hashValue)
4555
}
4656
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on
2+
// https://github.com/algolia/api-clients-automation. DO NOT EDIT.
3+
4+
import Foundation
5+
#if canImport(Core)
6+
import Core
7+
#endif
8+
9+
/// widgets returned from any rules that are applied to the current search.
10+
public struct RecommendWidgets: Codable, JSONEncodable {
11+
public var banners: RecommendBanners?
12+
13+
public init(banners: RecommendBanners? = nil) {
14+
self.banners = banners
15+
}
16+
17+
public enum CodingKeys: String, CodingKey, CaseIterable {
18+
case banners
19+
}
20+
21+
// Encodable protocol methods
22+
23+
public func encode(to encoder: Encoder) throws {
24+
var container = encoder.container(keyedBy: CodingKeys.self)
25+
try container.encodeIfPresent(self.banners, forKey: .banners)
26+
}
27+
}
28+
29+
extension RecommendWidgets: Equatable {
30+
public static func ==(lhs: RecommendWidgets, rhs: RecommendWidgets) -> Bool {
31+
lhs.banners == rhs.banners
32+
}
33+
}
34+
35+
extension RecommendWidgets: Hashable {
36+
public func hash(into hasher: inout Hasher) {
37+
hasher.combine(self.banners?.hashValue)
38+
}
39+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on
2+
// https://github.com/algolia/api-clients-automation. DO NOT EDIT.
3+
4+
import Foundation
5+
#if canImport(Core)
6+
import Core
7+
#endif
8+
9+
/// a search banner with image and url.
10+
public struct SearchBanner: Codable, JSONEncodable {
11+
public var image: SearchBannerImage?
12+
public var link: SearchBannerLink?
13+
14+
public init(image: SearchBannerImage? = nil, link: SearchBannerLink? = nil) {
15+
self.image = image
16+
self.link = link
17+
}
18+
19+
public enum CodingKeys: String, CodingKey, CaseIterable {
20+
case image
21+
case link
22+
}
23+
24+
// Encodable protocol methods
25+
26+
public func encode(to encoder: Encoder) throws {
27+
var container = encoder.container(keyedBy: CodingKeys.self)
28+
try container.encodeIfPresent(self.image, forKey: .image)
29+
try container.encodeIfPresent(self.link, forKey: .link)
30+
}
31+
}
32+
33+
extension SearchBanner: Equatable {
34+
public static func ==(lhs: SearchBanner, rhs: SearchBanner) -> Bool {
35+
lhs.image == rhs.image &&
36+
lhs.link == rhs.link
37+
}
38+
}
39+
40+
extension SearchBanner: Hashable {
41+
public func hash(into hasher: inout Hasher) {
42+
hasher.combine(self.image?.hashValue)
43+
hasher.combine(self.link?.hashValue)
44+
}
45+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on
2+
// https://github.com/algolia/api-clients-automation. DO NOT EDIT.
3+
4+
import Foundation
5+
#if canImport(Core)
6+
import Core
7+
#endif
8+
9+
/// image of a search banner.
10+
public struct SearchBannerImage: Codable, JSONEncodable {
11+
public var urls: SearchBannerImageUrl?
12+
public var title: String?
13+
14+
public init(urls: SearchBannerImageUrl? = nil, title: String? = nil) {
15+
self.urls = urls
16+
self.title = title
17+
}
18+
19+
public enum CodingKeys: String, CodingKey, CaseIterable {
20+
case urls
21+
case title
22+
}
23+
24+
// Encodable protocol methods
25+
26+
public func encode(to encoder: Encoder) throws {
27+
var container = encoder.container(keyedBy: CodingKeys.self)
28+
try container.encodeIfPresent(self.urls, forKey: .urls)
29+
try container.encodeIfPresent(self.title, forKey: .title)
30+
}
31+
}
32+
33+
extension SearchBannerImage: Equatable {
34+
public static func ==(lhs: SearchBannerImage, rhs: SearchBannerImage) -> Bool {
35+
lhs.urls == rhs.urls &&
36+
lhs.title == rhs.title
37+
}
38+
}
39+
40+
extension SearchBannerImage: Hashable {
41+
public func hash(into hasher: inout Hasher) {
42+
hasher.combine(self.urls?.hashValue)
43+
hasher.combine(self.title?.hashValue)
44+
}
45+
}

0 commit comments

Comments
 (0)