Show / Hide Table of Contents

Class Response<TModel>

An API response

Inheritance
Object
Response<TModel>
BasicResponse<TModel>
Namespace: Seltzr.Responses
Assembly: Seltzr.dll
Syntax
C#
public class Response<TModel>
    where TModel : class
Type Parameters
TModel

The model that the response contains

Constructors

| Improve this Doc View Source

Response()

Initializes a new instance of the Response<TModel> class.

C#
public Response()

Methods

| Improve this Doc View Source

GetIncludedProperties()

Gets all of the properties on this Response<TModel> that should be included in the serialized body

C#
public PropertyInfo[] GetIncludedProperties()
Returns

PropertyInfo[]

All of the properties on this Response<TModel> that should be included in the serialized body

| Improve this Doc View Source

GetOmittedProperties()

Gets all of the properties on this Response<TModel> that should not be included in the serialized body

C#
public PropertyInfo[] GetOmittedProperties()
Returns

PropertyInfo[]

All of the properties on this Response<TModel> that should not be included in the serialized body

| Improve this Doc View Source

Populate(TModel[], Boolean)

Populates the model property on this Response<TModel>

C#
public virtual void Populate(TModel[] models, bool shouldStrip)
Parameters
modelsTModel[]

The model dataset

shouldStripBoolean

true to strip the array if there's only one element, false otherwise

| Improve this Doc View Source

Set(String, Object)

Sets the value of all properties on this Response<TModel> that have the ResponseValueAttribute with the given name applied to them. If no such properties exist, no action will occur.

C#
public virtual void Set(string name, object value)
Parameters
nameString

The name given to the ResponseValueAttribute on the properties to set

valueObject

The value to assign to that property

| Improve this Doc View Source

Set<TAttribute>(Object)

Sets the value of all properties on this Response<TModel> that have the given attribute applied to them. If no such properties exist, no action will occur.

C#
public virtual void Set<TAttribute>(object value)
    where TAttribute : Attribute
Parameters
valueObject

The value to assign to that property

Type Parameters
TAttribute

The attribute to match on the properties to set

| Improve this Doc View Source

SetString(String, String)

Sets the value of all properties on this Response<TModel> that have the ResponseValueAttribute with the given name applied to them. If no such properties exist, no action will occur.

C#
public virtual void SetString(string name, string value)
Parameters
nameString

The name given to the ResponseValueAttribute on the properties to set

valueString

The string value to assign to that property

Remarks

This method will attempt to convert the string value to a supported type if the type of the matching property is not string.

| Improve this Doc View Source

SetString<TAttribute>(String)

Sets the value of all properties on this Response<TModel> that have the given attribute applied to them. If no such properties exist, no action will occur.

C#
public virtual void SetString<TAttribute>(string value)
    where TAttribute : Attribute
Parameters
valueString

The string value to assign to that property

Type Parameters
TAttribute

The attribute to match on the properties to set

Remarks

This method will attempt to convert the string value to a supported type if the type of the matching property is not string.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX