Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

从没见过这么难用的官方SDK #58

Open
NicoChenyt opened this issue Feb 16, 2023 · 2 comments
Open

从没见过这么难用的官方SDK #58

NicoChenyt opened this issue Feb 16, 2023 · 2 comments

Comments

@NicoChenyt
Copy link

想接入钉钉开放平台,结果你们那sdk真的是想给用户使用的吗?所有代码都是自动生成,根本不知道有哪些接口,想通过接口文档找到sdk里的代码都很费劲,调用更费劲

@zmou
Copy link

zmou commented Aug 9, 2023

就是啊,真他妈恶心

@pobearm
Copy link

pobearm commented Aug 16, 2023

是不是机器生生成的golang代码啊, 从C翻译过来的? 好恶心的指针用法.
每个对象, 甚至值都是指针, 为了安全使用不会因为空指针而panic, 你的不停的判断nil.
要吐了!!!!!!

        client, err := iot.NewClient(a.config)
	if err != nil {
		return nil, err
	}
	regReq := &iot.RegisterDeviceRequest{
		IotInstanceId: &a.InstanceId,
		ProductKey:    &a.ProductKey,
		DeviceName:    &deviceNum,
		Nickname:      &nickName,
	}
	resp, err := client.RegisterDevice(regReq)
	if err != nil {
		return nil, err
	}
	if resp != nil && resp.Body != nil && resp.Body.Success != nil && !*resp.Body.Success {
		return nil, errors.New("reg device failed")
	}
	info := &DeviceInfo{}
	if resp != nil && resp.Body != nil && resp.Body.Data != nil {
		info.DeviceName = *resp.Body.Data.DeviceName
		info.DeviceSecret = *resp.Body.Data.DeviceSecret
		info.ProductKey = *resp.Body.Data.ProductKey
		info.IotId = *resp.Body.Data.IotId
	}
	return info, nil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants