Посмотреть предложения

Вы можете использовать следующие методы для просмотра существующих предложений для вашей учетной записи покупателя и любого из ваших клиентов .

Получить индивидуальное предложение

Вы можете использовать метод buyers.proposals.get для получения конкретного Proposal отправленного вам или одному из ваших clients .

В следующем примере показано, как можно получить отдельное Proposal с помощью метода get .

Запрос

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
 *
 *     http://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.
 */


using Google.Apis.AuthorizedBuyersMarketplace.v1;
using Google.Apis.AuthorizedBuyersMarketplace.v1.Data;
using Mono.Options;

using System;
using System.Collections.Generic;

namespace Google.Apis.AuthorizedBuyersMarketplace.Examples.v1.Buyers.Proposals
{
   
/// <summary>
   
/// Gets a single proposal for the given buyer and proposal IDs.
   
/// </summary>
   
public class GetProposals : ExampleBase
   
{
       
private AuthorizedBuyersMarketplaceService mkService;

       
/// <summary>
       
/// Constructor.
       
/// </summary>
       
public GetProposals()
       
{
            mkService
= Utilities.GetAuthorizedBuyersMarketplaceService();
       
}

       
/// <summary>
       
/// Returns a description about the code example.
       
/// </summary>
       
public override string Description
       
{
           
get => "This code example gets a proposal for given buyer and proposal IDs.";
       
}

       
/// <summary>
       
/// Parse specified arguments.
       
/// </summary>
       
protected override Dictionary<string, object> ParseArguments(List<string> exampleArgs) {
           
string[] requiredOptions = new string[] {"account_id", "proposal_id"};
           
bool showHelp = false;

           
string accountId = null;
           
string proposalId = null;

           
OptionSet options = new OptionSet {
               
"Get a proposal for the given buyer and proposal IDs.",
               
{
                   
"h|help",
                   
"Show help message and exit.",
                    h
=> showHelp = h != null
               
},
               
{
                   
"a|account_id=",
                   
("[Required] The resource ID of the buyers resource under which the " +
                     
"proposal is being retrieved. This will be used to construct the name used " +
                     
"as a path parameter for the proposals.get request."),
                    a
=> accountId = a
               
},
               
{
                   
"p|proposal_id=",
                   
("[Required] 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."),
                    p
=> proposalId = p
               
},
           
};

           
List<string> extras = options.Parse(exampleArgs);
           
var parsedArgs = new Dictionary<string, object>();

           
// Show help message.
           
if (showHelp == true)
           
{
                options
.WriteOptionDescriptions(Console.Out);
               
Environment.Exit(0);
           
}
           
// Set optional arguments.
            parsedArgs
["account_id"] = accountId;
            parsedArgs
["proposal_id"] = proposalId;
           
// Validate that options were set correctly.
           
Utilities.ValidateOptions(options, parsedArgs, requiredOptions, extras);

           
return parsedArgs;
       
}

       
/// <summary>
       
/// Run the example.
       
/// </summary>
       
/// <param name="parsedArgs">Parsed arguments for the example.</param>
       
protected override void Run(Dictionary<string, object> parsedArgs)
       
{
           
string accountId = (string) parsedArgs["account_id"];
           
string proposalId = (string) parsedArgs["proposal_id"];
           
string name = $"buyers/{accountId}/proposals/{proposalId}";

           
BuyersResource.ProposalsResource.GetRequest request =
                mkService
.Buyers.Proposals.Get(name);
           
Proposal response = null;

           
Console.WriteLine("Getting proposal with name: {0}", name);

           
try
           
{
                response
= request.Execute();
           
}
           
catch (Exception exception)
           
{
               
throw new ApplicationException(
                    $
"Marketplace API returned error response:\n{exception.Message}");
           
}

           
Utilities.PrintProposal(response);
       
}
   
}
}

