ক্লায়েন্ট দেখুন, ক্লায়েন্ট দেখুন

আপনার অ্যাকাউন্টের অধীনে থাকা বিদ্যমান clients দেখতে আপনি নিম্নলিখিত পদ্ধতিগুলো ব্যবহার করতে পারেন।

স্বতন্ত্র ক্লায়েন্ট দেখুন

আপনি buyers.clients.get মেথডটি ব্যবহার করে কোনো নির্দিষ্ট Client খুঁজে বের করতে এবং অনুমোদিত ক্রেতা মার্কেটপ্লেস UI-তে তার অ্যাক্সেসের স্তর দেখতে পারেন।

উদাহরণস্বরূপ, যখন আপনি কোনো প্রকাশকের সাথে একটি প্রস্তাব নিয়ে আলোচনা করেন, তখন আপনি প্রস্তাবে উল্লেখিত Client তথ্য দেখতে get ব্যবহার করতে পারেন।

নিম্নলিখিত নমুনাটি দেখায় যে আপনি কীভাবে get মেথড ব্যবহার করে একজন নির্দিষ্ট Client খুঁজে বের করতে পারেন।

বিশ্রাম

অনুরোধ

GET https://authorizedbuyersmarketplace.googleapis.com/v1/buyers/12345678/clients/984287215?alt=json
Authorization: Bearer ACCESS_TOKEN
Content-Type: application/json

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

{
 "name": "buyers/12345678/clients/984287215",
 "role": "CLIENT_DEAL_APPROVER",
 "state": "ACTIVE",
 "displayName": "Demo Approver 1"
}

জাভা

/*
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.api.services.samples.authorizedbuyers.marketplace.v1.buyers.clients;

import com.google.api.services.authorizedbuyersmarketplace.v1.AuthorizedBuyersMarketplace;
import com.google.api.services.authorizedbuyersmarketplace.v1.model.Client;
import com.google.api.services.samples.authorizedbuyers.marketplace.v1.Utils;
import java.io.IOException;
import java.security.GeneralSecurityException;
import net.sourceforge.argparse4j.ArgumentParsers;
import net.sourceforge.argparse4j.inf.ArgumentParser;
import net.sourceforge.argparse4j.inf.ArgumentParserException;
import net.sourceforge.argparse4j.inf.Namespace;

/**
 * This sample illustrates how to get a single client for the given buyer account ID and client ID.
 */
public class GetClients {

  public static void execute(AuthorizedBuyersMarketplace marketplaceClient, Namespace parsedArgs) {
    Long accountId = parsedArgs.getLong("account_id");
    Long clientId = parsedArgs.getLong("client_id");
    String name = String.format("buyers/%d/clients/%d", accountId, clientId);

    Client client = null;

    try {
      client = marketplaceClient.buyers().clients().get(name).execute();
    } catch (IOException ex) {
      System.out.printf("Marketplace API returned error response:%n%s", ex);
      System.exit(1);
    }

    System.out.printf(
        "Found Client with ID \"%s\" for buyer account ID '%d':%n", clientId, accountId);
    Utils.printClient(client);
  }

  public static void main(String[] args) {
    ArgumentParser parser =
        ArgumentParsers.newFor("GetClients")
            .build()
            .defaultHelp(true)
            .description(("Get a client for the given buyer account ID and client ID."));
    parser
        .addArgument("-a", "--account_id")
        .help(
            "The resource ID of the buyers resource under which the client was created. This will"
                + " be used to construct the parent used as a path parameter for the clients.get "
                + "request.")
        .required(true)
        .type(Long.class);
    parser
        .addArgument("-c", "--client_id")
        .help(
            "The resource ID of the buyers.clients resource for which the client was created "
                + "This will be used to construct the name used as a path parameter for the "
                + "clients.get request.")
        .required(true)
        .type(Long.class);

    Namespace parsedArgs = null;
    try {
      parsedArgs = parser.parseArgs(args);
    } catch (ArgumentParserException ex) {
      parser.handleError(ex);
      System.exit(1);
    }

    AuthorizedBuyersMarketplace client = null;
    try {
      client = Utils.getMarketplaceClient();
    } catch (IOException ex) {
      System.out.printf("Unable to create Marketplace API service:%n%s", ex);
      System.out.println("Did you specify a valid path to a service account key file?");
      System.exit(1);
    } catch (GeneralSecurityException ex) {
      System.out.printf("Unable to establish secure HttpTransport:%n%s", ex);
      System.exit(1);
    }

    execute(client, parsedArgs);
  }
}

একাধিক ক্লায়েন্ট তালিকাভুক্ত করুন

আপনি buyers.clients.list মেথডটি ব্যবহার করে সমস্ত ক্লায়েন্টের তালিকা দেখতে পারেন, অথবা partnerClientId দিয়ে filter ব্যবহার করে আপনার কোনো গ্রাহকের সাথে যুক্ত ক্লায়েন্টকে খুঁজে বের করতে পারেন।

