ASH.ResourceLibrary.WebApi

<back to all web services

HealthCheckRequest

The following routes are available for this service:
All Verbs/health
import 'package:servicestack/servicestack.dart';

// @flags()
// @DataContract
class HealthStatus
{
    static const HealthStatus Healthy = const HealthStatus._(0);
    static const HealthStatus Degraded = const HealthStatus._(4);
    static const HealthStatus Unhealthy = const HealthStatus._(8);

    final int _value;
    const HealthStatus._(this._value);
    int get value => _value;
    static List<HealthStatus> get values => const [Healthy,Degraded,Unhealthy];
}

// @DataContract
class HealthReportEntry implements IConvertible
{
    // @DataMember
    HealthStatus? status;

    // @DataMember
    String? description;

    // @DataMember
    Duration? duration;

    // @DataMember
    Exception? exception;

    // @DataMember
    IReadOnlyDictionary<String,dynamic>? data;

    HealthReportEntry({this.status,this.description,this.duration,this.exception,this.data});
    HealthReportEntry.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        status = JsonConverters.fromJson(json['status'],'HealthStatus',context!);
        description = json['description'];
        duration = JsonConverters.fromJson(json['duration'],'Duration',context!);
        exception = JsonConverters.fromJson(json['exception'],'Exception',context!);
        data = JsonConverters.fromJson(json['data'],'IReadOnlyDictionary<String,dynamic>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'status': JsonConverters.toJson(status,'HealthStatus',context!),
        'description': description,
        'duration': JsonConverters.toJson(duration,'Duration',context!),
        'exception': JsonConverters.toJson(exception,'Exception',context!),
        'data': JsonConverters.toJson(data,'IReadOnlyDictionary<String,dynamic>',context!)
    };

    getTypeName() => "HealthReportEntry";
    TypeContext? context = _ctx;
}

// @DataContract
class HealthReport implements IConvertible
{
    // @DataMember
    IReadOnlyDictionary<String,HealthReportEntry>? entries;

    // @DataMember
    HealthStatus? applicationStatus;

    // @DataMember
    Duration? duration;

    HealthReport({this.entries,this.applicationStatus,this.duration});
    HealthReport.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        entries = JsonConverters.fromJson(json['entries'],'IReadOnlyDictionary<String,HealthReportEntry>',context!);
        applicationStatus = JsonConverters.fromJson(json['applicationStatus'],'HealthStatus',context!);
        duration = JsonConverters.fromJson(json['duration'],'Duration',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'entries': JsonConverters.toJson(entries,'IReadOnlyDictionary<String,HealthReportEntry>',context!),
        'applicationStatus': JsonConverters.toJson(applicationStatus,'HealthStatus',context!),
        'duration': JsonConverters.toJson(duration,'Duration',context!)
    };

    getTypeName() => "HealthReport";
    TypeContext? context = _ctx;
}

class HealthCheckRequest implements IConvertible
{
    HealthCheckRequest();
    HealthCheckRequest.fromJson(Map<String, dynamic> json) : super();
    fromMap(Map<String, dynamic> json) {
        return this;
    }

    Map<String, dynamic> toJson() => {};
    getTypeName() => "HealthCheckRequest";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'resourcelibrary.api.ashcompanies.com', types: <String, TypeInfo> {
    'HealthStatus': TypeInfo(TypeOf.Enum, enumValues:HealthStatus.values),
    'HealthReportEntry': TypeInfo(TypeOf.Class, create:() => HealthReportEntry()),
    'Exception': TypeInfo(TypeOf.Class, create:() => Exception()),
    'IReadOnlyDictionary<String,dynamic>': TypeInfo(TypeOf.Class, create:() => IReadOnlyDictionary<String,dynamic>()),
    'HealthReport': TypeInfo(TypeOf.Class, create:() => HealthReport()),
    'IReadOnlyDictionary<String,HealthReportEntry>': TypeInfo(TypeOf.Class, create:() => IReadOnlyDictionary<String,HealthReportEntry>()),
    'HealthCheckRequest': TypeInfo(TypeOf.Class, create:() => HealthCheckRequest()),
});

Dart HealthCheckRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /health HTTP/1.1 
Host: resourcelibrary.api.ashcompanies.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<HealthCheckRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ASH.Services.HealthChecks.ServiceStack" />
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<HealthReport xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ASH.Services.HealthChecks.DTO">
  <ApplicationStatus />
  <Duration>PT0S</Duration>
  <Entries i:nil="true" />
</HealthReport>