aliyun_iotx_client

package module
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2022 License: MIT Imports: 17 Imported by: 0

README

生活物联网平台云端api

介绍

阿里云IoT网关,旨在通过http/https协议将物联网平台及衍生服务开放给开发者。本文档主要介绍如何访问阿里云IoT网关。IoT网关依赖阿里云API网关,IoT网关在阿里云API网关的基础上扩展了IoT的特殊业务协议。

安装

go get github.com/dongjssd/aliyun_iotx_client@v0.1.3

方法命名规则

/cloud/token/refresh => TokenRefresh()

示例

var appKey = "" //阿里云appKey
var appSecret = "" //阿里云appSecret
var host = "" //API网关协议与地址 默认api.link.aliyun.com
client, _ := aliyun_iotx_client.InitSyncApiClient(appKey, appSecret, host)
var apiVer = "1.0.1" //版本号
res := client.TokenGet(apiVer, "")

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SyncApiClient

type SyncApiClient struct {
	// contains filtered or unexported fields
}

func InitSyncApiClient

func InitSyncApiClient(appKey, appSecret, host string) (client *SyncApiClient, err error)

InitSyncApiClient *

  • @Author dongjs
  • @Description //初始化api client
  • @Date 10:11 2022/5/24
  • @Param
  • @return *

func (*SyncApiClient) AccountGetByIdentityId

func (c *SyncApiClient) AccountGetByIdentityId(apiVer, identityId string) (res response.AccountGetByIdentityIdResponse)

AccountGetByIdentityId 调用该接口通过IdentityId查询账户的详细信息,无内容值的字段不返回。IdentityId可以通过调用/cloud/account/queryIdentityByPage接口获得。

func (*SyncApiClient) AccountGetByOpenId

func (c *SyncApiClient) AccountGetByOpenId(apiVer, openId, openIdAppKey string) (res response.AccountGetByOpenIdResponse)

AccountGetByOpenId 通过三方外标查询账号信息

func (*SyncApiClient) AccountInfoUpdate

func (c *SyncApiClient) AccountInfoUpdate(apiVer, openIdAppKey, openId, identityId,
	nickName string) (res response.CommonResponse)

func (*SyncApiClient) AccountQueryIdentityDescByPage

func (c *SyncApiClient) AccountQueryIdentityDescByPage(apiVer string, offset, count int) (res response.AccountQueryIdentityByPageResponse)

AccountQueryIdentityDescByPage 调用该接口分页查询租户下的用户列表,倒序排序

func (*SyncApiClient) AccountRegionGet

func (c *SyncApiClient) AccountRegionGet(apiVer, queryType, countryCode, phone, email, authCode,
	phoneLocationCode string) (res response.AccountRegionGetResponse)

AccountRegionGet 调用该接口获取用户账号对应的 Region 信息。支持手机、邮箱、国家、OAuthCode。(此接口云端与客户端通用)

func (*SyncApiClient) AmountDeviceGenerate

func (c *SyncApiClient) AmountDeviceGenerate(apiVer, productKey string, amount int64) (res response.DeviceGenerateResponse)

AmountDeviceGenerate 云端开放的产品量产接口(动态生成设备名称)调用该接口可自动生成设备证书,设备名称由系统分配。生成设备证书后,可以直接调用/living/device/apply/query接口下载设备证书。

func (*SyncApiClient) CloudStorageCommodityBuy

func (c *SyncApiClient) CloudStorageCommodityBuy(apiVer, iotId, userName, commodityCode, specification string,
	copies int, enableDefaultPlan, immediateUse bool, preRecordDuration, recordDuration int,
	eventRecordProlong bool, maxRecordFileDuration int) (res response.CloudStorageCommodityBuyResponse)

CloudStorageCommodityBuy 调用该接口购买云存储套餐

func (*SyncApiClient) CloudStorageCommodityCheck

func (c *SyncApiClient) CloudStorageCommodityCheck(apiVer, iotId, commodityCode, specification string) (res response.CloudStorageCommodityCheckResponse)

CloudStorageCommodityCheck 调用该接口查询云存储套餐是否可以购买

func (*SyncApiClient) CloudStorageCommodityEnable

