Locations: list

অনুমোদন প্রয়োজন

ব্যবহারকারীর জন্য অবস্থানের একটি তালিকা পুনরুদ্ধার করে। একটি উদাহরণ দেখুন

অনুরোধ

HTTP অনুরোধ

GET https://www.googleapis.com/mirror/v1/locations

অনুমোদন

এই অনুরোধের জন্য নিম্নলিখিত স্কোপের মধ্যে অন্তত একটির অনুমোদন প্রয়োজন ( প্রমাণিকরণ এবং অনুমোদন সম্পর্কে আরও পড়ুন )।

ব্যাপ্তি
https://www.googleapis.com/auth/glass.timeline
https://www.googleapis.com/auth/glass.location

শরীরের অনুরোধ

এই পদ্ধতির সাথে একটি অনুরোধ সংস্থা সরবরাহ করবেন না।

প্রতিক্রিয়া

সফল হলে, এই পদ্ধতিটি নিম্নলিখিত কাঠামো সহ একটি প্রতিক্রিয়া বডি প্রদান করে:

{
  "kind": "mirror#locationsList",
  "items": [
    locations Resource
  ]
}
সম্পত্তির নাম মান বর্ণনা মন্তব্য
kind string সম্পদের ধরন। এটি সর্বদা mirror#locationsList
items[] list অবস্থানের তালিকা.

উদাহরণ

দ্রষ্টব্য: এই পদ্ধতির জন্য উপলব্ধ কোড উদাহরণগুলি সমস্ত সমর্থিত প্রোগ্রামিং ভাষার প্রতিনিধিত্ব করে না (সমর্থিত ভাষার তালিকার জন্য ক্লায়েন্ট লাইব্রেরি পৃষ্ঠা দেখুন)।

জাভা

জাভা ক্লায়েন্ট লাইব্রেরি ব্যবহার করে।

import com.google.api.services.mirror.Mirror;
import com.google.api.services.mirror.model.Location;
import com.google.api.services.mirror.model.LocationsListResponse;

import java.io.IOException;

public class MyClass {
  // ...

  /**
   * Print information about all the known locations for the current user.
   * 
   * @param service Authorized Mirror service.
   */
  public static void printAllLocations(Mirror service) {
    try {
      LocationsListResponse locations = service.locations().list().execute();

      for (Location location : locations.getItems()) {
        System.out.println("Location recorded on: " + location.getTimestamp());
        System.out.println("  > Lat: " + location.getLatitude());
        System.out.println("  > Long: " + location.getLongitude());
        System.out.println("  > Accuracy: " + location.getAccuracy() + " meters");
      }
    } catch (IOException e) {
      System.err.println("An error occurred: " + e);
    }
  }

  // ...
}

.নেট

.NET ক্লায়েন্ট লাইব্রেরি ব্যবহার করে।

using System;
using Google.Apis.Mirror.v1;
using Google.Apis.Mirror.v1.Data;

public class MyClass {
  // ...

  /// <summary>
  /// Print information about all the known locations for the current user.
  /// </summary>
  /// <param name="service">Authorized Mirror service.</param>
  public static void PrintAllLocations(MirrorService service) {
    try {
      LocationsListResponse locations = service.Locations.List().Fetch();

      foreach (Location location in locations.Items) {
        Console.WriteLine("Location recorded on: " + location.Timestamp);
        Console.WriteLine("  > Lat: " + location.Latitude);
        Console.WriteLine("  > Long: " + location.Longitude);
        Console.WriteLine("  > Accuracy: " + location.Accuracy + " meters");
      }
    } catch (Exception e) {
      Console.WriteLine("An error occurred: " + e.Message);
    }
  }

  // ...
}

পিএইচপি

পিএইচপি ক্লায়েন্ট লাইব্রেরি ব্যবহার করে।

/**
 * Print information about all the known locations for the current user.
 *
 * @param Google_MirrorService $service Authorized Mirror service.
 */