নিম্নলিখিত নমুনাটি দেখায় যে আপনি কীভাবে list মেথড ব্যবহার করে ক্লায়েন্টদের তালিকা করতে পারেন।

বিশ্রাম

অনুরোধ

GET https://authorizedbuyersmarketplace.googleapis.com/v1/buyers/12345678/clients?pageSize=3&alt=json
Authorization: Bearer ACCESS_TOKEN
Content-Type: application/json

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

{
 "clients": [
   {
     "name": "buyers/12345678/clients/995152331",
     "role": "CLIENT_DEAL_NEGOTIATOR",
     "state": "ACTIVE",
     "displayName": "Demo Negotiator 1",
     "partnerClientId": "pcid-5e845421-251a-4a0c-8316-67f9b8140d3a"
   },
   {
     "name": "buyers/12345678/clients/837492105",
     "role": "CLIENT_DEAL_VIEWER",
     "state": "INACTIVE",
     "displayName": "Demo Viewer 1",
     "sellerVisible": true
   },
   {
     "name": "buyers/12345678/clients/984287215",
     "role": "CLIENT_DEAL_APPROVER",
     "state": "ACTIVE",
     "displayName": "Demo Approver 1"
   }
 ],
 "nextPageToken": "CAMQ26Xgn7nb9gIY26Xgn7nb9gI="
}

জাভা

/*
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.api.services.samples.authorizedbuyers.marketplace.v1.buyers.clients;

import com.google.api.services.authorizedbuyersmarketplace.v1.AuthorizedBuyersMarketplace;
import com.google.api.services.authorizedbuyersmarketplace.v1.model.Client;
import com.google.api.services.authorizedbuyersmarketplace.v1.model.ListClientsResponse;
import com.google.api.services.samples.authorizedbuyers.marketplace.v1.Utils;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.util.List;
import net.sourceforge.argparse4j.ArgumentParsers;
import net.sourceforge.argparse4j.inf.ArgumentParser;
import net.sourceforge.argparse4j.inf.ArgumentParserException;
import net.sourceforge.argparse4j.inf.Namespace;

/** This sample illustrates how to list Clients for a given buyer account ID. */
public class ListClients {

  public static void execute(AuthorizedBuyersMarketplace marketplaceClient, Namespace parsedArgs) {
    Long accountId = parsedArgs.getLong("account_id");
    Integer pageSize = parsedArgs.getInt("page_size");
    String parentBuyerName = String.format("buyers/%d", accountId);
    String pageToken = null;

    System.out.printf("Found Clients for buyer Account ID '%d':%n", accountId);

    do {
      List<Client> clients = null;

      try {
        ListClientsResponse response =
            marketplaceClient
                .buyers()
                .clients()
                .list(parentBuyerName)
                .setFilter(parsedArgs.getString("filter"))
                .setPageSize(pageSize)
                .setPageToken(pageToken)
                .execute();

        clients = response.getClients();
        pageToken = response.getNextPageToken();
      } catch (IOException ex) {
        System.out.printf("Marketplace API returned error response:%n%s", ex);
        System.exit(1);
      }
      if (clients == null) {
        System.out.println("No clients found.");
      } else {
        for (Client client : clients) {
          Utils.printClient(client);
        }
      }
    } while (pageToken != null);
  }

  public static void main(String[] args) {
    ArgumentParser parser =
        ArgumentParsers.newFor("ListClients")
            .build()
            .defaultHelp(true)
            .description(("Lists clients associated with the given buyer account."));
    parser
        .addArgument("-a", "--account_id")
        .help(
            "The resource ID of the buyers resource under which the clients were created. "
                + "This will be used to construct the parent used as a path parameter for the "
                + "clients.list request.")
        .required(true)
        .type(Long.class);
    parser
        .addArgument("-f", "--filter")
        .help(
            "Query string to filter clients. If no filter is specified, all clients will be "
                + "returned. By default, no filter will be set.");
    parser
        .addArgument("-p", "--page_size")
        .help(
            "The number of rows to return per page. The server may return fewer rows than "
                + "specified.")
        .setDefault(Utils.getMaximumPageSize())
        .type(Integer.class);

    Namespace parsedArgs = null;
    try {
      parsedArgs = parser.parseArgs(args);
    } catch (ArgumentParserException ex) {
      parser.handleError(ex);
      System.exit(1);
    }

    AuthorizedBuyersMarketplace client = null;
    try {
      client = Utils.getMarketplaceClient();
    } catch (IOException ex) {
      System.out.printf("Unable to create Marketplace API service:%n%s", ex);
      System.out.println("Did you specify a valid path to a service account key file?");
      System.exit(1);
    } catch (GeneralSecurityException ex) {
      System.out.printf("Unable to establish secure HttpTransport:%n%s", ex);
      System.exit(1);
    }

    execute(client, parsedArgs);
  }
}