func (c *SyncApiClient) CloudStorageCommodityEnable(apiVer, iotId, orderId string) (res response.CloudStorageCommodityEnableResponse)

CloudStorageCommodityEnable 调用该接口设置购买的云存储套餐立即生效

func (*SyncApiClient) CloudStorageCommodityQuery

func (c *SyncApiClient) CloudStorageCommodityQuery(apiVer string) (res response.CloudStorageCommodityQueryResponse)

CloudStorageCommodityQuery 调用该接口查询视频云存储套餐列表

func (*SyncApiClient) CloudStorageOrderGet

func (c *SyncApiClient) CloudStorageOrderGet(apiVer, iotId, orderId string) (res response.CloudStorageOrderGetResponse)

CloudStorageOrderGet 调用该接口获取云存储套餐的订单详情

func (*SyncApiClient) CloudStorageOrderQuery

func (c *SyncApiClient) CloudStorageOrderQuery(apiVer, iotId string, pageNo, pageSize int) (res response.CloudStorageOrderQueryResponse)

CloudStorageOrderQuery 调用该接口查询云存储套餐的订单列表信息

func (*SyncApiClient) CloudStorageStatusSet

func (c *SyncApiClient) CloudStorageStatusSet(apiVer, iotId, orderId string, status int) (res response.CloudStorageOrderGetResponse)

CloudStorageStatusSet 设置用户的云存储套餐状态

func (*SyncApiClient) CloudStorageTransfer

func (c *SyncApiClient) CloudStorageTransfer(apiVer, srcIotId, srcOrderId, dstIotId string, enableDefaultPlan, immediateUse bool) (res response.CloudStorageTransferResponse)

CloudStorageTransfer 调用该接口将用户已购买的云存储套餐转移。当前仅支持将云存储套餐从同一个管理员账号下的一个设备转移到另一个设备。

func (*SyncApiClient) CloudThingProduct

func (c *SyncApiClient) CloudThingProduct(apiVer, productKey string) (res response.ProductResponse)

CloudThingProduct 调用该接口查询指定产品的详细信息

func (*SyncApiClient) CloudThingProductList

func (c *SyncApiClient) CloudThingProductList(apiVer string, pageNo, pageSize int) (res response.ProductListResponse)

CloudThingProductList 调用该接口查询当前项目下的产品列表

func (*SyncApiClient) DeviceActivateDetailGet

func (c *SyncApiClient) DeviceActivateDetailGet(apiVer, projectId string, productKeys []string) (res response.DeviceActivateDetailGetResponse)

DeviceActivateDetailGet 调用该接口获取设备激活数据详细信息

func (*SyncApiClient) DeviceActivateSummaryGet

func (c *SyncApiClient) DeviceActivateSummaryGet(apiVer, projectId string, productKeys []string) (res response.DeviceActivateSummaryGetResponse)

func (*SyncApiClient) DeviceActiveDetailGet

func (c *SyncApiClient) DeviceActiveDetailGet(apiVer, projectId string, productKeys []string) (res response.DeviceActiveDetailGetResponse)

DeviceActiveDetailGet 调用该接口获取活跃设备的详细信息

func (*SyncApiClient) DeviceActiveSummaryGet

func (c *SyncApiClient) DeviceActiveSummaryGet(apiVer, projectId string, productKeys []string) (res response.DeviceActiveSummaryGetResponse)

DeviceActiveSummaryGet 调用该接口获取活跃设备的概览信息

func (*SyncApiClient) DeviceApplyQuery

func (c *SyncApiClient) DeviceApplyQuery(apiVer, applyId string, pageNo, pageSize int) (res response.DeviceApplyQueryResponse)

DeviceApplyQuery 根据批次ID查询设备证书列表

func (*SyncApiClient) DeviceCustomizedmessageNotify

func (c *SyncApiClient) DeviceCustomizedmessageNotify(apiVer, productKey, deviceName, iotId string,
	messageContent map[string]interface{}) (res response.DeviceCustomizemessageNotifyResponse)

DeviceCustomizedmessageNotify 向指定设备发送自定义消息

func (*SyncApiClient) DeviceNameUpload

