1 package Catalyst::Controller::DBIC::API::StaticArguments;
3 #ABSTRACT: Provides controller level configuration arguments
5 use MooseX::Types::Moose(':all');
6 use namespace::autoclean;
8 requires 'check_column_relation';
10 =attribute_public create_requires create_allows update_requires update_allows
12 These attributes control requirements and limits to columns when creating or updating objects.
14 Each provides a number of handles:
16 "get_${var}_column" => 'get'
17 "set_${var}_column" => 'set'
18 "delete_${var}_column" => 'delete'
19 "insert_${var}_column" => 'insert'
20 "count_${var}_column" => 'count'
21 "all_${var}_columns" => 'elements'
25 foreach my $var (qw/create_requires create_allows update_requires update_allows/)
30 isa => ArrayRef[Str|HashRef],
32 default => sub { [] },
35 my ($self, $new) = @_;
36 $self->check_column_relation($_, 1) for @$new;
40 "get_${var}_column" => 'get',
41 "set_${var}_column" => 'set',
42 "delete_${var}_column" => 'delete',
43 "insert_${var}_column" => 'insert',
44 "count_${var}_column" => 'count',
45 "all_${var}_columns" => 'elements',
49 before "set_${var}_column" => sub { $_[0]->check_column_relation($_[2], 1) }; #"
50 before "insert_${var}_column" => sub { $_[0]->check_column_relation($_[2], 1) }; #"
53 =attribute_public count_arg is: ro, isa: Str, default: 'list_count'
55 count_arg controls how to reference 'count' in the the request_data
59 has 'count_arg' => ( is => 'ro', isa => Str, default => 'list_count' );
61 =attribute_public page_arg is: ro, isa: Str, default: 'list_page'
63 page_arg controls how to reference 'page' in the the request_data
67 has 'page_arg' => ( is => 'ro', isa => Str, default => 'list_page' );
69 =attribute_public offset_arg is: ro, isa: Str, default: 'offset'
71 offset_arg controls how to reference 'offset' in the the request_data
75 has 'offset_arg' => ( is => 'ro', isa => Str, default => 'list_offset' );
77 =attribute_public select_arg is: ro, isa: Str, default: 'list_returns'
79 select_arg controls how to reference 'select' in the the request_data
83 has 'select_arg' => ( is => 'ro', isa => Str, default => 'list_returns' );
85 =attribute_public as_arg is: ro, isa: Str, default: 'as'
87 as_arg controls how to reference 'as' in the the request_data
91 has 'as_arg' => ( is => 'ro', isa => Str, default => 'as' );
93 =attribute_public search_arg is: ro, isa: Str, default: 'search'
95 search_arg controls how to reference 'search' in the the request_data
99 has 'search_arg' => ( is => 'ro', isa => Str, default => 'search' );
101 =attribute_public grouped_by_arg is: ro, isa: Str, default: 'list_grouped_by'
103 grouped_by_arg controls how to reference 'grouped_by' in the the request_data
107 has 'grouped_by_arg' => ( is => 'ro', isa => Str, default => 'list_grouped_by' );
109 =attribute_public ordered_by_arg is: ro, isa: Str, default: 'list_ordered_by'
111 ordered_by_arg controls how to reference 'ordered_by' in the the request_data
115 has 'ordered_by_arg' => ( is => 'ro', isa => Str, default => 'list_ordered_by' );
117 =attribute_public prefetch_arg is: ro, isa: Str, default: 'list_prefetch'
119 prefetch_arg controls how to reference 'prefetch' in the the request_data
123 has 'prefetch_arg' => ( is => 'ro', isa => Str, default => 'list_prefetch' );
125 =attribute_public data_root is: ro, isa: Str, default: 'listt'
127 data_root controls how to reference where the data is in the the request_data
131 has 'data_root' => ( is => 'ro', isa => Str, default => 'list');
133 =attribute_public total_entries_arg is: ro, isa: Str, default: 'totalcount'
135 total_entries_arg controls how to reference 'total_entries' in the the request_data
139 has 'total_entries_arg' => ( is => 'ro', isa => Str, default => 'totalcount' );
141 =attribute_public use_json_boolean is: ro, isa: Bool, default: 0
143 use_json_boolean controls whether JSON::Any boolean types are used in the success parameter of the response or if raw strings are used
147 has 'use_json_boolean' => ( is => 'ro', isa => Bool, default => 0 );
149 =attribute_public return_object is: ro, isa: Bool, default: 0
151 return_object controls whether the results of create/update are serialized and returned in the response
155 has 'return_object' => ( is => 'ro', isa => Bool, default => 0 );
159 StaticArguments is a Role that is composed by the controller to provide configuration parameters such as how where in the request data to find specific elements, and if to use JSON boolean types.