| 1 | package cPanel::APIClient::Pending; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | =encoding utf-8 | ||
| 7 | |||
| 8 | =head1 NAME | ||
| 9 | |||
| 10 | cPanel::APIClient::Pending | ||
| 11 | |||
| 12 | =head1 DESCRIPTION | ||
| 13 | |||
| 14 | This class encapsulates a pending API request. | ||
| 15 | |||
| 16 | =cut | ||
| 17 | |||
| 18 | #---------------------------------------------------------------------- | ||
| 19 | |||
| 20 | use Call::Context (); | ||
| 21 | |||
| 22 | #---------------------------------------------------------------------- | ||
| 23 | |||
| 24 | # Left undocumented since instantiation is internal-only. | ||
| 25 | sub new { | ||
| 26 | my ( $class, $promise, @details ) = @_; | ||
| 27 | |||
| 28 | return bless [ $promise, @details ], $class; | ||
| 29 | } | ||
| 30 | |||
| 31 | # This also is not (yet?) meant for public consumption. | ||
| 32 | sub get_details { | ||
| 33 | Call::Context::must_be_list(); | ||
| 34 | |||
| 35 | return @{ $_[0] }[ 1 .. $#{ $_[0] } ]; | ||
| 36 | } | ||
| 37 | |||
| 38 | =head1 METHODS | ||
| 39 | |||
| 40 | This class is not documented for public instantiation. | ||
| 41 | Functionality that pertains to callers’ interest is documented below: | ||
| 42 | |||
| 43 | =head2 $promise = I<OBJ>->promise() | ||
| 44 | |||
| 45 | Returns a promise object (whose specific class is determined by the | ||
| 46 | chosen transport mechanism) that will resolve or reject according to | ||
| 47 | whether the API request succeeds or fails. | ||
| 48 | |||
| 49 | =cut | ||
| 50 | |||
| 51 | sub promise { | ||
| 52 | return $_[0][0]; | ||
| 53 | } | ||
| 54 | |||
| 55 | =head1 LICENSE | ||
| 56 | |||
| 57 | Copyright 2020 cPanel, L. L. C. All rights reserved. L<http://cpanel.net> | ||
| 58 | |||
| 59 | This is free software; you can redistribute it and/or modify it under the | ||
| 60 | same terms as Perl itself. See L<perlartistic>. | ||
| 61 | |||
| 62 | =cut | ||
| 63 | |||
| 64 | 1; |