Açık artırma paketlerini görüntüle

Seçtiğiniz mevcut açık artırma paketlerini görüntülemek için aşağıdaki yöntemleri kullanabilirsiniz: abone olunan müşteri hesabıdır. Ekleme ya da değişiklik yapamazsınız açık artırma paketlerini keşfedin.

Ayrı açık artırma paketini al

URL parametrelerinin Google tarafından nasıl ele alınmasını istediğinizi belirtmek için buyers.auctionPackages.get belirli bir AuctionPackage almak için kullanabileceğiniz daha fazla bilgi edindiniz.

Alıcınızın istediği bir AuctionPackage öğesini görüntülemeye çalışırsanız kullanıcının abone olmadığı bazı hesaptır.

Aşağıdaki örnekte, bir öğeyi get yöntemiyle AuctionPackage.

REST

İstek

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

Yanıt

{
  "name":"buyers/12345678/auctionPackages/558444393847004125",
  "creator":"buyers/240142376",
  "displayName":"Luxury travel",
  "description":"Web, display. Verticals include: travel & transportation, hotels & accommodation, ecotourism. Ads.txt targeting: direct & reseller. Minimum predicted viewability: 75%",
  "createTime":"2038-06-28T19:12:38.823Z",
  "updateTime":"2042-01-11T18:45:14.106Z",
  "subscribedClients":[
     "buyers/12345678/clients/873721984",
     "buyers/12345678/clients/136428959"
  ]
}

C#

/* 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.AuctionPackages
{
    /// <summary>
    /// Gets a single auction package for the given buyer and auction package IDs.
    /// </summary>
    public class GetAuctionPackages : ExampleBase
    {
        private AuthorizedBuyersMarketplaceService mkService;

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

        /// <summary>
        /// Returns a description about the code example.
        /// </summary>
        public override string Description
        {
            get => "This code example gets a specific auction package for a buyer account.";
        }

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

            string accountId = null;
            string auctionPackageId = null;

            OptionSet options = new OptionSet {
                "Get an auction package for the given buyer and auction package 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 auction " +
                     "package is being retrieved. This will be used to construct the name used " +
                     "as a path parameter for the auctionPackages.get request."),
                    a => accountId = a
                },
                {
                    "auction_package_id=",
                    ("[Required] The resource ID of the buyers.auctionPackages resource that " +
                     "is being retrieved. This will be used to construct the name used as a " +
                     "path parameter for the auctionPackages.get request."),
                    auction_package_id => auctionPackageId = auction_package_id
                },
            };

            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["auction_package_id"] = auctionPackageId;
            // 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 auctionPackageId = (string) parsedArgs["auction_package_id"];
            string name = $"buyers/{accountId}/auctionPackages/{auctionPackageId}";

            BuyersResource.AuctionPackagesResource.GetRequest request =
                mkService.Buyers.AuctionPackages.Get(name);
            AuctionPackage response = null;

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

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

            Utilities.PrintAuctionPackage(response);
        }
    }
}

Java

/*
 * 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.auctionPackages;

import com.google.api.services.authorizedbuyersmarketplace.v1.AuthorizedBuyersMarketplace;
import com.google.api.services.authorizedbuyersmarketplace.v1.model.AuctionPackage;
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 an auction package for the given buyer and auction package ID.
 */
public class GetAuctionPackages {

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

    AuctionPackage auctionPackage = null;

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

    System.out.printf(
        "Found auction package with ID \"%s\" for buyer account ID '%d':%n",
        auctionPackageId, accountId);
    Utils.printAuctionPackage(auctionPackage);
  }

  public static void main(String[] args) {
    ArgumentParser parser =
        ArgumentParsers.newFor("GetAuctionPackages")
            .build()
            .defaultHelp(true)
            .description(("Get an auction package for the given buyer and auction package ID."));
    parser
        .addArgument("-a", "--account_id")
        .help(
            "The resource ID of the buyers resource under which the auction package is being "
                + " retrieved. This will be used to construct the name used as a path parameter for"
                + " the auctionPackages.get request.")
        .required(true)
        .type(Long.class);
    parser
        .addArgument("--auction_package_id")
        .help(
            "The resource ID of the buyers.auctionPackages resource that is being retrieved. "
                + "This will be used to construct the name used as a path parameter for the "
                + "auctionPackages.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);
  }
}

Python

#!/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 auction package for given account and auction package IDs."""


import argparse
import os
import pprint
import sys

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

from googleapiclient.errors import HttpError

import util


_AUCTION_PACKAGE_NAME_TEMPLATE = 'buyers/%s/auctionPackages/%s'

DEFAULT_BUYER_RESOURCE_ID = 'ENTER_BUYER_RESOURCE_ID_HERE'
DEFAULT_AUCTION_PACKAGE_RESOURCE_ID = 'ENTER_CLIENT_RESOURCE_ID_HERE'


def main(marketplace, args):
    auction_package_name = _AUCTION_PACKAGE_NAME_TEMPLATE % (
        args.account_id, args.auction_package_id)

    print(f'Get auction package with name "{auction_package_name}":')
    try:
        # Construct and execute the request.
        response = marketplace.buyers().auctionPackages().get(
            name=auction_package_name).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 an auction package for the given buyer account ID '
                     'and auction package 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 '
              'auction package is being accessed. This will be used to '
              'construct the name used as a path parameter for the '
              'auctionPackages.get request.'))
    parser.add_argument(
        '-p', '--auction_package_id',
        default=DEFAULT_AUCTION_PACKAGE_RESOURCE_ID,
        help=('The resource ID of the buyers.auctionPackages resource that is '
              'being accessed. This will be used to construct the name used as '
              'a path parameter for the auctionPackages.get request.'))

    main(service, parser.parse_args())

