Class: ServiceStack::QueryResponse
- Inherits:
-
Object
- Object
- ServiceStack::QueryResponse
- Includes:
- DTO
- Defined in:
- lib/servicestack/types.rb
Overview
The typed Response of AutoQuery Requests.
Use QueryResponse.of(Booking) for a Response that converts its results
into the specified Type, which is what generated AutoQuery DTOs return.
Class Attribute Summary collapse
-
.results_type ⇒ Object
Returns the value of attribute results_type.
Instance Attribute Summary collapse
-
#meta ⇒ Object
Returns the value of attribute meta.
-
#offset ⇒ Object
Returns the value of attribute offset.
-
#response_status ⇒ Object
Returns the value of attribute response_status.
-
#results ⇒ Object
Returns the value of attribute results.
-
#total ⇒ Object
Returns the value of attribute total.
Class Method Summary collapse
-
.of(type) ⇒ Object
A QueryResponse that converts its results into the specified Type.
- .properties ⇒ Object
Methods included from DTO
#==, included, #initialize, #inspect, #to_hash, #to_json
Class Attribute Details
.results_type ⇒ Object
Returns the value of attribute results_type.
150 151 152 |
# File 'lib/servicestack/types.rb', line 150 def results_type @results_type end |
Instance Attribute Details
#meta ⇒ Object
Returns the value of attribute meta.
147 148 149 |
# File 'lib/servicestack/types.rb', line 147 def @meta end |
#offset ⇒ Object
Returns the value of attribute offset.
147 148 149 |
# File 'lib/servicestack/types.rb', line 147 def offset @offset end |
#response_status ⇒ Object
Returns the value of attribute response_status.
147 148 149 |
# File 'lib/servicestack/types.rb', line 147 def response_status @response_status end |
#results ⇒ Object
Returns the value of attribute results.
147 148 149 |
# File 'lib/servicestack/types.rb', line 147 def results @results end |
#total ⇒ Object
Returns the value of attribute total.
147 148 149 |
# File 'lib/servicestack/types.rb', line 147 def total @total end |
Class Method Details
.of(type) ⇒ Object
A QueryResponse that converts its results into the specified Type.
153 154 155 156 157 158 |
# File 'lib/servicestack/types.rb', line 153 def of(type) @of_types ||= {} @of_types[type] ||= Class.new(self) do self.results_type = type end end |
.properties ⇒ Object
160 161 162 163 164 165 166 167 168 |
# File 'lib/servicestack/types.rb', line 160 def properties { offset: { name: 'offset' }, total: { name: 'total' }, results: { name: 'results', type: [results_type].compact }, meta: { name: 'meta' }, response_status: { name: 'responseStatus', type: ResponseStatus }, } end |