nicolas2k / google-glass-api

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

The method execute() is undefined for the type Mirror.Timeline.Get #358

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create an Android project with the code shown below
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
Google Glass (ICS) + Eclipse 3.7 + OS X

Please provide any additional information below.
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;

import com.google.api.services.mirror.Mirror;
import com.google.api.services.mirror.model.Attachment;
import com.google.api.services.mirror.model.Contact;
import com.google.api.services.mirror.model.NotificationConfig;
import com.google.api.services.mirror.model.TimelineItem;

import java.io.IOException;

public class GetTimelineItem extends Activity
{  
// original code:
// https://developers.google.com/glass/v1/reference/timeline/get
// error message:
// The method execute() is undefined for the type Mirror.Timeline.Get

   @Override
   protected void onCreate(Bundle savedInstanceState)
   {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
   }

  /**
   * Print some timeline item metadata information.
   *   
   * @param service Authorized Mirror service.
   * @param itemId ID of the timeline item to print metadata information for.
   */
  public static void printTimelineItemMetadata(Mirror service, String itemId)
  {
    try {
      TimelineItem timelineItem = service.timeline().get(itemId).execute();

      System.out.println("Timeline item ID: " + timelineItem.getId());
      if (timelineItem.getIsDeleted()) {
        System.out.println("Timeline item has been deleted");
      } else {
        Contact creator = timelineItem.getCreator();

        if (creator != null) {
          System.out.println("Timeline item created by " + creator.getDisplayName());

        }

        System.out.println("Timeline item created on " + timelineItem.getCreated().toStringRfc3339());

        System.out.println("Timeline item displayed on "
            + timelineItem.getDisplayTime().toStringRfc3339());

        String inReplyTo = timelineItem.getInReplyTo();
        if (inReplyTo != null && inReplyTo.length() > 0) {
          System.out.println("Timeline item is a reply to " + inReplyTo);
        }

        String text = timelineItem.getText();
        if (text != null && text.length() > 0) {
          System.out.println("Timeline item has text: " + text);
        }

        for (Contact contact : timelineItem.getRecipients()) {
          System.out.println("Timeline item is shared with: " + contact.getId());
        }

        NotificationConfig notification = timelineItem.getNotification();
        if (notification != null) {
          System.out.println("Notification delivery time: "
              + notification.getDeliveryTime().toStringRfc3339());
          System.out.println("Notification level: " + notification.getLevel());
        }

        // See mirror.timeline.attachments.get to learn how to download the attachment's content.
        for (Attachment attachment : timelineItem.getAttachments()) {
          System.out.println("Attachment ID: " + attachment.getId());
          System.out.println("  > Content-Type: " + attachment.getContentType());
        }
      }
    } catch (IOException e) {
      System.err.println("An error occurred: " + e);
    }

   @Override
   public boolean onCreateOptionsMenu(Menu menu)
   {
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
   }
}

Original issue reported on code.google.com by ocampes...@gmail.com on 11 Jan 2014 at 9:31

GoogleCodeExporter commented 8 years ago

Original comment by ala...@google.com on 13 Jan 2014 at 6:00