The Leap Workflows API allows developers to run workflows, fetch workflow runs, and provide other utility functions related to workflow runs. Please use the X-Api-Key for authenticated requests.
- 在Xcode中,选择文件 > 添加包…并输入
https://github.com/leap-ai/leap-workflows-swift-sdk
作为仓库URL。 - 从我们的标签页中选择最新版本号。
- 将Leap产品添加到您应用程序的目标。
- 将以下行添加到您的
Cartfile
github "leap-ai/leap-workflows-swift-sdk"
- 遵循Carthage安装说明。
- 将来,要更新到SDK的最新版本,请运行以下命令:
carthage update leap-workflows-swift-sdk
- 将
source 'https://github.com/CocoaPods/Specs.git'
添加到您的Podfile
- 将
pod 'Leap', '~> 0.1.0'
添加到您的Podfile
您的Podfile
应如下所示:
# Podfile
source 'https://github.com/CocoaPods/Specs.git'
target 'Example' do
pod 'Leap', '~> 0.1.0'
end
- 运行
pod install
❯ pod install
Analyzing dependencies
Downloading dependencies
Installing Leap 0.1.0
Generating Pods project
Integrating client project
Pod installation complete! There is 1 dependency from the Podfile and 2 total pods installed.
- 将来,要更新到SDK的最新版本,运行:
pod update Leap
import Leap
let leap = LeapClient(
apiKey: "X_API_KEY"
// Defining the base path is optional and defaults to https://api.workflows.tryleap.ai
// basePath: "https://api.workflows.tryleap.ai"
)
let bulkRunId = "bulkRunId_example"
let getBulkResponse = try await leap.bulkWorkflowRuns.getBulk(
bulkRunId: bulkRunId
)
此端点通过其bulk_run_id
检索特定批量工作流运行的详细信息。
let bulkRunId = "bulkRunId_example"
let getBulkResponse = try await leap.bulkWorkflowRuns.getBulk(
bulkRunId: bulkRunId
)
要检索的批量运行的ID。
/v1/runs/bulk/{bulk_run_id}
GET
此端点允许用户以提供的CSV文件批量运行指定的工作流。
let workflowId = "workflowId_example"
let inputCsvUrl = "inputCsvUrl_example"
let webhookUrl = "webhookUrl_example"
let runBulkResponse = try await leap.bulkWorkflowRuns.runBulk(
workflowId: workflowId,
inputCsvUrl: inputCsvUrl,
webhookUrl: webhookUrl
)
要批量运行的工作流的ID。
包含批量运行输入数据的CSV文件。每一行应包含单个运行的输入数据。
批量运行完成时结果应该发送到的URL。
/v1/runs/bulk
POST
此端点通过其 workflow_run_id
获取特定工作流运行的详细信息。
let workflowRunId = "workflowRunId_example"
let getWorkflowRunResponse = try await leap.workflowRuns.getWorkflowRun(
workflowRunId: workflowRunId
)
要检索的工作流运行的 ID。
/v1/runs/{workflow_run_id}
GET
此端点允许用户使用提供的 workflows 定义运行指定的工作流。
let workflowId = "workflowId_example"
let webhookUrl = "webhookUrl_example"
let input = "TODO"
let workflowResponse = try await leap.workflowRuns.workflow(
workflowId: workflowId,
webhookUrl: webhookUrl,
input: input
)
要运行的工作流 ID。
工作流完成时将结果发送到的 URL。
工作流可以在全局范围内使用的变量及其值。
/v1/runs
POST
此 TypeScript 包是由 Konfig 自动生成的。