প্রস্তাব দেখুন, প্রস্তাব দেখুন

আপনার ক্রেতা অ্যাকাউন্ট এবং আপনার যেকোনো ক্লায়েন্টের জন্য বিদ্যমান প্রস্তাবনাগুলো দেখতে আপনি নিম্নলিখিত পদ্ধতিগুলো ব্যবহার করতে পারেন।

স্বতন্ত্র প্রস্তাব নিন

আপনাকে বা আপনার কোনো clients পাঠানো কোনো নির্দিষ্ট Proposal পেতে আপনি buyers.proposals.get মেথডটি ব্যবহার করতে পারেন।

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

বিশ্রাম

অনুরোধ

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

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

{
 "name": "buyers/12345678/proposals/MP21673270",
 "updateTime": "2021-09-14T18:12:28.216Z",
 "proposalRevision": "10",
 "dealType": "PROGRAMMATIC_GUARANTEED",
 "displayName": "Test PG Proposal 1",
 "state": "SELLER_REVIEW_REQUESTED",
 "isRenegotiating": true,
 "originatorRole": "SELLER",
 "publisherProfile": "buyers/12345678/publisherProfiles/PP12345",
 "buyer": "buyers/12345678",
 "billedBuyer": "buyers/12345678",
 "lastUpdaterOrCommentorRole": "BUYER"
}

জাভা

/*
 * Copyright 2022 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.proposals;

import com.google.api.services.authorizedbuyersmarketplace.v1.AuthorizedBuyersMarketplace;
import com.google.api.services.authorizedbuyersmarketplace.v1.model.Proposal;
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 proposal for the given buyer and proposal IDs. */
public class GetProposals {

  public static void execute(AuthorizedBuyersMarketplace marketplaceClient, Namespace parsedArgs) {
    Long accountId = parsedArgs.getLong("account_id");
    String proposalId = parsedArgs.getString("proposal_id");
    String name = String.format("buyers/%d/proposals/%s", accountId, proposalId);

    Proposal proposal = null;

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

    System.out.printf(
        "Found proposal with ID \"%s\" for buyer account ID \"%d\":%n", proposalId, accountId);
    Utils.printProposal(proposal);
  }

  public static void main(String[] args) {
    ArgumentParser parser =
        ArgumentParsers.newFor("GetProposals")
            .build()
            .defaultHelp(true)
            .description(("Get a proposal for the given buyer account ID and proposal ID."));
    parser
        .addArgument("-a", "--account_id")
        .help(
            "The resource ID of the buyers resource under which the proposal is being retrieved."
                + " This will be used to construct the parent used as a path parameter for the"
                + " proposals.get request.")
        .required(true)
        .type(Long.class);
    parser
        .addArgument("-p", "--proposal_id")
        .help(
            "The resource ID of the buyers.proposals resource that is being retrieved. This will be"
                + " used to construct the name used as a path parameter for the proposals.get "
                + "request.")
        .required(true);

    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.proposals.list পদ্ধতিটি ব্যবহার করতে পারেন।

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

বিশ্রাম

অনুরোধ

GET https://authorizedbuyersmarketplace.googleapis.com/v1/buyers/12345678/proposals?filter=dealType+%3D+PROGRAMMATIC_GUARANTEED&pageSize=3&alt=json
Authorization: Bearer ACCESS_TOKEN
Content-Type: application/json

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

{
 "proposals": [
   {
     "name": "buyers/12345678/proposals/MP21673270",
     "updateTime": "2021-09-14T18:12:28.216Z",
     "proposalRevision": "10",
     "dealType": "PROGRAMMATIC_GUARANTEED",
     "displayName": "Test PG Proposal 1",
     "state": "SELLER_REVIEW_REQUESTED",
     "isRenegotiating": true,
     "originatorRole": "SELLER",
     "publisherProfile": "buyers/12345678/publisherProfiles/PP12345",
     "buyer": "buyers/12345678",
     "billedBuyer": "buyers/12345678",
     "lastUpdaterOrCommentorRole": "BUYER"
   },
   {
     "name": "buyers/12345678/proposals/MP31830610",
     "updateTime": "2020-03-25T18:24:09.887Z",
     "proposalRevision": "4",
     "dealType": "PROGRAMMATIC_GUARANTEED",
     "displayName": "Test PG Proposal 2",
     "state": "SELLER_REVIEW_REQUESTED",
     "originatorRole": "BUYER",
     "publisherProfile": "buyers/12345678/publisherProfiles/PP54321",
     "buyer": "buyers/12345678",
     "billedBuyer": "buyers/12345678",
     "sellerContacts": [
       {
         "email": "advertising@redplanet.mars",
         "displayName": "Joe"
       }
     ],
     "buyerContacts": [
       {
         "email": "testemail2022@gmail.com"
       }
     ],
     "lastUpdaterOrCommentorRole": "BUYER"
   },
   {
     "name": "buyers/12345678/proposals/MP14138120",
     "updateTime": "2022-03-20T03:08:36.424Z",
     "proposalRevision": "1",
     "dealType": "PROGRAMMATIC_GUARANTEED",
     "displayName": "Test PG Proposal 3",
     "state": "SELLER_REVIEW_REQUESTED",
     "originatorRole": "BUYER",
     "publisherProfile": "buyers/12345678/publisherProfiles/PP892146",
     "buyer": "buyers/12345678",
     "billedBuyer": "buyers/12345678",
     "sellerContacts": [
       {
         "email": "cindy@garb.com"
       }
     ],
     "buyerContacts": [
       {
         "email": "testemail2022@gmail.com"
       }
     ],
    "lastUpdaterOrCommentorRole": "BUYER",
    "notes": [
       {
        "createTime": "2022-03-20T03:08:36.424Z",
        "creatorRole": "BUYER",
        "note": "Verified that ad sizes are supported."
       }
     ]
   }
 ],
 "nextPageToken": "CAMQzey9vLbi9gIYzey9vLbi9gI="
}   

জাভা

/*
 * Copyright 2022 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.proposals;

import com.google.api.services.authorizedbuyersmarketplace.v1.AuthorizedBuyersMarketplace;
import com.google.api.services.authorizedbuyersmarketplace.v1.model.ListProposalsResponse;
import com.google.api.services.authorizedbuyersmarketplace.v1.model.Proposal;
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 proposals for a given buyer. */
public class ListProposals {

  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 proposals for buyer account ID '%d':%n", accountId);

    do {
      List<Proposal> proposals = null;

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

        proposals = response.getProposals();
        pageToken = response.getNextPageToken();
      } catch (IOException ex) {
        System.out.printf("Marketplace API returned error response:%n%s", ex);
        System.exit(1);
      }
      if (proposals == null) {
        System.out.println("No proposals found.");
      } else {
        for (Proposal proposal : proposals) {
          Utils.printProposal(proposal);
        }
      }
    } while (pageToken != null);
  }

  public static void main(String[] args) {
    ArgumentParser parser =
        ArgumentParsers.newFor("ListProposals")
            .build()
            .defaultHelp(true)
            .description(("Lists proposals associated with the given buyer account."));
    parser
        .addArgument("-a", "--account_id")
        .help(
            "The resource ID of the buyers resource under which the proposals are being retrieved."
                + " This will be used to construct the parent used as a path parameter for the"
                + " proposals.list request.")
        .required(true)
        .type(Long.class);
    parser
        .addArgument("-f", "--filter")
        .help(
            "Query string to filter proposals. By default, this example will filter by deal type to"
                + " retrieve proposals including programmatic guaranteed deals to demonstrate "
                + "usage.")
        .setDefault("dealType = PROGRAMMATIC_GUARANTEED");
    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);
  }
}