The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

WebService::Etsy::Response - Returned values from the Etsy API.

SYNOPSIS

    my $resp = $api->getFeaturedSellers( detail_level => 'medium' );
    # call methods on the object
    print $resp->count . " featured sellers\n";
    # use the object like an arrayref of results
    for my $shop ( @$resp ) {
        print $shop->shop_name, "\n";
    }

DESCRIPTION

This class encapsulates the response from the API, as described at http://developer.etsy.com/docs#api_response_structure.

Arrayification

For convenience, the response object behaves like an arrayref of result objects when used as such.

Stringification

When used in a scalar context, the response object will return a comma-separated list of stringified result objects. This is noteworthy for the case of

    print $api->getServerEpoch() . "\n";

which will print the epoch directly, without having to do something like

    print $api->getServerEpoch()->results->[ 0 ]->value . "\n";

METHODS

results

An arrayref of result objects. Using the response object as an arrayref accesses this results arrayref.

params

A hashref of the parameters supplied to the method call.

count

The number of results found (not necessarily the number returned).

type

The result objects' type.

AUTOLOADED METHODS

As a convenience, the response object will accept method calls the belong to its result objects. The method calls will be executed on the first object in the results arrayref. This allows you to use the response object just like a result object, which is useful when a method call (e.g. getUserDetails) is expected to return one and only one result.

Note that WebService::Etsy::Method objects include methods that collide with WebService::Etsy::Response object methods, in which case you'll need to use the longer form of $resp-[ 0 ]->method()> (although this shouldn't matter too much since there aren't currently any API methods that return only one method result).

RESULT OBJECTS

WebService::Etsy::String

The object behaves just like a string in scalar context. It does provide a value() method if you need it.

WebService::Etsy::Int

The object behaves just like an integer in scalar context. It does provide a value() method if you need it.

WebService::Etsy::Tag

The object behaves just like an string in scalar context. It does provide a value() method if you need it.

WebService::Etsy::User

The object includes methods corresponding to the field values described at http://developer.etsy.com/docs#users.

Some of the methods may return undef if the relevant detail level was not requested.

WebService::Etsy::Shop

The object includes methods corresponding to the field values described at http://developer.etsy.com/docs#shops.

Some of the methods may return undef if the relevant detail level was not requested.

WebService::Etsy::Listing

The object includes methods corresponding to the field values described at http://developer.etsy.com/docs#listings.

Some of the methods may return undef if the relevant detail level was not requested.

WebService::Etsy::GiftGuide

The object includes methods corresponding to the field values described at http://developer.etsy.com/docs#gift_guides.

WebService::Etsy::Method

The object includes methods corresponding to the field values described at http://developer.etsy.com/docs#methods.

AUTHOR

Ian Malpass (ian-cpan@indecorous.com)

COPYRIGHT

Copyright 2003-2007, Ian Malpass

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.