=head1 Cookbook

Some examples of how to use the client.

=head1 Recipies

=head2 Authenticate Yourself

Make sure you've enabled the Developer flag in your Wing user account and requested an API key. Then you can authenticate like this:

 my $session = $wing->post('session', {
    username    => 'me',
    password    => '123qwe',
    api_key_id  => 'abcdefghijklmnopqrztuz',
 });


=head2 Checking for Success

All L<Wing::Client> requests will throw an L<Ouch> exception in the case of a failed lookup, or if the remote L<Wing> server returned an error code.

=head3 Anything can fail

Since any request can return an exception, you'll need to eval B<all> requests.

 my $session = eval {
     $wing->post('session', {
         username    => 'me',
         password    => '123qwe',
         api_key_id  => 'abcdefghijklmnopqrztuz',
     });
 };

=head3 Trapping and processing

You can use a combination of Ouch's trapping mechanisms to handle errors

 if (kiss 440) {
     say "Wrong username and password combination";
     exit 1;
 }
 else (hug) { #Catch all other errors
     say "Pigs are flying someplace, check the server-side code";
     exit 2;
 }
 else {
    say "It worked";
 }
 #Continue knowing that $session has valid data in it.

=cut
