我不确定这是解决此类问题的正确位置,如果不是,请指出正确的方向 - 谢谢。
在许多不同的地方搜索了很多之后,我认为你是我最后的希望:)
我使用了Google Drive API V3 快速入门示例,并且可以正常工作,但是我有一些顾虑。
我想知道如果谷歌通过com.google.api.services.drive.model.File
在我调用不同的方法(如getId()
og getName()
)以从我的文件中获取我需要的信息时添加新功能来更改 API 会发生什么。请参阅下面示例中的最后一个System.out.printf()
。
示例代码:
...
public static void main(String[] args) throws IOException {
// Build a new authorized API client service.
Drive service = getDriveService();
// Print the names and IDs for up to 10 files.
FileList result = service.files().list()
.setPageSize(10)
.setFields("nextPageToken, files(id, name)")
.execute();
List<File> files = result.getFiles();
if (files == null || files.size() == 0) {
System.out.println("No files found.");
} else {
System.out.println("Files:");
for (File file : files) {
System.out.printf("%s (%s)\n", file.getName(), file.getId());
}
}
}
....
类似的事情(向 API 添加新方法)会破坏代码吗?
我当然会使用任何相关的错误处理,但是我真的不想返回并更改代码中的某些内容,因为已经从第三方添加了新内容。
也许我要问的是如何“在幕后”处理 JSON 的转换,以及这个对话是否可以在不中断的情况下处理 JSON 代码的新成员。
也许 Google 永远不会改变任何东西,只是为我们提供新版本的 API
我确信谷歌已经想到了这一点,但这不是我的客户可以接受的论点:)
我非常感谢在这件事上的任何帮助。