/*
 * 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.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);
  }
}
#!/usr/bin/python
#
# Copyright 2021 Google Inc. All Rights Reserved.
#
# 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
#
#      http://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.

"""Gets a single proposal for the given account and proposal IDs."""


import argparse
import os
import pprint
import sys

sys.path.insert(0, os.path.abspath('../../..'))

from googleapiclient.errors import HttpError

import util


_PROPOSALS_NAME_TEMPLATE = 'buyers/%s/proposals/%s'

DEFAULT_BUYER_RESOURCE_ID = 'ENTER_BUYER_RESOURCE_ID_HERE'
DEFAULT_PROPOSAL_RESOURCE_ID = 'ENTER_PROPOSAL_RESOURCE_ID_HERE'


def main(marketplace, args):
    account_id = args.account_id
    proposal_id = args.proposal_id

    print(f'Get proposal "{proposal_id}" for account "{account_id}":')
    try:
        # Construct and execute the request.
        response = marketplace.buyers().proposals().get(
            name=_PROPOSALS_NAME_TEMPLATE % (account_id, proposal_id)).execute()
    except HttpError as e:
        print(e)
        sys.exit(1)

    pprint.pprint(response)


if __name__ == '__main__':
    try:
        service = util.get_service(version='v1')
    except IOError as ex:
        print(f'Unable to create marketplace service - {ex}')
        print('Did you specify the key file in util.py?')
        sys.exit(1)

    parser = argparse.ArgumentParser(
        description=('Get a proposal for the given buyer account ID and '
                     'proposal ID.'))
    # Required fields.
    parser.add_argument(
        '-a', '--account_id', default=DEFAULT_BUYER_RESOURCE_ID,
        help=('The resource ID of the buyers resource under which the '
              'proposal was created. This will be used to construct the '
              'name used as a path parameter for the proposals.get request.'))
    parser.add_argument(
        '-p', '--proposal_id', default=DEFAULT_PROPOSAL_RESOURCE_ID,
        help=('The resource ID of the buyers.proposals resource for which the '
              'proposal was created. This will be used to construct the '
              'name used as a path parameter for the proposals.get request.'))

    main(service, parser.parse_args())

Перечислите несколько предложений

Вы можете использовать метод 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
 *
 *     http://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.
 */


using Google.Apis.AuthorizedBuyersMarketplace.v1;
using Google.Apis.AuthorizedBuyersMarketplace.v1.Data;
using Mono.Options;

using System;
using System.Collections.Generic;

namespace Google.Apis.AuthorizedBuyersMarketplace.Examples.v1.Buyers.Proposals
{
   
/// <summary>
   
/// Lists proposals for a given buyer.
   
/// </summary>
   
public class ListProposals : ExampleBase
   
{
       
private AuthorizedBuyersMarketplaceService mkService;

       
/// <summary>
       
/// Constructor.
       
/// </summary>
       
public ListProposals()
       
{
            mkService
= Utilities.GetAuthorizedBuyersMarketplaceService();
       
}

       
/// <summary>
       
/// Returns a description about the code example.
       
/// </summary>
       
public override string Description
       
{
           
get => "This code example lists proposals for a given buyer.";
       
}

       
/// <summary>
       
/// Parse specified arguments.
       
/// </summary>
       
protected override Dictionary<string, object> ParseArguments(List<string> exampleArgs) {
           
string[] requiredOptions = new string[] {"account_id"};
           
bool showHelp = false;

           
string accountId = null;
           
string filter = null;
           
int? pageSize = null;

           
string defaultFilter = "dealType = PROGRAMMATIC_GUARANTEED";

           
OptionSet options = new OptionSet {
               
"List proposals for the given buyer account.",
               
{
                   
"h|help",
                   
"Show help message and exit.",
                    h
=> showHelp = h != null
               
},
               
{
                   
"a|account_id=",
                   
("[Required] 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."),
                    a
=> accountId = a
               
},
               
{
                   
"f|filter=",
                   
("Query string to filter proposals. By default, this example will filter by " +
                     
"deal type to retrieve proposals including programmatic guaranteed deals " +
                     
"to demonstrate usage."),
                    f
=> filter =  f
               
},
               
{
                   
"p|page_size=",
                   
("The number of rows to return per page. The server may return fewer rows " +
                     
"than specified."),
                   
(int p) => pageSize =  p
               
},
           
};

           
List<string> extras = options.Parse(exampleArgs);
           
var parsedArgs = new Dictionary<string, object>();

           
// Show help message.
           
if (showHelp == true)
           
{
                options
.WriteOptionDescriptions(Console.Out);
               
Environment.Exit(0);
           
}
           
// Set arguments.
            parsedArgs
["account_id"] = accountId;
            parsedArgs
["filter"] = filter ?? defaultFilter;
            parsedArgs
["pageSize"] = pageSize ?? Utilities.MAX_PAGE_SIZE;
           
// Validate that options were set correctly.
           
Utilities.ValidateOptions(options, parsedArgs, requiredOptions, extras);

           
return parsedArgs;
       
}

       
/// <summary>
       
/// Run the example.
       
/// </summary>
       
/// <param name="parsedArgs">Parsed arguments for the example.</param>
       
protected override void Run(Dictionary<string, object> parsedArgs)
       
{
           
string accountId = (string) parsedArgs["account_id"];
           
string parent = $"buyers/{accountId}";
           
string pageToken = null;

           
Console.WriteLine(@"Listing proposals for buyer account ""{0}""", parent);
           
do
           
{
               
BuyersResource.ProposalsResource.ListRequest request =
                    mkService
.Buyers.Proposals.List(parent);
                request
.Filter = (string) parsedArgs["filter"];
                request
.PageSize = (int) parsedArgs["pageSize"];
                request
.PageToken = pageToken;

               
ListProposalsResponse page = null;

               
try
               
{
                    page
= request.Execute();
               
}
               
catch (Exception exception)
               
{
                   
throw new ApplicationException(
                        $
"Marketplace API returned error response:\n{exception.Message}");
               
}

               
var proposals = page.Proposals;
                pageToken
= page.NextPageToken;

               
if (proposals == null)
               
{
                   
Console.WriteLine("No finalized deals found for buyer account.");
               
}
               
else
               
{
                   
foreach (Proposal proposal in proposals)
                   
{
                       
Utilities.PrintProposal(proposal);
                   
}
               
}
           
}
           
while(pageToken != null);
       
}
   
}
}

