Skip to content

Commit

Permalink
Merge pull request #274 from bilousoleksandr/master
Browse files Browse the repository at this point in the history
chore: Add missing marketplace related API
  • Loading branch information
AvdLee authored Jun 10, 2024
2 parents 0fef5f6 + fdccb2e commit bd4d549
Show file tree
Hide file tree
Showing 14 changed files with 710 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Generated by Create API
// https://github.com/CreateAPI/CreateAPI

import Foundation

public struct AlternativeDistributionDomain: Codable, Identifiable {
public var type: `Type`
public var id: String
public var attributes: Attributes?
public var links: ResourceLinks?

public enum `Type`: String, Codable, CaseIterable {
case alternativeDistributionDomains
}

public struct Attributes: Codable {
public var domain: String?
public var referenceName: String?
public var createdDate: Date?

public init(domain: String? = nil, referenceName: String? = nil, createdDate: Date? = nil) {
self.domain = domain
self.referenceName = referenceName
self.createdDate = createdDate
}

public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.domain = try values.decodeIfPresent(String.self, forKey: "domain")
self.referenceName = try values.decodeIfPresent(String.self, forKey: "referenceName")
self.createdDate = try values.decodeIfPresent(Date.self, forKey: "createdDate")
}

public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encodeIfPresent(domain, forKey: "domain")
try values.encodeIfPresent(referenceName, forKey: "referenceName")
try values.encodeIfPresent(createdDate, forKey: "createdDate")
}
}

public init(type: `Type`, id: String, attributes: Attributes? = nil, links: ResourceLinks? = nil) {
self.type = type
self.id = id
self.attributes = attributes
self.links = links
}

public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.type = try values.decode(`Type`.self, forKey: "type")
self.id = try values.decode(String.self, forKey: "id")
self.attributes = try values.decodeIfPresent(Attributes.self, forKey: "attributes")
self.links = try values.decodeIfPresent(ResourceLinks.self, forKey: "links")
}

public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encode(type, forKey: "type")
try values.encode(id, forKey: "id")
try values.encodeIfPresent(attributes, forKey: "attributes")
try values.encodeIfPresent(links, forKey: "links")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Generated by Create API
// https://github.com/CreateAPI/CreateAPI

import Foundation

public struct AlternativeDistributionDomainCreateRequest: Codable {
public var data: Data

public struct Data: Codable {
public var type: `Type`
public var attributes: Attributes

public enum `Type`: String, Codable, CaseIterable {
case alternativeDistributionDomains
}

public struct Attributes: Codable {
public var domain: String
public var referenceName: String

public init(domain: String, referenceName: String) {
self.domain = domain
self.referenceName = referenceName
}

public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.domain = try values.decode(String.self, forKey: "domain")
self.referenceName = try values.decode(String.self, forKey: "referenceName")
}

public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encode(domain, forKey: "domain")
try values.encode(referenceName, forKey: "referenceName")
}
}

public init(type: `Type`, attributes: Attributes) {
self.type = type
self.attributes = attributes
}

public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.type = try values.decode(`Type`.self, forKey: "type")
self.attributes = try values.decode(Attributes.self, forKey: "attributes")
}

public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encode(type, forKey: "type")
try values.encode(attributes, forKey: "attributes")
}
}

public init(data: Data) {
self.data = data
}

public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decode(Data.self, forKey: "data")
}

public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encode(data, forKey: "data")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Generated by Create API
// https://github.com/CreateAPI/CreateAPI

import Foundation

public struct AlternativeDistributionDomainResponse: Codable {
/// AlternativeDistributionDomain
public var data: AlternativeDistributionDomain
public var links: DocumentLinks

public init(data: AlternativeDistributionDomain, links: DocumentLinks) {
self.data = data
self.links = links
}

public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decode(AlternativeDistributionDomain.self, forKey: "data")
self.links = try values.decode(DocumentLinks.self, forKey: "links")
}

public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encode(data, forKey: "data")
try values.encode(links, forKey: "links")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Generated by Create API
// https://github.com/CreateAPI/CreateAPI

import Foundation

public struct AlternativeDistributionDomainsResponse: Codable {
public var data: [AlternativeDistributionDomain]
public var links: PagedDocumentLinks
public var meta: PagingInformation?

public init(data: [AlternativeDistributionDomain], links: PagedDocumentLinks, meta: PagingInformation? = nil) {
self.data = data
self.links = links
self.meta = meta
}

public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.data = try values.decode([AlternativeDistributionDomain].self, forKey: "data")
self.links = try values.decode(PagedDocumentLinks.self, forKey: "links")
self.meta = try values.decodeIfPresent(PagingInformation.self, forKey: "meta")
}

public func encode(to encoder: Encoder) throws {
var values = encoder.container(keyedBy: StringCodingKey.self)
try values.encode(data, forKey: "data")
try values.encode(links, forKey: "links")
try values.encodeIfPresent(meta, forKey: "meta")
}
}
6 changes: 3 additions & 3 deletions Sources/OpenAPI/Generated/Entities/CiGitUser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import Foundation

public struct CiGitUser: Codable {
public var displayName: String?
public var avatarURL: String?
public var avatarURL: URL?

public init(displayName: String? = nil, avatarURL: String? = nil) {
public init(displayName: String? = nil, avatarURL: URL? = nil) {
self.displayName = displayName
self.avatarURL = avatarURL
}

public init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: StringCodingKey.self)
self.displayName = try values.decodeIfPresent(String.self, forKey: "displayName")
self.avatarURL = try values.decodeIfPresent(String.self, forKey: "avatarUrl")
self.avatarURL = try values.decodeIfPresent(URL.self, forKey: "avatarUrl")
}

