App-Adenosine

 view release on metacpan or  search on metacpan

bin/adenosine  view on Meta::CPAN

uncomment the plugin lines.

=head1 Hacking!

Want to add some features?  Fork the C<frioux/app-adenosine> repository and send
pull requests!

=head1 A Work In Progress

Adenosine was ported to Perl from L<resty|https://github.com/micha/resty> due
to a number of L<issues|https://github.com/micha/resty/issues>.  Because
adenosine is not a simple shell function it does not use env vars as much, and
so is less "persistent" than resty when it comes to various settings.  I'm
completely willing to fix this by wrapping adenosine with a small shell
function that sets various environment variables, but I'd rather get it
released with a few exciting features resty does not have.  With that in mind,
patches are always welcome.  Please get in touch if you'd like one of the
currently unsupported resty features to be fixed and I'll certainly do what I
can to get it working.  Any part of the doc marked with C<!!!> is a place to
look out for an imcompatibility.

=head1 Usage

      source adenosine-exports [-W] [remote] # load functions into shell         !!!
      adenosine [-v]                         # prints current request URI base   !!!
      adenosine <remote> [OPTIONS]           # sets the base request URI         !!!

      HEAD [path] [OPTIONS]                   # HEAD request
      OPTIONS [path] [OPTIONS]                # OPTIONS request
      GET [path] [OPTIONS]                    # GET request
      DELETE [path] [OPTIONS]                 # DELETE request
      PUT [path] [data] [OPTIONS]             # PUT request
      POST [path] [data] [OPTIONS]            # POST request
      TRACE [path] [OPTIONS]                  # TRACE request
      PATCH [path] [OPTIONS]                  # PATCH request

      Options:

      -Q            Don't URL encode the path.
      -q <query>    Send query string with the path. A '?' is prepended to
                    <query> and concatenated onto the <path>.
      -W            Don't write to history file (only when sourcing script).    !!!
      -V            Edit the input data interactively in 'vi'. (PUT and POST
                    requests only, with data piped to stdin.)
      -v            Verbose output. When used with the adenosine command itself
                    this prints the saved curl options along with the current
                    URI base. Otherwise this is passed to curl for verbose
                    curl output.
      <curl opt>    Any curl options will be passed down to curl.

=head1 Configuration, Data File Locations

Adenosine creates a few files in either your C<${XDG_CONFIG_HOME}> and C<${XDG_DATA_HOME}>
directory (if your system uses the XDG directory standard) or in the F<~/.resty>
directory, otherwise.

=head2 Using Existing, Pre-v2.1 Configuration Files With v2.1

If you had resty installed before version 2.1 and your system uses the XDG
config directory standard and you want to continue using your existing
configuration files, please make a backup of your F<~/.resty> directory
and then do:

      $ mkdir -p "${XDG_CONFIG_HOME}/resty" "${XDG_DATA_HOME}/resty"
      $ mv ~/.resty/c "${XDG_DATA_HOME}/resty"
      $ mv ~/.resty/* "${XDG_CONFIG_HOME}/resty"

=head1 Request URI Base

The request URI base is what the eventual URI to which the requests will be
made is based on. Specifically, it is a URI that may contain the C<*> character
one or more times. The C<*> will be replaced with the C<path> parameter in the
C<OPTIONS>, C<HEAD>, C<GET>, C<POST>, C<PUT>, C<PATCH> or C<DELETE> request as
described above.

For example:

      $ adenosine 'http://127.0.0.1:8080/data*.json'
      http://127.0.0.1:8080/data*.json

and then

      $ GET /5
      { "the_response" : true }

would result in a `GET` request to the URI C<http://127.0.0.1:8080/data/5.json>.

If no C<*> character is specified when setting the base URI, it's just added
onto the end for you automatically.

=head2 HTTPS URIs

HTTPS URIs can be used, as well. For example:

      $ adenosine 'https://example.com/doit'
      https://example.com/doit*

=head2 URI Base History

The URI base is saved to an rc file (F<${XDG_CONFIG_HOME}/resty/host> or F<~/.resty/host>)
each time it's set, and the last setting is saved in an environment variable C<!!!>
(C<$_resty_host>).  The URI base is read from the rc file when resty starts
up, but only if the C<$_resty_host> environment variable is not set.
In this way you can make requests to different hosts using resty from
separate terminals, and have a different URI base for each terminal.

If you want to see what the current URI base is, just run C<adenosine> with no
arguments. The URI base will be printed to stdout.

=head1 The Optional Path Parameter

The HTTP verbs (C<OPTIONS>, C<HEAD>, C<GET>, C<POST>, C<PUT>, C<PATCH> and
C<DELETE>) first argument is always
an optional URI path. This path must always start with a C</> character. If
the path parameter is not provided on the command line, adenosine will just use
the last path it was provided with. This "last path" is stored in an
environment variable (C<$_resty_path>), so each terminal basically has its C<!!!>
own "last path".

=head2 URL Encoding Of Path Parameter



( run in 0.435 second using v1.01-cache-2.11-cpan-fe3c2283af0 )