/*
 * 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.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);
  }
}
#!/usr/bin/python
#
# Copyright 2021 Google Inc. All Rights Reserved.
#
# 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
#
#      http://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.

"""This example lists proposals for the specified buyer."""


import argparse
import os
import pprint
import sys

sys.path.insert(0, os.path.abspath('../../..'))

from googleapiclient.errors import HttpError

import util


_BUYER_NAME_TEMPLATE = 'buyers/%s'

DEFAULT_BUYER_RESOURCE_ID = 'ENTER_BUYER_RESOURCE_ID_HERE'


def main(marketplace, args):
    account_id = args.account_id
    list_filter = args.filter
    page_size = args.page_size

    page_token = None
    more_pages = True

    print(f'Listing proposals for buyer account: "{account_id}".')
    while more_pages:
        try:
            # Construct and execute the request.
            response = marketplace.buyers().proposals().list(
                parent=_BUYER_NAME_TEMPLATE % account_id, pageToken=page_token,
                filter=list_filter, pageSize=page_size).execute()
        except HttpError as e:
            print(e)
            sys.exit(1)

        pprint.pprint(response)

        page_token = response.get('nextPageToken')
        more_pages = bool(page_token)


if __name__ == '__main__':
    try:
        service = util.get_service(version='v1')
    except IOError as ex:
        print(f'Unable to create marketplace service - {ex}')
        print('Did you specify the key file in util.py?')
        sys.exit(1)

    parser = argparse.ArgumentParser(
        description='Lists proposals for the given buyer account.')
    # Required fields.
    parser.add_argument(
        '-a', '--account_id', default=DEFAULT_BUYER_RESOURCE_ID,
        help=('The resource ID of the buyers resource under which the '
              'proposals were created. This will be used to construct the '
              'parent used as a path parameter for the proposals.list '
              'request.'))
    # Optional fields.
    parser.add_argument(
        '-f', '--filter', default='dealType = PROGRAMMATIC_GUARANTEED',
        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.'))
    parser.add_argument(
        '-p', '--page_size', default=util.MAX_PAGE_SIZE,
        help=('The number of rows to return per page. The server may return '
              'fewer rows than specified.'))

    main(service, parser.parse_args())