function printAllLocations($service) {
  try {
    $locations = $service->locations->listLocations();

    foreach ($locations->getItems() as $location) {
      print 'Location recorded on: ' . $location->getTimestamp() . "\n";
      print '  > Lat: ' . $location->getLatitude() . "\n";
      print '  > Long: ' . $location->getLongitude() . "\n";
      print '  > Accuracy: ' . $location->getAccuracy() . " meters\n";
    }
  } catch (Exception $e) {
    print 'An error occurred: ' . $e->getMessage();
  }
}

পাইথন

পাইথন ক্লায়েন্ট লাইব্রেরি ব্যবহার করে।

from apiclient import errors
# ...

def print_all_locations(service):
  """Print information about all the known locations for the current user.

  Args:
    service: Authorized Mirror service.
  """
  try:
    location = service.locations().list().execute()

    for location in location.get('items', []):
      print 'Location recorded on: %s' % location.get('timestamp')
      print '  > Lat: %s' % location.get('latitude')
      print '  > Long: %s' % location.get('longitude')
      print '  > Accuracy: %s meters' % location.get('accuracy')
  except errors.HttpError, e:
    print 'An error occurred: %s' % e

রুবি

রুবি ক্লায়েন্ট লাইব্রেরি ব্যবহার করে।

##
# Print information about all the known locations for the current user.
#
# @param [Google::APIClient] client
#   Authorized client instance.
# @return nil
def print_all_locations(client)
  mirror = client.discovered_api('mirror', 'v1')
  result = client.execute(:api_method => mirror.locations.list)
  if result.success?
    locations = result.data
    locations.items.each do |location|
      puts "Location recorded on: #{location.timestamp}"
      puts "  > Lat: #{location.latitude}"
      puts "  > Long: #{location.longitude}"
      puts "  > Accuracy: #{location.accuracy} meters"
    end
  else
    puts "An error occurred: #{result.data['error']['message']}"
  end
end

কাঁচা HTTP

একটি ক্লায়েন্ট লাইব্রেরি ব্যবহার করে না।

GET /mirror/v1/locations HTTP/1.1
Host: www.googleapis.com
Authorization: Bearer auth token
,

অনুমোদন প্রয়োজন

ব্যবহারকারীর জন্য অবস্থানের একটি তালিকা পুনরুদ্ধার করে। একটি উদাহরণ দেখুন

অনুরোধ

HTTP অনুরোধ

GET https://www.googleapis.com/mirror/v1/locations

অনুমোদন

এই অনুরোধের জন্য নিম্নলিখিত স্কোপের মধ্যে অন্তত একটির অনুমোদন প্রয়োজন ( প্রমাণিকরণ এবং অনুমোদন সম্পর্কে আরও পড়ুন )।

ব্যাপ্তি
https://www.googleapis.com/auth/glass.timeline
https://www.googleapis.com/auth/glass.location

শরীরের অনুরোধ

এই পদ্ধতির সাথে একটি অনুরোধ সংস্থা সরবরাহ করবেন না।

প্রতিক্রিয়া

সফল হলে, এই পদ্ধতিটি নিম্নলিখিত কাঠামো সহ একটি প্রতিক্রিয়া বডি প্রদান করে:

{
  "kind": "mirror#locationsList",
  "items": [
    locations Resource
  ]
}
সম্পত্তির নাম মান বর্ণনা মন্তব্য
kind string সম্পদের ধরন। এটি সর্বদা mirror#locationsList
items[] list অবস্থানের তালিকা.

উদাহরণ

দ্রষ্টব্য: এই পদ্ধতির জন্য উপলব্ধ কোড উদাহরণগুলি সমস্ত সমর্থিত প্রোগ্রামিং ভাষার প্রতিনিধিত্ব করে না (সমর্থিত ভাষার তালিকার জন্য ক্লায়েন্ট লাইব্রেরি পৃষ্ঠা দেখুন)।

জাভা

জাভা ক্লায়েন্ট লাইব্রেরি ব্যবহার করে।

import com.google.api.services.mirror.Mirror;
import com.google.api.services.mirror.model.Location;
import com.google.api.services.mirror.model.LocationsListResponse;

import java.io.IOException;

