Subscriptions: delete

승인 필요

구독을 삭제합니다. 예를 참조하세요.

요청

HTTP 요청

DELETE https://www.googleapis.com/mirror/v1/subscriptions/id

매개변수

매개변수 이름 설명
경로 매개변수
id string 정기 결제의 ID입니다.

확인할 내용

이 요청을 처리하려면 다음 범위의 승인을 받아야 합니다(인증 및 승인 자세히 알아보기).

범위
https://www.googleapis.com/auth/glass.timeline

요청 본문

이 메소드를 사용할 때는 요청 본문을 제공하지 마세요.

응답

요청에 성공한 경우 이 메소드는 빈 응답 본문을 반환합니다.

참고: 이 메서드에 제공되는 코드 예시가 지원되는 모든 프로그래밍 언어를 나타내는 것은 아닙니다. 지원되는 언어 목록은 클라이언트 라이브러리 페이지를 참조하세요.

자바

자바 클라이언트 라이브러리를 사용합니다.

import com.google.api.services.mirror.Mirror;

import java.io.IOException;

public class MyClass {
  // ...

  /**
   * Delete a subscription to a collection.
   * 
   * @param service Authorized Mirror service.
   * @param collection Collection to unsubscribe from (supported values are
   *        "timeline" and "locations").
   */
  public static void unsubscribeFromNotifications(Mirror service, String collection) {
    try {
      service.subscriptions().delete(collection).execute();
    } catch (IOException e) {
      System.err.println("An error occurred: " + e);
    }
  }

  // ...
}

.NET

.NET 클라이언트 라이브러리를 사용합니다.

using System;

using Google.Apis.Mirror.v1;

public class MyClass {
  // ...

  /// <summary>
  /// Delete a subscription to a collection.
  /// </summary>
  /// <param name='service'>Authorized Mirror service.</param>
  /// <param name='collection'>
  /// Collection to unsubscribe from (supported values are "timeline" and
  /// "locations").
  /// </param>
  public static void UnsubscribeFromNotifications(MirrorService service,
      String collection) {
    try {
      service.Subscriptions.Delete(collection).Fetch();
    } catch (Exception e) {
      Console.WriteLine("An error occurred: " + e.Message);
    }
  }

  // ...
}

PHP

PHP 클라이언트 라이브러리를 사용합니다.

/**
 * Delete a subscription to a collection.
 *
 * @param Google_MirrorService $service Authorized Mirror service.
 * @param string $collection Collection to unsubscribe from (supported values
 *                           are "timeline" and "locations").
 */
function unsubscribeFromNotifications($service, $collection) {
  try {
    $service->subscriptions->delete($collection);
  } catch (Exception $e) {
    print 'An error occurred: ' . $e->getMessage();
  }
}

Python

Python 클라이언트 라이브러리를 사용합니다.

from apiclient import errors
# ...

def unsubscribe_from_notifications(service, collection):
  """Delete a subscription to a collection.

  Args:
    service: Authorized Mirror service.
    collection: Collection to unsubscribe from (supported values are
                "timeline" and "locations"
  """
  try:
    service.subscriptions().delete(collection).execute()
  except errors.HttpError, error:
    print 'An error occurred: %s' % error

Ruby

Ruby 클라이언트 라이브러리를 사용합니다.

##
# Delete a subscription to a collection.
#
# @param [Google::APIClient] client
#   Authorized client instance.
# @param [String] collection
#   Collection to unsubscribe from (supported values are "timeline" and
#   "locations").
# @return nil
def unsubscribe_from_notifications(client, collection)
  mirror = client.discovered_api('mirror', 'v1')
  result = client.execute(
    :api_method => mirror.subscriptions.delete,
    :parameters => { 'id' => collection })
  if result.error?
    puts "An error occurred: #{result.data['error']['message']}"
  end
end

Go

Go 클라이언트 라이브러리 사용

import (
	"code.google.com/p/google-api-go-client/mirror/v1"
	"fmt"
)

// UnsubscribeFromNotifications deletes a subscription to a collection.
func UnsubscribeFromNotifications(g *mirror.Service, collection string) error {
	err := g.Subscriptions.Delete(collection).Do()
	if err != nil {
		fmt.Printf("An error occurred: %v\n", err)
		return err
	}
	return nil
}

원시 HTTP

클라이언트 라이브러리를 사용하지 않습니다.

DELETE /mirror/v1/subscriptions/timeline HTTP/1.1
Authorization: Bearer auth token