Skip to content
代码片段 群组 项目
rest-api.js 3.0 KB
更新 更旧
  • 了解如何忽略特定修订
  • /**
     *
     *    Copyright (c) 2020 Silicon Labs
     *
     *    Licensed under the Apache License, Version 2.0 (the "License");
     *    you may not use this file except in compliance with the License.
     *    You may obtain a copy of the License at
     *
     *        http://www.apache.org/licenses/LICENSE-2.0
     *
     *    Unless required by applicable law or agreed to in writing, software
     *    distributed under the License is distributed on an "AS IS" BASIS,
     *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     *    See the License for the specific language governing permissions and
     *    limitations under the License.
     */
    
    
      zclEntity: '/zcl/:entity/:id',
    
      saveSessionKeyValue: '/save',
    
      getAllSessionKeyValues: '/allKeyValues',
    
      generate: '/generate',
    
      endpoint: '/endpoint',
      endpointType: '/endpointType',
      initialState: '/initialState',
    
      commandUpdate: '/command/update',
      cluster: '/cluster',
      attributeUpdate: '/attribute/update',
    
      preview: '/preview/',
      previewName: '/preview/:name',
      previewNameIndex: '/preview/:name/:index',
    
      version: '/version',
    
      packages: `/packages`,
    
      sessionPackage: `/sessionPackage`,
    
      zclExtension: `/zclExtension/:entity/:extensionId`,
    
      zclCluster: '/zcl/cluster/',
      zclDeviceType: '/zcl/deviceType/',
      zclDomain: '/zcl/domain/',
      zclBitmap: '/zcl/bitmap/',
      zclEnum: '/zcl/enum/',
      zclStruct: '/zcl/struct/',
      endpointTypeClusters: '/zcl/endpointTypeClusters/',
      endpointTypeAttributes: '/zcl/endpointTypeAttributes/',
      endpointTypeCommands: '/zcl/endpointTypeCommands/',
    
      deviceTypeClusters: '/zcl/deviceTypeClusters/',
      deviceTypeAttributes: '/zcl/deviceTypeAttributes/',
      deviceTypeCommands: '/zcl/deviceTypeCommands/',
    
    const uiMode = {
      ZIGBEE: `zigbee`,
    }
    
    
    const httpCode = {
      ok: 200,
      badRequest: 400,
      notFound: 404,
      isSuccess: (code) => {
        return code >= 200 && code < 300
      },
    }
    
    
    Jing Teng's avatar
    Jing Teng 已提交
    const uc = {
      // command id
      componentTree: '/uc/component/tree',
      componentAdd: '/uc/component/add',
      componentRemove: '/uc/component/remove',
    
    }
    
    const ide = {
      // request
      open: '/file/open',
      close: '/file/close',
      save: '/file/save',
      saveAs: '/file/saveAs',
      rename: '/file/rename',
      move: '/file/move',
      isDirty: '/file/isDirty',
    
      // response
      openResponse: 'openResponse',
    
    const updateKey = {
      deviceTypeRef: 'deviceTypeRef',
      endpointId: 'endpointId',
      endpointType: 'endpointType',
    
      attributeSelected: 'selectedAttributes',
      attributeSingleton: 'selectedSingleton',
      attributeBounded: 'selectedBounded',
      attributeDefault: 'defaultValue',
      attributeReporting: 'selectedReporting',
      attributeReportMin: 'reportingMin',
      attributeReportMax: 'reportingMax',
      attributeReportChange: 'reportableChange',
      attributeStorage: 'storageOption',
    
    exports.uri = uri
    
    Jing Teng's avatar
    Jing Teng 已提交
    exports.uc = uc
    
    exports.ide = ide