<p>Hey everybody, we've been working on a <a href="https://github.com/bandwidthcom/go-bandwidth" rel="nofollow">Go SDK</a> recently for our <a href="http://ap.bandwidth.com/?utm_medium=social&utm_source=reddit&utm_campaign=dtolb&utm_content=_" rel="nofollow">API</a> , TelCo API: sending SMS, making phone calls, etc..)</p>
<p>It's not 100% complete yet, but I'd like to get feedback from you all before the official release:</p>
<p><a href="https://github.com/bandwidthcom/go-bandwidth" rel="nofollow">Bandwidth Go SDK</a></p>
<p>If you need/want an account to test, just PM me with your email (after signing up) and I'll hook you up with a few dollars to play around. We're still in limited signups, so I will have to approve your account.</p>
<p>Thanks everybody :)</p>
<hr/>**评论:**<br/><br/>oefig: <pre><p>I didn't get a chance to dive see into it but from my first impression I'm a bit wary of every response being returned <code>map[string]interface{}</code>. Usually they're marshaled into a struct like so an end user (like me) can use the data with type safety.</p></pre>skarlso: <pre><p>Like <a href="/u/oefig" rel="nofollow">/u/oefig</a> said, retuning a map of interface types is really bad. </p>
<p>Also your switch case on interface type shows me that you aren't using types the way they should be. I'm talking about this bit:</p>
<pre><code> switch body.(type) {
case []interface{}:
</code></pre>
<p>Re-think your types and abstractions and re-write accordingly. Tight now you are converting needlessly in a lot of places and because of that it's hard to follow what you are actually trying to do. </p></pre>sethammons: <pre><p>I did not look too deep. One first thought is that by reading the readme, I'm not sure what to really expect from the package or your service nor how to use it. Second thought, being that you have client code, I'd expect some (all?) tests to be using <code>package bandwidth_test</code>. This package can exist in the current namespace, but prevents your test from accessing non-exported methods. This will also give people a better understanding of how to use the package. And I agree with <a href="/u/eofig" rel="nofollow">/u/eofig</a>, have exported structs that we can use and avoid <code>map[string]interface{}</code>.</p></pre>luckyleprechaun98: <pre><p>Take a look at the Stripe Go SDK for examples of how you can export your API responses as a struct. For example, look at card.go and you'll see they have a struct with types for each field and they use tags to define how it marshals/unmarshals to json. That's how you want to build your API.</p>
<p><a href="https://github.com/stripe/stripe-go" rel="nofollow">https://github.com/stripe/stripe-go</a></p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传