### Get Business Object Metadata Source: https://github.com/xsy-neoui/neo-open-api/blob/master/README.md Retrieves field metadata for a specified business object. ```typescript import { xObject } from 'neo-open-api'; const result = await xObject.getDesc('xObjectApiKey'); ``` -------------------------------- ### 安装 Neo OpenAPI SDK Source: https://github.com/xsy-neoui/neo-open-api/blob/master/README.md 在自定义组件项目中安装 SDK 的命令。 ```bash npm install --save neo-open-api ``` -------------------------------- ### customApi.run Source: https://github.com/xsy-neoui/neo-open-api/blob/master/README.md Executes a custom platform API. ```APIDOC ## customApi.run ### Description Executes a custom API endpoint defined on the platform. ### Parameters - **apiUrl** (string) - Required - The path of the custom API. - **methodType** (string) - Optional - The HTTP method (e.g., POST, GET), defaults to POST. - **data** (object) - Optional - The request body data. ### Response - **status** (boolean) - Success status. - **code** (number|string) - Response code. - **msg** (string) - Response message. - **data** (any) - The response payload. ``` -------------------------------- ### 查询业务对象数据列表 Source: https://github.com/xsy-neoui/neo-open-api/blob/master/README.md 使用 xObject.query 进行数据查询,支持通过字符串或数组形式定义过滤条件。 ```typescript import { xObject } from 'neo-open-api'; // 基本查询(无 where) const result = await xObject.query({ xObjectApiKey: 'xxObject', // 业务对象 API Key fields: ['name', 'phone', 'email'], // 查询字段 page: 1, // 页码(可选) pageSize: 10, // 每页数量(可选) orderBy: 'id asc' // 排序(可选,仅支持 id) }); // where 为字符串:与通用查询 SQL 语法一致,拼接到 `select ... from ...` 之后 const byString = await xObject.query({ xObjectApiKey: 'xxObject', fields: ['name', 'city'], where: "city = '北京' and name like '张%'", page: 1, pageSize: 20 }); // where 为字符串数组:多项以 ` and ` 连接,便于拆分、复用条件片段 const byArray = await xObject.query({ xObjectApiKey: 'xxObject', fields: ['name', 'status'], where: ["status = '生效'", "name like '李%'"], page: 1, pageSize: 20 }); // 与 where: "status = '生效' and name like '李%' ``` -------------------------------- ### 发起通用 HTTP 请求 Source: https://github.com/xsy-neoui/neo-open-api/blob/master/README.md 使用 request 方法发起自定义请求,支持 GET、POST 等多种 HTTP 方法及自定义配置。 ```typescript import { request } from 'neo-open-api'; const result = await request({ url: '/api/endpoint', method: 'GET', data: { key: 'value' }, headers: { 'Custom-Header': 'value' }, timeout: 30000 }); ``` -------------------------------- ### 获取业务类型列表 Source: https://github.com/xsy-neoui/neo-open-api/blob/master/README.md 获取指定业务对象下的业务类型列表。 ```typescript import { xObject } from 'neo-open-api'; const result = await xObject.getEntityTypeList('xObjectApiKey', { // 其他请求选项 }); ``` -------------------------------- ### 更新业务数据 Source: https://github.com/xsy-neoui/neo-open-api/blob/master/README.md 根据主键更新指定的业务对象记录。 ```typescript import { xObject } from 'neo-open-api'; const result = await xObject.update('xObjectApiKey', 'xObjectId', { data: { name: '李四', phone: '13900139000' } }); ``` ```typescript { status: boolean; code: number; msg: string; data: Object; } ``` -------------------------------- ### xObject.create Source: https://github.com/xsy-neoui/neo-open-api/blob/master/README.md Creates a new record for a specified business object. ```APIDOC ## xObject.create ### Description Creates a new business data record using the provided field values. ### Parameters - **xObjectApiKey** (string) - Required - The API Key of the business object. - **options.data** (object) - Required - Key-value pairs of fields to create. ### Response - **data** (object) - The newly created record. ``` -------------------------------- ### xObject.getEntityList Source: https://github.com/xsy-neoui/neo-open-api/blob/master/README.md Retrieves a list of system entities, including standard and custom objects. ```APIDOC ## xObject.getEntityList ### Description Returns a list of entities available in the system, with options to filter by custom status or user permissions. ### Parameters - **custom** (boolean) - Optional - If true, returns only custom objects; if false, only standard objects. Omit to return all. - **active** (boolean) - Optional - If true, returns only objects the current user has permission to access. Defaults to true. ### Response - **data** (any[]) - List of entities. ``` -------------------------------- ### 查询返回结构示例 Source: https://github.com/xsy-neoui/neo-open-api/blob/master/README.md 查询接口返回的数据结构定义。 ```typescript { status: boolean; // true 表示成功 code: number; // 返回码 msg: string; // 多为错误信息 totalSize: number; // 总条数 data: any[]; // 数据行 } ``` -------------------------------- ### customApi.getList Source: https://github.com/xsy-neoui/neo-open-api/blob/master/README.md Retrieves a list of registered custom APIs. ```APIDOC ## customApi.getList ### Description Retrieves a paginated list of custom APIs registered on the platform. ### Parameters - **pageNo** (number) - Optional - Page number, defaults to 1. - **pageSize** (number) - Optional - Number of items per page, defaults to 1000. ### Response - **status** (boolean) - Success status. - **code** (number|string) - Response code. - **msg** (string) - Response message. - **totalSize** (number) - Total count of APIs. - **data** (array) - List of custom APIs. ``` -------------------------------- ### 获取实体列表 Source: https://github.com/xsy-neoui/neo-open-api/blob/master/README.md 根据权限或类型获取系统中的对象列表。 ```typescript import { xObject } from 'neo-open-api'; // 标准对象 + 自定义对象(有权限的) const { data: allEntities } = await xObject.getEntityList({ active: true }); // 仅标准对象 const { data: standardObjects } = await xObject.getEntityList({ custom: false, active: true }); // 仅自定义对象 const { data: customObjects } = await xObject.getEntityList({ custom: true, active: true }); ``` -------------------------------- ### 创建业务数据 Source: https://github.com/xsy-neoui/neo-open-api/blob/master/README.md 向指定的业务对象中创建新记录。 ```typescript import { xObject } from 'neo-open-api'; const result = await xObject.create('xObjectApiKey', { data: { name: '张三', phone: '13800138000', email: 'zhangsan@example.com' } }); ``` ```typescript { status: boolean; code: number; msg: string; totalSize: number; data: Object; // 新建记录 } ``` -------------------------------- ### 执行实体对象 CRUD 操作 Source: https://github.com/xsy-neoui/neo-open-api/blob/master/README.md 通过 xObject 模块对实体数据进行查询、创建、更新、获取详情及删除操作。 ```typescript import { xObject } from 'neo-open-api'; const { data: contacts } = await xObject.query({ xObjectApiKey: 'Contact', fields: ['name', 'phone', 'email'], page: 1, pageSize: 20, orderBy: 'id desc' }); const { data: newContact } = await xObject.create('Contact', { data: { name: '王五', phone: '13700137000', email: 'wangwu@example.com' } }); const { data: updatedContact } = await xObject.update('Contact', newContact.id, { data: { name: '王五(更新)' } }); const { data: contactDetail } = await xObject.get('Contact', newContact.id); await xObject.delete('Contact', newContact.id); ``` -------------------------------- ### request(options) Source: https://github.com/xsy-neoui/neo-open-api/blob/master/README.md A generic request method based on axios to perform custom HTTP operations. ```APIDOC ## request(options) ### Description Performs a generic HTTP request. Supports GET, POST, PATCH, DELETE, etc. ### Parameters - **url** (string) - Required - The request path. - **method** (string) - Optional - HTTP method, defaults to GET. - **data** (object) - Optional - Request body data; for GET requests, this is converted to query parameters. - **headers** (object) - Optional - Request headers; defaults to include Content-Type: application/json. - **timeout** (number) - Optional - Timeout in milliseconds, defaults to 30000. ``` -------------------------------- ### xObject.get Source: https://github.com/xsy-neoui/neo-open-api/blob/master/README.md Retrieves the details of a specific business data record. ```APIDOC ## xObject.get ### Description Retrieves the details of a specific business data record using the API Key and record ID. ### Parameters - **xObjectApiKey** (string) - Required - The API Key of the business object. - **xObjectId** (string) - Required - The ID of the record to retrieve. - **option** (object) - Optional - Additional request configuration. ### Response - **status** (boolean) - Success status. - **code** (number) - Response code. - **msg** (string) - Response message. - **data** (Object) - The retrieved business data. ``` -------------------------------- ### List Custom APIs Source: https://github.com/xsy-neoui/neo-open-api/blob/master/README.md Retrieves a paginated list of registered custom APIs. ```typescript import { customApi } from 'neo-open-api'; const result = await customApi.getList({ pageNo: 1, // 可选 pageSize: 1000 // 可选 }); ``` ```typescript { status: boolean; code: number | string; msg: string; totalSize: number; data: any[]; } ``` -------------------------------- ### xObject.query Source: https://github.com/xsy-neoui/neo-open-api/blob/master/README.md Queries a list of business object data with support for pagination, filtering, and sorting. ```APIDOC ## xObject.query ### Description Retrieves a list of business object data based on specified criteria. Supports pagination and filtering via string or array-based conditions. ### Parameters - **xObjectApiKey** (string) - Required - The API Key of the business object. - **fields** (string[]) - Required - Array of fields to retrieve (id is automatically included). - **where** (string | string[]) - Optional - Filtering conditions. Strings follow SQL-like syntax; arrays are joined by 'and'. - **page** (number) - Optional - Page number, defaults to 1. - **pageSize** (number) - Optional - Number of items per page, defaults to 10. - **orderBy** (string) - Optional - Sorting expression, currently only supports 'id asc' or 'id desc'. ### Response - **status** (boolean) - Success status. - **code** (number) - Response code. - **msg** (string) - Error message if applicable. - **totalSize** (number) - Total count of records. - **data** (any[]) - Array of retrieved records. ``` -------------------------------- ### Execute Custom API Source: https://github.com/xsy-neoui/neo-open-api/blob/master/README.md Runs a custom API endpoint with specified HTTP method and request body. ```typescript import { customApi } from 'neo-open-api'; const result = await customApi.run({ apiUrl: '/rest/custom/api/endpoint', // 自定义 API 路径 methodType: 'POST', // GET、POST、PUT、DELETE 等,可选,默认 POST data: { key1: 'value1', key2: 'value2' } }); ``` ```typescript { status: boolean; code: number | string; msg: string; data: any; } ``` ```typescript import { customApi } from 'neo-open-api'; const result = await customApi.run({ apiUrl: '/rest/custom/api/processData', methodType: 'POST', data: { param1: 'value1', param2: 'value2' } }); const { data: apiList } = await customApi.getList({ pageNo: 1, pageSize: 100 }); ``` -------------------------------- ### Retrieve Business Data Details Source: https://github.com/xsy-neoui/neo-open-api/blob/master/README.md Fetches details for a specific business object record using either an object parameter or positional arguments. ```typescript import { xObject } from 'neo-open-api'; // 方式一:对象参数 const result = await xObject.get({ xObjectApiKey: 'xxKey', xObjectId: 'xxId', option: { // 其他请求选项 } }); // 方式二:位置参数 const result2 = await xObject.get('xObjectApiKey', 'xObjectId', { // 其他请求选项 }); ``` ```typescript { status: boolean; code: number; msg: string; data: Object; } ``` -------------------------------- ### xObject Operations Source: https://github.com/xsy-neoui/neo-open-api/blob/master/README.md Methods for performing CRUD operations on xObjects. ```APIDOC ## xObject Methods ### xObject.query(options) Queries a list of xObjects. - **xObjectApiKey** (string) - Required - The API key of the object. - **fields** (array) - Optional - List of fields to retrieve. - **page** (number) - Optional - Page number. - **pageSize** (number) - Optional - Number of items per page. - **orderBy** (string) - Optional - Sorting criteria. ### xObject.create(xObjectApiKey, data) Creates a new xObject record. ### xObject.update(xObjectApiKey, id, data) Updates an existing xObject record by ID. ### xObject.get(xObjectApiKey, id) Retrieves a single xObject record by ID. ### xObject.delete(xObjectApiKey, id) Deletes an xObject record by ID. ``` -------------------------------- ### xObject.getDesc Source: https://github.com/xsy-neoui/neo-open-api/blob/master/README.md Retrieves the field metadata for a business object. ```APIDOC ## xObject.getDesc ### Description Fetches the field metadata (description) for a given business object API Key. ### Parameters - **xObjectApiKey** (string) - Required - The API Key of the business object. ``` -------------------------------- ### xObject.getEntityTypeList Source: https://github.com/xsy-neoui/neo-open-api/blob/master/README.md Retrieves the list of business types for a specific business object. ```APIDOC ## xObject.getEntityTypeList ### Description Fetches the available business types associated with a given business object API Key. ### Parameters - **xObjectApiKey** (string) - Required - The API Key of the business object. - **options** (object) - Optional - Additional request configuration. ### Response - **data** (any[]) - List of business types. ``` -------------------------------- ### xObject.delete Source: https://github.com/xsy-neoui/neo-open-api/blob/master/README.md Deletes a specific business data record. ```APIDOC ## xObject.delete ### Description Deletes a business data record identified by the API Key and record ID. ### Parameters - **xObjectApiKey** (string) - Required - The API Key of the business object. - **xObjectId** (string) - Required - The ID of the record to delete. ### Response - **status** (boolean) - Success status. - **code** (number) - Response code. - **msg** (string) - Response message. ``` -------------------------------- ### xObject.update Source: https://github.com/xsy-neoui/neo-open-api/blob/master/README.md Updates an existing record for a specified business object. ```APIDOC ## xObject.update ### Description Updates specific fields of an existing record identified by its ID. ### Parameters - **xObjectApiKey** (string) - Required - The API Key of the business object. - **xObjectId** (string) - Required - The unique identifier of the record to update. - **options.data** (object) - Required - Key-value pairs of fields to update. ### Response - **data** (object) - The updated record. ``` -------------------------------- ### Delete Business Data Source: https://github.com/xsy-neoui/neo-open-api/blob/master/README.md Removes a specific record from a business object. ```typescript import { xObject } from 'neo-open-api'; const result = await xObject.delete('xObjectApiKey', 'xObjectId'); ``` ```typescript { status: boolean; code: number; msg: string; } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.