Birden çok açık artırma paketi listeleme

Tekliflerinizi otomatikleştirmek ve optimize etmek için buyers.auctionPackages.list alıcılarınızın veya müşterilerinizin bulunduğu tüm açık artırma paketleri arasında sayfa sayfası oluşturmak için bir yöntem , abone olundu.

Aşağıdaki örnekte, list yöntemini çağırın.

REST

İstek

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

Yanıt

{
 "auctionPackages": [
   {
     "name": "buyers/12345678/auctionPackages/558444393847004125",
     "creator": "buyers/240142376",
     "displayName": "Luxury travel",
     "description": "Web, display. Verticals include: travel & transportation, hotels & accommodation, ecotourism. Ads.txt targeting: direct & reseller. Minimum predicted viewability: 75%",
     "createTime": "2038-06-28T19:12:38.823Z",
     "updateTime": "2042-01-11T18:45:14.106Z",
     "subscribedClients": [
       "buyers/12345678/clients/873721984",
       "buyers/12345678/clients/136428959"
     ]
   },
   {
     "name": "buyers/12345678/auctionPackages/558444393847627347",
     "creator": "buyers/143579823",
     "displayName": "Mars Top 25 Video",
      "description": "Top 25 Sites in Mars Video",
     "createTime": "2040-11-16T16:45:46.185Z",
     "updateTime": "2041-05-03T13:53:17.151Z",
     "subscribedClients": [
       "buyers/12345678/clients/142940840"
     ]
   },
   {
     "name": "buyers/12345678/auctionPackages/558444393848195715",
     "creator": "buyers/12345678",
     "displayName": "Mars Top 100 Sports",
     "createTime": "2041-11-29T16:07:43.631Z",
     "updateTime": "2041-11-29T16:07:43.631Z"
   }
 ],
 "nextPageToken": "CAMQ5Ja-7a7g9gIY5Ja-7a7g9gI="
}

C#

/* 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.AuctionPackages
{
    /// <summary>
    /// Lists auction packages for a given buyer account ID.
    /// </summary>
    public class ListAuctionPackages : ExampleBase
    {
        private AuthorizedBuyersMarketplaceService mkService;

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

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

        /// <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;
            int? pageSize = null;

            OptionSet options = new OptionSet {
                "List auction packages 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 " +
                     "auction packages are being retrieved. This will be used to construct the " +
                     "parent used as a path parameter for the auctionPackages.list request."),
                    a => accountId = a
                },
                {
                    "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["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 auction packages for buyer account ""{0}""", parent);
            do
            {
                BuyersResource.AuctionPackagesResource.ListRequest request =
                    mkService.Buyers.AuctionPackages.List(parent);
                request.PageSize = (int) parsedArgs["pageSize"];
                request.PageToken = pageToken;

                ListAuctionPackagesResponse page = null;

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

                var auctionPackages = page.AuctionPackages;
                pageToken = page.NextPageToken;

                if (auctionPackages == null)
                {
                    Console.WriteLine("No auction packages found for buyer account.");
                }
                else
                {
                    foreach (AuctionPackage auctionPackage in auctionPackages)
                    {
                        Utilities.PrintAuctionPackage(auctionPackage);
                    }
                }
            }
            while(pageToken != null);
        }
    }
}

Java

/*
 * 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.auctionPackages;

import com.google.api.services.authorizedbuyersmarketplace.v1.AuthorizedBuyersMarketplace;
import com.google.api.services.authorizedbuyersmarketplace.v1.model.AuctionPackage;
import com.google.api.services.authorizedbuyersmarketplace.v1.model.ListAuctionPackagesResponse;
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 auction packages for a given buyer account ID. */
public class ListAuctionPackages {

  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/%s", accountId);
    String pageToken = null;

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

    do {
      List<AuctionPackage> auctionPackages = null;

      try {
        ListAuctionPackagesResponse response =
            marketplaceClient
                .buyers()
                .auctionPackages()
                .list(parentBuyerName)
                .setPageSize(pageSize)
                .setPageToken(pageToken)
                .execute();

        auctionPackages = response.getAuctionPackages();
        pageToken = response.getNextPageToken();
      } catch (IOException ex) {
        System.out.printf("Marketplace API returned error response:%n%s", ex);
        System.exit(1);
      }
      if (auctionPackages == null) {
        System.out.println("No auction packages found.");
      } else {
        for (AuctionPackage auctionPackage : auctionPackages) {
          Utils.printAuctionPackage(auctionPackage);
        }
      }
    } while (pageToken != null);
  }

  public static void main(String[] args) {
    ArgumentParser parser =
        ArgumentParsers.newFor("ListAuctionPackages")
            .build()
            .defaultHelp(true)
            .description(("Lists publisher profiles associated with the given buyer account."));
    parser
        .addArgument("-a", "--account_id")
        .help(
            "The resource ID of the buyers resource under which the auction packages resource "
                + "is being accessed. This will be used to construct the parent used as a path "
                + "parameter for the auctionPackages.list request.")
        .required(true)
        .type(Long.class);
    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);
  }
}

Python

#!/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 auction packages 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
    page_size = args.page_size

    page_token = None
    more_pages = True

    print(f'Listing auction packages for buyer account: "{account_id}".')
    while more_pages:
        try:
            # Construct and execute the request.
            response = marketplace.buyers().auctionPackages().list(
                parent=_BUYER_NAME_TEMPLATE % account_id, pageToken=page_token,
                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 auction packages 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 auction '
              'packages are being accessed. This will be used to construct the '
              'parent used as a path parameter for the auctionPackages.list '
              'request.'))
    # Optional fields.
    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())