NAME

WWW::BackpackTF - interface to the backpack.tf trading service

SYNOPSIS

  use WWW::BackpackTF;
  my $api_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
  my $user_id = <STDIN>;
  my $bp = WWW::BackpackTF->new($api_key);
  my $user = $bp->get_users($user_id);
  print 'This user is named ', $user->name, ' and has ', $user->notifications, ' unread notification(s)';
  my @all_items_in_dota2 = $bp->get_prices(WWW::BackpackTF::DOTA2);
  my @currencies = $bp->get_currencies;
  print 'The first currency is ', $currencies[0]->name;

DESCRIPTION

WWW::BackpackTF is an interface to the backpack.tf Team Fortress 2/Dota 2/Counter-Strike: Global Offensive trading service.

METHODS

new([key => $api_key], [base => $base_url])

Create a new WWW::BackpackTF object. Takes a hash of parameters. Possible parameters:

key

The API key. Defaults to nothing. Most methods require an API key.

base

The base URL. Defaults to http://backpack.tf/api/.

get_prices([$appid, [$raw]])

Get price information for all items. Takes two optional parameters. The first parameter is the appid and defaults to WWW::BackpackTF::TF2. The second (if true) adds a value_raw property to prices and defaults to false. Returns a list of WWW::BackpackTF::Item objects.

get_users(@users)

Get profile information for a list of users. Takes any number of 64-bit Steam IDs as arguments and returns a list of WWW::BackpackTF::User objects. This method does not require an API key. Dies with an error message if the operation is unsuccessful.

get_currencies([$appid])

Get currency information. Takes one optional parameter, the appid, which defaults to WWW::BackpackTF::TF2. Returns a list of WWW::BackpackTF::Currency objects.

get_market_prices([$appid])

Get Steam Community Market price information for all items. Takes one optional parameter, the appid, which defaults to WWW::BackpackTF::TF2. Returns a list of WWW::BackpackTF::MarketItem objects.

get_user_listings($steamid, [$appid])

Get classified listing of a given user. Takes a mandatory 64-bit Steam ID of the user, and an optional parameter, the appid, which defaults to WWW::BackpackTF::TF2. Returns a list of WWW::BackpackTF::Listing objects.

EXPORTS

None by default.

TF2

Constant (440) representing Team Fortress 2.

DOTA2

Constant (570) representing Dota 2.

CSGO

Constant (730) representing Counter-Strike: Global Offensive

NORMAL

The Normal item quality (0).

GENUINE

The Genuine item quality (1).

RARITY2

The unused rarity2 item quality (2).

VINTAGE

The Vintage item quality (3).

RARITY3

The unused rarity3 item quality (4).

UNUSUAL

The Unusual item quality (5).

UNIQUE

The Unique item quality (6).

COMMUNITY

The Community item quality (7).

VALVE

The Valve item quality (8).

SELFMADE

The Self-Made item quality (9).

CUSTOMIZED

The unused Customized item quality (10).

STRANGE

The Strange item quality (11).

COMPLETED

The Completed item quality (12).

HAUNTED

The Haunted item quality (13).

COLLECTORS

The Collector's item quality (14).

SEE ALSO

http://backpack.tf/, http://backpack.tf/api

AUTHOR

Marius Gavrilescu, <marius@ieval.ro>

COPYRIGHT AND LICENSE

Copyright (C) 2014-2017 by Marius Gavrilescu

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.18.2 or, at your option, any later version of Perl 5 you may have available.