0

I'm using the C# libraries to send a bundle. Right now, I'm sending multiple requests which causes Glass to ding several times as the cards come in. I would like to batch these requests like in the question (link below) that was answered for Java Mirror API libraries. I can't find an equivalent solution in the C# libraries. Here's the original question for Java How do I send bundled cards all at the same time?

Here's my current code

TimelineItem bundleCover = Utils.GetBundleCard(bundleId);

Stream stream = null;
if (!String.IsNullOrEmpty(Config.BUNDLE_MEDIA_LINK))
{
  if (Config.BUNDLE_MEDIA_LINK.StartsWith("/"))
  {
    stream = new StreamReader(Server.MapPath(Config.BUNDLE_MEDIA_LINK)).BaseStream;
  }
  else
  {
    HttpWebRequest request = WebRequest.Create(Config.BUNDLE_MEDIA_LINK) as HttpWebRequest;
    HttpWebResponse response = request.GetResponse() as HttpWebResponse;
    stream = response.GetResponseStream();
  }
}

List<TimelineItem> timelineItems = Utils.GetSlideCards(presentation, bundleId);

foreach (TimelineItem tli in timelineItems)
{
  Service.Timeline.Insert(tli).Fetch();
}

// Send the bundle and attachment last            
Service.Timeline.Insert(bundleCover, stream, "image/jpeg").Upload();

Any help would be greatly appreciated.

Community
  • 1
  • 1
Fat Russell
  • 196
  • 9

1 Answers1

2

Batch requests might not be supported by the .NET client library: it is best to file a feature request on their project site to follow-up on this.

Regarding notification, I would suggest to set notification only on the last card instead of each single cards: this will make Glass dings only when the last card of the bundle is inserted.

Alain
  • 6,044
  • 21
  • 27