public class MyClass {
  // ...

  /**
   * Print information about all the known locations for the current user.
   * 
   * @param service Authorized Mirror service.
   */
  public static void printAllLocations(Mirror service) {
    try {
      LocationsListResponse locations = service.locations().list().execute();

      for (Location location : locations.getItems()) {
        System.out.println("Location recorded on: " + location.getTimestamp());
        System.out.println("  > Lat: " + location.getLatitude());
        System.out.println("  > Long: " + location.getLongitude());
        System.out.println("  > Accuracy: " + location.getAccuracy() + " meters");
      }
    } catch (IOException e) {
      System.err.println("An error occurred: " + e);
    }
  }

  // ...
}

.নেট

.NET ক্লায়েন্ট লাইব্রেরি ব্যবহার করে।

using System;
using Google.Apis.Mirror.v1;
using Google.Apis.Mirror.v1.Data;

public class MyClass {
  // ...

  /// <summary>
  /// Print information about all the known locations for the current user.
  /// </summary>
  /// <param name="service">Authorized Mirror service.</param>
  public static void PrintAllLocations(MirrorService service) {
    try {
      LocationsListResponse locations = service.Locations.List().Fetch();

      foreach (Location location in locations.Items) {
        Console.WriteLine("Location recorded on: " + location.Timestamp);
        Console.WriteLine("  > Lat: " + location.Latitude);
        Console.WriteLine("  > Long: " + location.Longitude);
        Console.WriteLine("  > Accuracy: " + location.Accuracy + " meters");
      }
    } catch (Exception e) {
      Console.WriteLine("An error occurred: " + e.Message);
    }
  }

  // ...
}

পিএইচপি

পিএইচপি ক্লায়েন্ট লাইব্রেরি ব্যবহার করে।

/**
 * Print information about all the known locations for the current user.
 *
 * @param Google_MirrorService $service Authorized Mirror service.
 */
function printAllLocations($service) {
  try {
    $locations = $service->locations->listLocations();

    foreach ($locations->getItems() as $location) {
      print 'Location recorded on: ' . $location->getTimestamp() . "\n";
      print '  > Lat: ' . $location->getLatitude() . "\n";
      print '  > Long: ' . $location->getLongitude() . "\n";
      print '  > Accuracy: ' . $location->getAccuracy() . " meters\n";
    }
  } catch (Exception $e) {
    print 'An error occurred: ' . $e->getMessage();
  }
}

পাইথন

পাইথন ক্লায়েন্ট লাইব্রেরি ব্যবহার করে।

from apiclient import errors
# ...

def print_all_locations(service):
  """Print information about all the known locations for the current user.

  Args:
    service: Authorized Mirror service.
  """
  try:
    location = service.locations().list().execute()

    for location in location.get('items', []):
      print 'Location recorded on: %s' % location.get('timestamp')
      print '  > Lat: %s' % location.get('latitude')
      print '  > Long: %s' % location.get('longitude')
      print '  > Accuracy: %s meters' % location.get('accuracy')
  except errors.HttpError, e:
    print 'An error occurred: %s' % e

রুবি

রুবি ক্লায়েন্ট লাইব্রেরি ব্যবহার করে।

##
# Print information about all the known locations for the current user.
#
# @param [Google::APIClient] client
#   Authorized client instance.
# @return nil
def print_all_locations(client)
  mirror = client.discovered_api('mirror', 'v1')
  result = client.execute(:api_method => mirror.locations.list)
  if result.success?
    locations = result.data
    locations.items.each do |location|
      puts "Location recorded on: #{location.timestamp}"
      puts "  > Lat: #{location.latitude}"
      puts "  > Long: #{location.longitude}"
      puts "  > Accuracy: #{location.accuracy} meters"
    end
  else
    puts "An error occurred: #{result.data['error']['message']}"
  end
end

কাঁচা HTTP

একটি ক্লায়েন্ট লাইব্রেরি ব্যবহার করে না।

GET /mirror/v1/locations HTTP/1.1
Host: www.googleapis.com
Authorization: Bearer auth token