func (c *SyncApiClient) DeviceNameUpload(apiVer, productKey string, deviceNames []string) (res response.DeviceNameUploadResponse)

DeviceNameUpload 创建量产批次接口(用户上传设备名称方式)

func (*SyncApiClient) DeviceQueryByUser

func (c *SyncApiClient) DeviceQueryByUser(apiVer, openId, openIdAppKey, identifyId string,
	limit, offset int) (res response.DeviceQueryByUserResponse)

DeviceQueryByUser 调用该接口获取用户绑定的设备列表详情,包括设备详情。通过设置不同的偏移量来查询任意部分的记录,暂不提供总条数查询。

func (*SyncApiClient) DeviceRegionDistribute

func (c *SyncApiClient) DeviceRegionDistribute(apiVer, productKey string, deviceNames []string,
	bindingCheck, pushDeviceRegionSwitch bool) (res response.DeviceRegionDistributeResponse)

DeviceRegionDistribute 调用该接口批量把设备迁移到当前region。

func (*SyncApiClient) DeviceRegionGet

func (c *SyncApiClient) DeviceRegionGet(apiVer, productKey, deviceName string) (res response.DeviceRegionGetResponse)

DeviceRegionGet 获取设备当前所在的站点

func (*SyncApiClient) DeviceSubdeviceQuery

func (c *SyncApiClient) DeviceSubdeviceQuery(apiVer, productKey, deviceName, iotId string, pageNo, pageSize int) (res response.DeviceSubdeviceQueryResponse)

DeviceSubdeviceQuery 调用该接口提供根据网关设备ID查询子设备列表。

func (*SyncApiClient) FreeCloudStorageConsume

func (c *SyncApiClient) FreeCloudStorageConsume(apiVer, iotId string, enableDefaultPlan, immediateUse bool,
	preRecordDuration, recordDuration, quota int, eventRecordProlong bool) (res response.FreeCloudStorageConsumeResponse)

FreeCloudStorageConsume 调用该接口领取免费的云存储套餐

func (*SyncApiClient) FreeCloudStorageEnable

func (c *SyncApiClient) FreeCloudStorageEnable(apiVer, iotId string) (res response.FreeCloudStorageEnableResponse)

FreeCloudStorageEnable 调用该接口设置免费云存储套餐立即生效。

func (*SyncApiClient) FreeCloudStorageGet

func (c *SyncApiClient) FreeCloudStorageGet(apiVer, iotId string) (res response.FreeCloudStorageGetResponse)

FreeCloudStorageGet 调用该接口查询免费的云存储套餐详情

func (*SyncApiClient) FreeCloudStorageStatusSet

func (c *SyncApiClient) FreeCloudStorageStatusSet(apiVer, iotId string, status int) (res response.FreeCloudStorageStatusSetResponse)

FreeCloudStorageStatusSet 调用该接口设置用户的免费云存储套餐状态

func (*SyncApiClient) FreeStorageQuotaCheck

func (c *SyncApiClient) FreeStorageQuotaCheck(apiVer, iotId string) (res response.CommonResponse)

FreeStorageQuotaCheck 调用该接口检查设备是否可以领用免费云存储。用户绑定设备正常使用过程中,只能领用一次;考虑到退换货的情形,一个设备最多支持被3个用户绑定领用免费云存。

func (*SyncApiClient) NameDeviceGenerate

func (c *SyncApiClient) NameDeviceGenerate(apiVer, productKey, batchId string) (res response.NameDeviceGenerateResponse)

NameDeviceGenerate 根据量产批次ID生成设备证书 调用该接口根据批次ID(batchId)生成设备证书信息。在调用该接口前请确保已调用/cloud/device/name/upload接口,通过主动上传要量产设备的名称信息,获取量产的批次ID。

func (*SyncApiClient) OpenIdGetByIdentifyId

func (c *SyncApiClient) OpenIdGetByIdentifyId(apiVer, identityId, openIdAppKey string) (res response.CommonResponse)

OpenIdGetByIdentifyId 根据身份ID获取第三方Openid

func (*SyncApiClient) PostBody

func (c *SyncApiClient) PostBody(path string, req request.Request) (body []byte, errMsg *error2.ErrorMsg)

