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

CatalystX::QueryModel::DoesQueryModel - Role to provide query model API

SYNOPSIS

Generally you will apply this role via CatalystX::QueryModel

See CatalystX::QueryModel for a more general overview.

DESCRIPTION

A role that gives a Catalyst::Model the ability to indicate which of its attributes should be consider query model data, as well as additional need meta data so that we can process it properly.

Since we need to wrap has you should never apply this role manually but rather instead use CatalystX::QueryModel to apply it for you. If you need to customize this role you will also need to subclass CatalystX::QueryModel and have that new subclass apply you custom role. Please ping me if you really need this since I guess we could change CatalystX::QueryModel to make it easier to supply a custom role, just let me know your use case.

METHODS

This class defines the following public API

nested_params

Returns all the attributes marked as request properties in the form of a hashref. If any of the properties refer to an array or indexed value, or an object, we automatically follow that to return all the property data below.

Attributes that are empty will be left out of the return data structure.

Easiest way to get all your data but then again you get a structure that is very tightly tied to your request model.

get

Accepts a list of attributes that refer to request properties and returns their values. In the case when the attribute listed has no value, you will instead get an undef.

EXCEPTIONS

This class can throw the following exceptions:

Invalid Request Content Body

If we can't create an instance of the request model we throw a CatalystX::RequestModel::Utils::BadRequest. This will get interpretated as an HTTP 400 status client error if you are using CatalystX::Errors.

AUTHOR

See CatalystX::QueryModel.

COPYRIGHT

See CatalystX::QueryModel.

LICENSE

See CatalystX::QueryModel.