Grexx平台API - TypeScript客户端
的TypeScript客户端 Grexx平台API,由OpenAPI 3.0.2规范生成。它提供了与API端点交互的强类型接口。
目录表
概述
这个 Grexx平台API 允许您与Grexx平台进行交互,以管理案例、数据集、表单、任务等。这个客户端提供了一种方便的方式来使用TypeScript类型和接口访问API,以获得更好的开发体验。
安装
使用npm或yarn安装客户端包:
npm install grexx-api-client
# or
yarn add grexx-api-client
用法
初始化
要使用客户机,请初始化 OpenAPI 使用您的Grexx平台的基本URL和任何所需的身份验证详细信息配置。
import { OpenAPI } from 'grexx-api';
OpenAPI.BASE = 'https://name.grexx.today/api/v1';
OpenAPI.TOKEN = 'your-api-key'; // Replace with your API key if required
例子
检索案例信息
import { CaseService } from 'grexx-api';
const casePath = 'example-case-id';
CaseService.caseInfo(casePath, { css: true, rootline: false })
.then(response => {
console.log('Case Info:', response);
})
.catch(error => {
console.error('Error fetching case info:', error);
});
提交任务
import { CaseService } from 'grexx-api';
const taskId = 12345;
const casePath = 'example-case-id';
CaseService.taskSubmit(taskId, casePath, {
fields: { fieldName: 'value' },
autoProgress: true,
})
.then(response => {
console.log('Task submitted successfully:', response);
})
.catch(error => {
console.error('Error submitting task:', error);
});