-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from swiftty/feature/1.7
Feature/1.7
- Loading branch information
Showing
203 changed files
with
20,610 additions
and
10 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
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
72 changes: 72 additions & 0 deletions
72
.../AppCustomProductPageLocalizations/AppCustomProductPageLocalizations.POST.generated.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,72 @@ | ||
// autogenerated | ||
|
||
// swiftlint:disable all | ||
import Foundation | ||
#if canImport(FoundationNetworking) | ||
import FoundationNetworking | ||
#endif | ||
|
||
extension V1.AppCustomProductPageLocalizations { | ||
public struct POST: Endpoint { | ||
public typealias Parameters = AppCustomProductPageLocalizationCreateRequest | ||
public typealias Response = AppCustomProductPageLocalizationResponse | ||
|
||
public var path: String { | ||
"/v1/appCustomProductPageLocalizations" | ||
} | ||
|
||
/// AppCustomProductPageLocalization representation | ||
public var parameters: Parameters | ||
|
||
public init(parameters: Parameters) { | ||
self.parameters = parameters | ||
} | ||
|
||
public func request(with baseURL: URL) throws -> URLRequest? { | ||
var components = URLComponents(url: baseURL, resolvingAgainstBaseURL: true) | ||
components?.path = path | ||
|
||
var urlRequest = components?.url.map { URLRequest(url: $0) } | ||
urlRequest?.httpMethod = "POST" | ||
|
||
var jsonEncoder: JSONEncoder { | ||
let encoder = JSONEncoder() | ||
return encoder | ||
} | ||
|
||
urlRequest?.httpBody = try jsonEncoder.encode(parameters) | ||
urlRequest?.setValue("application/json", forHTTPHeaderField: "Content-Type") | ||
return urlRequest | ||
} | ||
|
||
/// - Returns: **201**, Single AppCustomProductPageLocalization as `AppCustomProductPageLocalizationResponse` | ||
/// - Throws: **400**, Parameter error(s) as `ErrorResponse` | ||
/// - Throws: **403**, Forbidden error as `ErrorResponse` | ||
/// - Throws: **409**, Request entity error(s) as `ErrorResponse` | ||
public static func response(from data: Data, urlResponse: HTTPURLResponse) throws -> Response { | ||
var jsonDecoder: JSONDecoder { | ||
let decoder = JSONDecoder() | ||
return decoder | ||
} | ||
|
||
switch urlResponse.statusCode { | ||
case 201: | ||
return try jsonDecoder.decode(AppCustomProductPageLocalizationResponse.self, from: data) | ||
|
||
case 400: | ||
throw try jsonDecoder.decode(ErrorResponse.self, from: data) | ||
|
||
case 403: | ||
throw try jsonDecoder.decode(ErrorResponse.self, from: data) | ||
|
||
case 409: | ||
throw try jsonDecoder.decode(ErrorResponse.self, from: data) | ||
|
||
default: | ||
throw try jsonDecoder.decode(ErrorResponse.self, from: data) | ||
} | ||
} | ||
} | ||
} | ||
|
||
// swiftlint:enable all |
Oops, something went wrong.