CHJani / google-api-java-client

Automatically exported from code.google.com/p/google-api-java-client
0 stars 0 forks source link

ApiClient.setFields() doesn't do anything #296

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Version of google-api-java-client (e.g. 1.5.0-beta)?

Code generator version 1.2.2-beta

Java environment (e.g. Java 6, Android 2.3, App Engine)?

All

Describe the problem.

This code snippet:

    plus.setFields("id");
    Person profile = plus.people().get("me").execute();
    System.out.println("ID: " + profile.getId());
    System.out.println("Name: " + profile.getDisplayName());
    System.out.println("Image Url: " + profile.getImage().getUrl());
    System.out.println("Profile Url: " + profile.getUrl());

Prints:

ID: 112550920411899420633
Name: I/O 2010 Buzz Demo Account
Image URL: http://www.google.com/friendconnect/scs/images/NoPictureDark65.jpg
Profile URL: https://profiles.google.com/112550920411899420633

How would you expect it to be fixed?

The problem is that Plus.setFields() doesn't actually set the fields.  
Unfortunately we need to call RemoteRequest.setFields whenever we create a new 
remote request.  We will design this better with the next release of the 
service-specific generator.

See:

http://javadoc.google-api-java-client.googlecode.com/hg/apis/plus/v1/com/google/
api/services/plus/Plus.html#setFields(java.lang.String)

This reported for the Google+ API here:

http://code.google.com/p/google-plus-platform/issues/detail?id=6

Original issue reported on code.google.com by yan...@google.com on 20 Sep 2011 at 1:21

GoogleCodeExporter commented 9 years ago
Version 1.2.2-beta of the code generator has been released. This version 
contains the fix for this bug.

Fix description:
The fields of the RemoteRequest are now initialized to the fields of the API.

Mavenrepo and javadoc repositories have been updated with the new version:
http://codereview.appspot.com/5079045/
http://codereview.appspot.com/5080048/

APIs.wiki has also been updated to point to 1.2.2-beta:
http://code.google.com/p/google-api-java-client/wiki/APIs

Original comment by rmis...@google.com on 21 Sep 2011 at 5:00

GoogleCodeExporter commented 9 years ago
Rmis, I have currently:

 google-api-client-1.5.jar
 google-http-client-1.5.jar
 google-oauth-client-1.5.jar

Where do I download?

 google-api-client-1.2.2-beta.jar
 google-http-client-1.2.2-beta.jar
 google-oauth-client-1.2.2-beta.jar

Original comment by m0.inter...@gmail.com on 29 Sep 2011 at 6:39

GoogleCodeExporter commented 9 years ago
I didn't see plusapi.jar in my lib folder, I replaced them, sorry for the noise.

Original comment by m0.inter...@gmail.com on 29 Sep 2011 at 7:20

GoogleCodeExporter commented 9 years ago
This seems to break #51 URLs are not recognizable in partials.

Original comment by m0.inter...@gmail.com on 29 Sep 2011 at 7:29

GoogleCodeExporter commented 9 years ago
The referenced issue is:
http://code.google.com/p/google-plus-platform/issues/detail?id=51

But as stated in that issue report, ApiClient.setFields() is doing its intended 
behavior.  The issue is that the server is apparently not returning the correct 
response.

Original comment by yan...@google.com on 3 Oct 2011 at 12:30