PostBody *

  • @Author dongjs
  • @Description //发送请求
  • @Date 10:39 2022/5/24
  • @Param
  • @return *

func (*SyncApiClient) ProductList

func (c *SyncApiClient) ProductList(apiVer string, pageNo, pageSize int) (res response.ProjectListResponse)

ProductList 带分页查询项目信息列表

func (*SyncApiClient) ProductNvrDeviceCertQuery

func (c *SyncApiClient) ProductNvrDeviceCertQuery(apiVer, productKey, batchId string, pageNo, pageSize int) (res response.ProductNvrDeviceCertQueryResponse)

ProductNvrDeviceCertQuery 根据批次ID查询设备证书列表(NVR产品专用)

func (*SyncApiClient) ProductNvrDeviceGenerate

func (c *SyncApiClient) ProductNvrDeviceGenerate(apiVer, productKey string, amount int64) (res response.ProductNvrDeviceGenerateResponse)

ProductNvrDeviceGenerate 获取量产批次ID(NVR产品专用)

func (*SyncApiClient) StreamingCommodityQuery

func (c *SyncApiClient) StreamingCommodityQuery(apiVer string) (res response.StreamingCommodityQueryResponse)

StreamingCommodityQuery 调用该接口查询直播分享套餐列表

func (*SyncApiClient) StreamingOrderCreate

func (c *SyncApiClient) StreamingOrderCreate(apiVer, iotId, commodityCode, userName, userId string, copies int,
	immediateUse bool) (res response.StreamingOrderCreateResponse)

StreamingOrderCreate 调用该接口创建直播分享套餐订单

func (*SyncApiClient) StreamingOrderEnable

func (c *SyncApiClient) StreamingOrderEnable(apiVer, iotId, orderId string) (res response.StreamingOrderEnable)

StreamingOrderEnable 调用该接口使直播分享套餐订单立即生效

func (*SyncApiClient) StreamingOrderGet

func (c *SyncApiClient) StreamingOrderGet(apiVer, iotId, orderId string) (res response.StreamingOrderGetResponse)

StreamingOrderGet 调用该接口查询直播分享套餐订单

func (*SyncApiClient) StreamingOrderPay

func (c *SyncApiClient) StreamingOrderPay(apiVer, iotId, orderId string) (res response.StreamingOrderPayResponse)

StreamingOrderPay 调用该接口支付直播分享套餐订单。

func (*SyncApiClient) StreamingOrderQuery

func (c *SyncApiClient) StreamingOrderQuery(apiVer, iotId string, pageNo, pageSize int) (res response.StreamingOrderQueryResponse)

StreamingOrderQuery 调用该接口查询直播分享套餐订单列表。

func (*SyncApiClient) ThingEventTimelineGet

func (c *SyncApiClient) ThingEventTimelineGet(apiVer, productKey, deviceName, iotId, identifier, eventType string,
	start, end int64, pageSize int, ordered bool) (res response.ThingEventTimelineGetResponse)

ThingEventTimelineGet 获取物的事件timeline数据

func (*SyncApiClient) ThingInfoGet

func (c *SyncApiClient) ThingInfoGet(apiVer, iotId, productKey, deviceName string) (res response.ThingInfoGetResponse)

ThingInfoGet 获取物的基本信息

func (*SyncApiClient) ThingPropertiesGet

func (c *SyncApiClient) ThingPropertiesGet(apiVer, iotId, productKey, deviceName string) (res response.ThingPropertiesGetResponse)

ThingPropertiesGet 调用该接口获取物的所有属性快照数据

func (*SyncApiClient) ThingPropertiesSet

func (c *SyncApiClient) ThingPropertiesSet(apiVer, iotId, productKey, deviceName string, items map[string]interface{}) (res response.CommonResponse)

ThingPropertiesSet 设置物的属性

func (*SyncApiClient) ThingPropertyTimelineGet

func (c *SyncApiClient) ThingPropertyTimelineGet(apiVer, productKey, deviceName, iotId, identifier string,
	start, end int64, pageSize int, ordered bool) (res response.ThingPropertyTimelineGetResponse)

ThingPropertyTimelineGet 获取物的属性timeline数据

func (*SyncApiClient) ThingServiceInvoke