public func encode(to encoder: Encoder) throws {
Expand Down
1 change: 1 addition & 0 deletions Sources/OpenAPI/Generated/Entities/MarketplaceDomain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import Foundation

@available(*, deprecated, message: "Deprecated")
public struct MarketplaceDomain: Codable, Identifiable {
public var type: `Type`
public var id: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import Foundation

@available(*, deprecated, message: "Deprecated")
public struct MarketplaceDomainCreateRequest: Codable {
public var data: Data

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@

import Foundation

@available(*, deprecated, message: "Deprecated")
public struct MarketplaceDomainResponse: Codable {
/// MarketplaceDomain
///
/// - warning: Deprecated.
public var data: MarketplaceDomain
public var links: DocumentLinks

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import Foundation

@available(*, deprecated, message: "Deprecated")
public struct MarketplaceDomainsResponse: Codable {
public var data: [MarketplaceDomain]
public var links: PagedDocumentLinks
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Generated by Create API
// https://github.com/CreateAPI/CreateAPI

import Foundation
import URLQueryEncoder

extension APIEndpoint.V1 {
public var alternativeDistributionDomains: AlternativeDistributionDomains {
AlternativeDistributionDomains(path: path + "/alternativeDistributionDomains")
}

public struct AlternativeDistributionDomains {
/// Path: `/v1/alternativeDistributionDomains`
public let path: String

public func get(fieldsAlternativeDistributionDomains: [FieldsAlternativeDistributionDomains]? = nil, limit: Int? = nil) -> Request<AppStoreConnect_Swift_SDK.AlternativeDistributionDomainsResponse> {
Request(path: path, method: "GET", query: makeGetQuery(fieldsAlternativeDistributionDomains, limit), id: "alternativeDistributionDomains-get_collection")
}

private func makeGetQuery(_ fieldsAlternativeDistributionDomains: [FieldsAlternativeDistributionDomains]?, _ limit: Int?) -> [(String, String?)] {
let encoder = URLQueryEncoder()
encoder.encode(fieldsAlternativeDistributionDomains, forKey: "fields[alternativeDistributionDomains]", explode: false)
encoder.encode(limit, forKey: "limit")
return encoder.items
}

public enum FieldsAlternativeDistributionDomains: String, Codable, CaseIterable {
case createdDate
case domain
case referenceName
}

public func post(_ body: AppStoreConnect_Swift_SDK.AlternativeDistributionDomainCreateRequest) -> Request<AppStoreConnect_Swift_SDK.AlternativeDistributionDomainResponse> {
Request(path: path, method: "POST", body: body, id: "alternativeDistributionDomains-create_instance")
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Generated by Create API
// https://github.com/CreateAPI/CreateAPI

import Foundation
import URLQueryEncoder

extension APIEndpoint.V1.AlternativeDistributionDomains {
public func id(_ id: String) -> WithID {
WithID(path: "\(path)/\(id)")
}

public struct WithID {
/// Path: `/v1/alternativeDistributionDomains/{id}`
public let path: String

public func get(fieldsAlternativeDistributionDomains: [FieldsAlternativeDistributionDomains]? = nil) -> Request<AppStoreConnect_Swift_SDK.AlternativeDistributionDomainResponse> {
Request(path: path, method: "GET", query: makeGetQuery(fieldsAlternativeDistributionDomains), id: "alternativeDistributionDomains-get_instance")
}

private func makeGetQuery(_ fieldsAlternativeDistributionDomains: [FieldsAlternativeDistributionDomains]?) -> [(String, String?)] {
let encoder = URLQueryEncoder()
encoder.encode(fieldsAlternativeDistributionDomains, forKey: "fields[alternativeDistributionDomains]", explode: false)
return encoder.items
}

public enum FieldsAlternativeDistributionDomains: String, Codable, CaseIterable {
case createdDate
case domain
case referenceName
}

public var delete: Request<Void> {
Request(path: path, method: "DELETE", id: "alternativeDistributionDomains-delete_instance")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ extension APIEndpoint.V1 {
/// Path: `/v1/marketplaceDomains`
public let path: String

@available(*, deprecated, message: "Deprecated")
public func get(fieldsMarketplaceDomains: [FieldsMarketplaceDomains]? = nil, limit: Int? = nil) -> Request<AppStoreConnect_Swift_SDK.MarketplaceDomainsResponse> {
Request(path: path, method: "GET", query: makeGetQuery(fieldsMarketplaceDomains, limit), id: "marketplaceDomains-get_collection")
}
Expand All @@ -30,6 +31,7 @@ extension APIEndpoint.V1 {
case referenceName
}

@available(*, deprecated, message: "Deprecated")
public func post(_ body: AppStoreConnect_Swift_SDK.MarketplaceDomainCreateRequest) -> Request<AppStoreConnect_Swift_SDK.MarketplaceDomainResponse> {
Request(path: path, method: "POST", body: body, id: "marketplaceDomains-create_instance")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ extension APIEndpoint.V1.MarketplaceDomains {
/// Path: `/v1/marketplaceDomains/{id}`
public let path: String

@available(*, deprecated, message: "Deprecated")
public func get(fieldsMarketplaceDomains: [FieldsMarketplaceDomains]? = nil) -> Request<AppStoreConnect_Swift_SDK.MarketplaceDomainResponse> {
Request(path: path, method: "GET", query: makeGetQuery(fieldsMarketplaceDomains), id: "marketplaceDomains-get_instance")
}
Expand All @@ -29,6 +30,7 @@ extension APIEndpoint.V1.MarketplaceDomains {
case referenceName
}

@available(*, deprecated, message: "Deprecated")
public var delete: Request<Void> {
Request(path: path, method: "DELETE", id: "marketplaceDomains-delete_instance")
}
Expand Down
Loading

0 comments on commit bd4d549

Please sign in to comment.