Trendsic Platform Service

<back to all web services

SafetyMetricsRequest

Requires Authentication
The following routes are available for this service:
GET,OPTIONS/v1/safety/metrics
import 'package:servicestack/servicestack.dart';

class SafetyMetrics implements IConvertible
{
    int? DaysWithoutRecordable;
    double? Trir;
    int? OpenIncidents;
    int? CorrectiveCount;
    int? ToolboxTalksWeek;
    int? ObservationsMonth;
    int? Recordables12mo;
    double? LaborHours12mo;

    SafetyMetrics({this.DaysWithoutRecordable,this.Trir,this.OpenIncidents,this.CorrectiveCount,this.ToolboxTalksWeek,this.ObservationsMonth,this.Recordables12mo,this.LaborHours12mo});
    SafetyMetrics.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        DaysWithoutRecordable = json['DaysWithoutRecordable'];
        Trir = JsonConverters.toDouble(json['Trir']);
        OpenIncidents = json['OpenIncidents'];
        CorrectiveCount = json['CorrectiveCount'];
        ToolboxTalksWeek = json['ToolboxTalksWeek'];
        ObservationsMonth = json['ObservationsMonth'];
        Recordables12mo = json['Recordables12mo'];
        LaborHours12mo = JsonConverters.toDouble(json['LaborHours12mo']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'DaysWithoutRecordable': DaysWithoutRecordable,
        'Trir': Trir,
        'OpenIncidents': OpenIncidents,
        'CorrectiveCount': CorrectiveCount,
        'ToolboxTalksWeek': ToolboxTalksWeek,
        'ObservationsMonth': ObservationsMonth,
        'Recordables12mo': Recordables12mo,
        'LaborHours12mo': LaborHours12mo
    };

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

class SafetyMetricsResponse implements IConvertible
{
    ResponseStatus? ResponseStatus;
    SafetyMetrics? Metrics;

    SafetyMetricsResponse({this.ResponseStatus,this.Metrics});
    SafetyMetricsResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
        Metrics = JsonConverters.fromJson(json['Metrics'],'SafetyMetrics',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!),
        'Metrics': JsonConverters.toJson(Metrics,'SafetyMetrics',context!)
    };

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

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

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

TypeContext _ctx = TypeContext(library: 'api.dev.dynamics.trendsic.com', types: <String, TypeInfo> {
    'SafetyMetrics': TypeInfo(TypeOf.Class, create:() => SafetyMetrics()),
    'SafetyMetricsResponse': TypeInfo(TypeOf.Class, create:() => SafetyMetricsResponse()),
    'SafetyMetricsRequest': TypeInfo(TypeOf.Class, create:() => SafetyMetricsRequest()),
});

Dart SafetyMetricsRequest DTOs

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

HTTP + JSV

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

GET /v1/safety/metrics HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	},
	Metrics: 
	{
		DaysWithoutRecordable: 0,
		Trir: 0,
		OpenIncidents: 0,
		CorrectiveCount: 0,
		ToolboxTalksWeek: 0,
		ObservationsMonth: 0,
		Recordables12mo: 0,
		LaborHours12mo: 0
	}
}