英文:
How to set the fields parameter in a Google Drive Go API call?
问题
如在https://developers.google.com/drive/web/performance#partial-response中所解释的那样,可以通过设置HTTP请求的"fields"参数来获取仅包含显式请求字段的部分响应。有很多示例展示了如何在Python等语言中实现这一点,但我找不到使用Go API的任何相关内容。FilesListCall类型没有允许这样做的方法,我也找不到通过Go API发送HTTP请求的其他方法。
是否有任何方法可以实现这一点,或者我们是否被迫传输大量不需要的数据?
英文:
As explained on
https://developers.google.com/drive/web/performance#partial-response
Once can set the "fields" parameter of an HTTP request to obtain a partial response containing only the fields explicitly requested. There are many examples on how to do this in languages like Python, but I could not find anything using the Go API. The FilesListCall type has no method that allows to do this, and I also cannot find any other way to tweak the HTTP request send by the Go API.
Is there a way to do this at all, or am we condamned to transfer large amounts of unneeded data?
答案1
得分: 1
根据Intermernet的解释,当我提出问题时,该功能只是没有被实现。然而,在对已打开的功能请求发表评论后,一位Google工程师立即实现了它:
http://godoc.org/code.google.com/p/google-api-go-client/googleapi#Field
感谢Google对这个非常需要的功能做出的快速反应!
英文:
As Intermernet explained, the feature was just not implemented when I asked the question. However, after posting a comment on the opened feature request, a Google engineer immediatly implemented it:
http://godoc.org/code.google.com/p/google-api-go-client/googleapi#Field
Thanks to Google for the quick reaction on this much needed feature!
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论