| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- import request from '@/service/request'
- /**
- * 此函数根据给定的查询参数检索模型列表。
- * @param params - “params”参数是一个“IOT.API.QueryPamars”类型的对象,其中包含查询参数,这些参数将与 GET
- * 请求一起发送到“/model/page”端点。这些查询参数可用于过滤、排序和分页 API 返回的结果。
- * @returns `getModel` 函数返回一个解析为 `IOT.API.Model` 对象数组的 Promise。 Promise
- * 由“request”函数返回,该函数使用提供的“params”作为查询参数向“/model/page”端点发出 GET 请求。
- */
- export const getModel = (params: IOT.API.MODEL.QueryPamars) => {
- return request<IOT.API.MODEL.ModelDot[]>({
- url: '/model/page',
- method: 'GET',
- params
- })
- }
- /**
- * 函数 delModel 向带有指定 id 参数的 model 端点发送删除请求。
- * @param {string} id - `id` 参数是一个字符串,表示需要删除的模型的唯一标识符。此函数可能是 API 客户端的一部分,它向 URL 路径中具有指定“id”的服务器端点发送
- * DELETE 请求以删除相应的模型资源。
- * @returns `delModel` 函数返回一个解析为布尔值 `true` 的 Promise。
- */
- export const delModel = (id: string) => {
- return request<true>({
- url: `/model/${id}`,
- method: 'DELETE'
- })
- }
- /**
- * 此函数使用提供的数据向“/model”端点发送 POST 请求。
- * @param data - `data` 参数是一个 `IOT.API.MODEL.Model` 类型的对象,其中包含创建新模型所需的信息。该对象可能包含模型名称、描述和任何其他相关详细信息等属性。
- * @returns `addModel` 函数返回一个解析为字符串的 Promise。该字符串是在使用提供的 data 对象向 model 端点发出 POST 请求后服务器的响应。
- */
- export const addModel = (data: IOT.API.MODEL.Model) => {
- return request<string>({
- url: '/model',
- method: 'POST',
- data
- })
- }
- /**
- * 此函数使用 API 请求按 ID 检索模型。
- * @param {string} id - `id` 参数是一个字符串,表示模型的唯一标识符。此函数使用此标识符向服务器发出 GET 请求并检索相应的模型对象。
- * @returns `getModelById` 函数返回一个解析为 `IOT.API.MODEL.ModelDot` 类型对象的
- * Promise。该对象表示一个模型并包含有关它的信息。该函数正在向“/model/”端点发出 GET 请求,以检索具有指定“id”的模型。
- */
- export const getModelById = (id: string) => {
- return request<IOT.API.MODEL.ModelDot>({
- url: `/model/${id}`,
- method: 'GET'
- })
- }
- /**
- * 此函数发送 GET 请求以从 API 端点检索模型属性。
- * @param {any} params - `params` 参数是一个对象,其中包含要与 GET 请求一起发送到 `/modelAttribute/page`
- * 端点的查询参数。这些参数可能包括页码、页面大小、排序选项和过滤器等内容。 API 期望的具体参数将取决于其
- * @returns `getModelAttribute` 函数返回一个解析为 `IOT.API.MODELATTR.ModelAttr` 类型对象的
- * Promise。该对象表示模型属性的页面,通过使用指定参数向 `/modelAttribute/page` 端点发出 GET 请求获得。
- */
- export const getModelAttribute = (params: any) => {
- return request<IOT.API.MODELATTR.ModelAttr[]>({
- url: '/modelAttribute/page',
- method: 'GET',
- params
- })
- }
- /**
- * 此函数使用 POST 请求将新模型属性添加到特定模型。
- * @param data - `data` 参数是一个包含模型属性及其关联的 `modelId` 的对象。 `IOT.API.MODELATTR.ModelAttr`
- * 类型表明该对象具有特定的结构,并且可能包含诸如 `name`、`dataType`、`description` 等属性。
- * @returns `addModelAttribute` 函数返回一个解析为字符串的 Promise。
- */
- export const addModelAttribute = (data: IOT.API.MODELATTR.ModelAttr & {modelId: string}) => {
- return request<string>({
- url: '/modelAttribute',
- method: 'POST',
- data
- })
- }
- /**
- * 此函数使用 PUT 请求更新 API 中的模型属性。
- * @param data - `data` 参数是一个包含模型属性更新值的对象。它应该具有以下属性:
- * @returns `updateModelAttribute` 函数返回一个解析为字符串的 Promise。
- */
- export const updateModelAttribute = (data: IOT.API.MODELATTR.ModelAttr & {modelId: string}) => {
- return request<string>({
- url: '/modelAttribute',
- method: 'PUT',
- data
- })
- }
- /**
- * 此函数发送 DELETE 请求以删除具有特定 ID 的模型属性。
- * @param {string} id - `id` 参数是一个字符串,表示需要删除的模型属性的唯一标识符。
- * @returns `delModelAttribute` 函数返回一个解析为字符串的 Promise。该字符串表示向 `/modelAttribute/` 端点发送 DELETE
- * 请求后服务器的响应。
- */
- export const delModelAttribute = (id: string) => {
- return request<string>({
- url: `/modelAttribute/${id}`,
- method: 'DELETE'
- })
- }
- /**
- * 此函数发送 GET 请求以检索模型命令页面。
- * @param {any} params - `params` 参数是一个包含可选查询参数的对象,这些参数将与 GET 请求一起发送到 `/modelCmd/page`
- * 端点。这些参数可能包括页码、页面大小、排序标准或过滤器等内容,以应用于端点返回的数据。
- * @returns `getModelCmd` 函数返回一个解析为 `string` 的 `Promise`。 `request` 函数使用提供的 `params` 向 `/modelCmd/page`
- * 端点发出 GET 请求。
- */
- export const getModelCmd = (params: any) => {
- return request<IOT.API.CMD.Cmd[]>({
- url: '/modelCmd/page',
- method: 'GET',
- params
- })
- }
- /**
- * 此函数使用提供的数据向“/modelCmd”端点发送 POST 请求。
- * @param {any} data - `data` 参数是一个对象,其中包含要在请求正文中发送的数据。它可以包括诸如“名称”、“描述”、“类型”、“参数”等属性。具体属性及其值将取决于被调用的
- * API 端点的要求。
- * @returns `addModelCmd` 函数返回一个解析为字符串的 Promise。 Promise 由 `request` 函数返回,该函数使用提供的 `data` 向 `/modelCmd`
- * 端点发出 POST 请求。
- */
- export const addModelCmd = (data: any) => {
- return request<string>({
- url: '/modelCmd',
- method: 'POST',
- data
- })
- }
- /**
- * 此函数发送 PUT 请求以使用提供的数据更新模型命令。
- * @param {any} data - `data` 参数是一个对象,其中包含要在请求正文中发送的数据。它可以是需要为模型命令更新的任何数据。
- * @returns `updateModelCmd` 函数返回一个解析为字符串的 Promise。 Promise 由“request”函数返回,该函数使用提供的数据向“/modelCmd”端点发送
- * PUT 请求。
- */
- export const updateModelCmd = (data: any) => {
- return request<string>({
- url: '/modelCmd',
- method: 'PUT',
- data
- })
- }
- export const delModelCmd = (id: string) => {
- return request<string>({
- url: `/modelCmd/${id}`,
- method: 'DELETE'
- })
- }
|