We want to generate relatively simple methods at first. Ignore detailed errors, retry loops, pagination, LROs, multiple HTTP bindings, multiple query parameters, complex bodies, or anything else. We want something to start building from.
This is a good start for publicca-v1:
public func CreateExternalAccountKey(req: CreateExternalAccountKeyRequest) async throws -> ExternalAccountKey {
let query = [
URLQueryItem(name: "$alt", value: "json")
]
var request = try await self.inner.Request(path: "/v1/\(req.parent)/externalAccountKeys", query: query)
request.httpMethod = "POST"
if let body = req.externalAccountKey {
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = try JSONEncoder().encode(body)
}
let (data, response) = try await self.inner.data(for: request)
if !(200..<300).contains(response.statusCode) {
throw RequestError.http(HTTPDetails(
http_status_code: response.statusCode,
headers: [:],
payload: data,
))
}
let decodedResponse = try JSONDecoder().decode(ExternalAccountKey.self, from: data)
return decodedResponse
}
We want to generate relatively simple methods at first. Ignore detailed errors, retry loops, pagination, LROs, multiple HTTP bindings, multiple query parameters, complex bodies, or anything else. We want something to start building from.
This is a good start for
publicca-v1: