Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 107 additions & 0 deletions Packages/ton-api/Sources/Generated/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,57 @@ public struct Client: APIProtocol {
)
}
private var converter: Converter { client.converter }
/// Status
///
/// - Remark: HTTP `GET /v2/status`.
/// - Remark: Generated from `#/paths//v2/status/get(status)`.
public func status(_ input: Operations.status.Input) async throws -> Operations.status.Output {
try await client.send(
input: input,
forOperation: Operations.status.id,
serializer: { input in
let path = try converter.renderedPath(template: "/v2/status", parameters: [])
var request: HTTPTypes.HTTPRequest = .init(soar_path: path, method: .get)
suppressMutabilityWarning(&request)
converter.setAcceptHeader(in: &request.headerFields, contentTypes: input.headers.accept)
return (request, nil)
},
deserializer: { response, responseBody in
switch response.status.code {
case 200:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.status.Output.Ok.Body
if try contentType == nil
|| converter.isMatchingContentType(received: contentType, expectedRaw: "application/json")
{
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.ServiceStatus.self,
from: responseBody,
transforming: { value in .json(value) }
)
} else {
throw converter.makeUnexpectedContentTypeError(contentType: contentType)
}
return .ok(.init(body: body))
default:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Components.Responses._Error.Body
if try contentType == nil
|| converter.isMatchingContentType(received: contentType, expectedRaw: "application/json")
{
body = try await converter.getResponseBodyAsJSON(
Components.Responses._Error.Body.jsonPayload.self,
from: responseBody,
transforming: { value in .json(value) }
)
} else {
throw converter.makeUnexpectedContentTypeError(contentType: contentType)
}
return .`default`(statusCode: response.status.code, .init(body: body))
}
}
)
}
/// Get blockchain block data
///
/// - Remark: HTTP `GET /v2/blockchain/blocks/{block_id}`.
Expand Down Expand Up @@ -3691,6 +3742,62 @@ public struct Client: APIProtocol {
}
)
}
/// Get jetton's custom payload and state init required for transfer
///
/// - Remark: HTTP `GET /v2/jettons/{jetton_id}/transfer/{account_id}/payload`.
/// - Remark: Generated from `#/paths//v2/jettons/{jetton_id}/transfer/{account_id}/payload/get(getJettonTransferPayload)`.
public func getJettonTransferPayload(_ input: Operations.getJettonTransferPayload.Input) async throws
-> Operations.getJettonTransferPayload.Output
{
try await client.send(
input: input,
forOperation: Operations.getJettonTransferPayload.id,
serializer: { input in
let path = try converter.renderedPath(
template: "/v2/jettons/{}/transfer/{}/payload",
parameters: [input.path.account_id, input.path.jetton_id]
)
var request: HTTPTypes.HTTPRequest = .init(soar_path: path, method: .get)
suppressMutabilityWarning(&request)
converter.setAcceptHeader(in: &request.headerFields, contentTypes: input.headers.accept)
return (request, nil)
},
deserializer: { response, responseBody in
switch response.status.code {
case 200:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Operations.getJettonTransferPayload.Output.Ok.Body
if try contentType == nil
|| converter.isMatchingContentType(received: contentType, expectedRaw: "application/json")
{
body = try await converter.getResponseBodyAsJSON(
Components.Schemas.JettonTransferPayload.self,
from: responseBody,
transforming: { value in .json(value) }
)
} else {
throw converter.makeUnexpectedContentTypeError(contentType: contentType)
}
return .ok(.init(body: body))
default:
let contentType = converter.extractContentTypeIfPresent(in: response.headerFields)
let body: Components.Responses._Error.Body
if try contentType == nil
|| converter.isMatchingContentType(received: contentType, expectedRaw: "application/json")
{
body = try await converter.getResponseBodyAsJSON(
Components.Responses._Error.Body.jsonPayload.self,
from: responseBody,
transforming: { value in .json(value) }
)
} else {
throw converter.makeUnexpectedContentTypeError(contentType: contentType)
}
return .`default`(statusCode: response.status.code, .init(body: body))
}
}
)
}
/// Get only jetton transfers in the event
///
/// - Remark: HTTP `GET /v2/events/{event_id}/jettons`.
Expand Down
Loading