谷歌眼镜Mirror API Timeline之delete方法

原文地址:http://bbs.seacat.cn/thread-892-1-1.html


Timeline: delete删除一个时间轴项目。


请求


HTTP 请求


[html] view plain copy 在CODE上查看代码片 派生到我的代码片
  1. DELETE [url=https://www.googleapis.com/mirror/v1/timeline/id]https://www.googleapis.com/mirror/v1/timeline/id[/url]  


参数
[td]

参数名 描述
Path parameters
id string 这个timeline item的id

授权



这个请求需要授权以下范围的至少有一个(阅读更多关于身份验证和授权read more about authentication and authorization)


Scope
https://www.googleapis.com/auth/Glass.timeline
https://www.googleapis.com/auth/glass.location

请求体
如果成功的话,这个方法返回一个空的响应体


例子
注意:这个方法可用的代码示例并不代表所有编程语言都支持



Java:

使用Java client library


[java] view plain copy 在CODE上查看代码片 派生到我的代码片
  1. import com.google.api.services.mirror.Mirror;  

  2. import java.io.IOException;  

  3. publicclass MyClass {  

  4. // ...

  5. /**

  6.   * Delete a timeline item.

  7.   *

  8.   * @param service Authorized Mirror service.

  9.   * @param itemId ID of the timeline item to delete.

  10.   */

  11. publicstaticvoid deleteTimelineItem(Mirror service, String itemId) {  

  12. try {  

  13.      service.timeline().delete(itemId).execute();  

  14.    } catch (IOException e) {  

  15.      System.err.println("An error occurred: " + e);  

  16.    }  

  17.  }  

  18. // ...

  19. }  





.NET
使用 .NET client library


[vb] view plain copy 在CODE上查看代码片 派生到我的代码片
  1. using System;  

  2. using Google.Apis.Mirror.v1;  

  3. public class MyClass {  

  4.  // ...  

  5.  /// <summary>  

  6.  /// Delete a timeline item.  

  7.  /// </summary>  

  8.  /// <param name='service'>Authorized Mirror service.</param>

  9.  /// <param name='itemId'>ID of the timeline item to delete.</param>

  10.  public static void DeleteTimelineItem(MirrorService service,  

  11. String itemId) {  

  12.    try {  

  13.      service.Timeline.Delete(itemId).Fetch();  

  14.    } catch (Exception e) {  

  15.      Console.WriteLine("An exception occurred: " + e.Message);  

  16.    }  

  17.  }  

  18.  // ...  

  19. }  





PHP
使用PHP client library


[php] view plain copy 在CODE上查看代码片 派生到我的代码片
  1. /**

  2. * Delete a timeline item.

  3. *

  4. * @param Google_MirrorService $service Authorized Mirror service.

  5. * @param string $itemId ID of the timeline item to delete.

  6. */

  7. function deleteTimelineItem($service, $itemId) {  

  8.  try {  

  9. $service->timeline->delete($itemId);  

  10.  } catch (Exception $e) {  

  11.    print 'An error occurred: ' . $e->getMessage();  

  12.  }  

  13. }  





Python
使用 Python client library

[python] view plain copy 在CODE上查看代码片 派生到我的代码片
  1. from apiclient import errors  

  2. # ...

  3. def delete_timeline_item(service, item_id):  

  4. """Delete a timeline item.

  5.  Args:

  6.    service: Authorized Mirror service.

  7.    item_id: ID of the timeline item to delete.

  8.  """

  9. try:  

  10.    service.timeline().delete(id=item_id).execute()  

  11. except errors.HttpError, e:  

  12. print'An error occurred: %s' % error  






Ruby
使用Ruby client library


[ruby] view plain copy 在CODE上查看代码片 派生到我的代码片
  1. ##

  2. # Delete a Timeline Item.

  3. #

  4. # @param [Google::APIClient] client

  5. #   Authorized client instance.

  6. # @param [string] item_id

  7. #   ID of the timeline item to delete.

  8. # @return nil

  9. def delete_timeline_item(client, item_id)  

  10.  mirror = client.discovered_api('mirror', 'v1')  

  11.  result = client.execute(  

  12. :api_method => mirror.timeline.delete,  

  13. :parameters => { 'id' => item_id })  

  14. if result.error?  

  15.    puts "An error occurred: #{result.data['error']['message']}"

  16. end

  17. end






Go

使用 Go client library

[plain] view plain copy 在CODE上查看代码片 派生到我的代码片
  1. import (  

  2.        "code.google.com/p/google-api-go-client/mirror/v1"  

  3.        "fmt"  

  4. )  

  5. // DeleteTimelineItem deletes a timeline item.  

  6. func DeleteTimelineItem(g *mirror.Service, itemId string) error {  

  7.        err := g.Timeline.Delete(itemId).Do()  

  8.        if err != nil {  

  9.                fmt.Printf("An error occurred: %v\n", err)  

  10.        }  

  11.        return err  

  12. }  





Raw HTTP
使用 Raw HTTP client library


[plain] view plain copy 在CODE上查看代码片 派生到我的代码片
  1. DELETE /mirror/v1/timeline/timeline item id HTTP/1.1  

  2. Host: [url=http://www.googleapis.com]www.googleapis.com[/url]  

  3. Authorization: Bearer auth token  



你可能感兴趣的:(编程语言,谷歌,about,眼镜)