func (c *SyncApiClient) ThingServiceInvoke(apiVer, iotId, productKey, deviceName, identifier string, args map[string]interface{}) (res response.CommonResponse)

ThingServiceInvoke 调用该接口触发物的服务

func (*SyncApiClient) ThingStatusGet

func (c *SyncApiClient) ThingStatusGet(apiVer, iotId, productKey, deviceName string) (res response.ThingStatusGetResponse)

ThingStatusGet 调用该接口获取物的连接状态

func (*SyncApiClient) ThingTslGet

func (c *SyncApiClient) ThingTslGet(apiVer, iotId, productKey, deviceName string) (res map[string]interface{})

ThingTslGet 调用该接口获取物的TSL功能模板,包含属性、事件、服务的定义

func (*SyncApiClient) ThingsGet

func (c *SyncApiClient) ThingsGet(apiVer, productKey string, status, currentPage, pageSize int) (res response.ThingsGetResponse)

ThingsGet 批量获取物的列表

func (*SyncApiClient) TokenGet

func (c *SyncApiClient) TokenGet(apiVer, projectId string) (res response.TokenResponse)

TokenGet 调用该接口获取云端资源Token。该接口对于同一个res,在Token失效前仅需调用一次。如果再次调用,会生成新的cloudToken,并导致之前的cloudToken失效。

func (*SyncApiClient) TokenRefresh

func (c *SyncApiClient) TokenRefresh(apiVer, cloudToken string) (res response.TokenResponse)

TokenRefresh 调用该接口刷新云端资源的Token。

func (*SyncApiClient) UserActivateDetailGet

func (c *SyncApiClient) UserActivateDetailGet(apiVer, projectId string) (res response.UserActivateDetailGetResponse)

UserActivateDetailGet 调用该接口获取注册用户详细信息

func (*SyncApiClient) UserActivateSummaryGet

func (c *SyncApiClient) UserActivateSummaryGet(apiVer, projectId string) (res response.UserActivateSummaryGetResponse)

UserActivateSummaryGet 调用该接口获取注册用户概况信息

func (*SyncApiClient) UserActiveDetailGet

func (c *SyncApiClient) UserActiveDetailGet(apiVer, projectId string) (res response.UserActiveDetailGetResponse)

UserActiveDetailGet 调用该接口获取活跃用户的详细信息

func (*SyncApiClient) UserActiveSummaryGet

func (c *SyncApiClient) UserActiveSummaryGet(apiVer, projectId string) (res response.UserActiveSummaryGetResponse)

UserActiveSummaryGet 调用该接口获取活跃用户的概括信息

func (*SyncApiClient) UserBindingDeviceBatchBind

func (c *SyncApiClient) UserBindingDeviceBatchBind(apiVer, openId, openIdAppKey, identityId,
	projectId string, deviceList []map[string]string) (res response.UserBindingDeviceBatchBindResponse)

UserBindingDeviceBatchBind 批量绑定设备

func (*SyncApiClient) UserBindingDeviceUnbind

func (c *SyncApiClient) UserBindingDeviceUnbind(apiVer, iotId, productKey, deviceName string) (res response.CommonResponse)

UserBindingDeviceUnbind 调用该接口强制解除指定设备上所有绑定的关系

func (*SyncApiClient) UserDeviceBindingQuery

func (c *SyncApiClient) UserDeviceBindingQuery(apiVer, iotId string, pageNo, pageSize int) (res response.UserDeviceBindingQueryResponse)

UserDeviceBindingQuery 调用该接口根据设备ID查询该设备上所有绑定的账户

func (*SyncApiClient) UserDeviceUnbind

func (c *SyncApiClient) UserDeviceUnbind(apiVer, openId, openIdAppKey, iotId, identifyId,
	productKey, deviceName string) (res response.CommonResponse)

UserDeviceUnbind 解绑用户和设备

func (*SyncApiClient) UserRegionGet

func (c *SyncApiClient) UserRegionGet(apiVer, phone, phoneLocationCode, email, openId string) (res response.CommonResponse)

UserRegionGet 调用该接口获取用户注册所在的区域,这个区域注册之后不会变动,除非用户注销重新注册。

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL