Trendsic Platform Service

<back to all web services

CorrectiveActionCreateRequest

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

class CorrectiveAction implements IConvertible
{
    int? CorrectiveActionID;
    String? BranchId;
    int? SafetyIncidentID;
    String? Description;
    String? Owner;
    DateTime? DueDate;
    String? Status;
    String? Priority;
    DateTime? CompletedAt;
    String? IncidentNo;
    String? IncidentTitle;
    String? CreatedBy;
    DateTime? CreatedAt;
    DateTime? UpdatedAt;

    CorrectiveAction({this.CorrectiveActionID,this.BranchId,this.SafetyIncidentID,this.Description,this.Owner,this.DueDate,this.Status,this.Priority,this.CompletedAt,this.IncidentNo,this.IncidentTitle,this.CreatedBy,this.CreatedAt,this.UpdatedAt});
    CorrectiveAction.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        CorrectiveActionID = json['CorrectiveActionID'];
        BranchId = json['BranchId'];
        SafetyIncidentID = json['SafetyIncidentID'];
        Description = json['Description'];
        Owner = json['Owner'];
        DueDate = JsonConverters.fromJson(json['DueDate'],'DateTime',context!);
        Status = json['Status'];
        Priority = json['Priority'];
        CompletedAt = JsonConverters.fromJson(json['CompletedAt'],'DateTime',context!);
        IncidentNo = json['IncidentNo'];
        IncidentTitle = json['IncidentTitle'];
        CreatedBy = json['CreatedBy'];
        CreatedAt = JsonConverters.fromJson(json['CreatedAt'],'DateTime',context!);
        UpdatedAt = JsonConverters.fromJson(json['UpdatedAt'],'DateTime',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'CorrectiveActionID': CorrectiveActionID,
        'BranchId': BranchId,
        'SafetyIncidentID': SafetyIncidentID,
        'Description': Description,
        'Owner': Owner,
        'DueDate': JsonConverters.toJson(DueDate,'DateTime',context!),
        'Status': Status,
        'Priority': Priority,
        'CompletedAt': JsonConverters.toJson(CompletedAt,'DateTime',context!),
        'IncidentNo': IncidentNo,
        'IncidentTitle': IncidentTitle,
        'CreatedBy': CreatedBy,
        'CreatedAt': JsonConverters.toJson(CreatedAt,'DateTime',context!),
        'UpdatedAt': JsonConverters.toJson(UpdatedAt,'DateTime',context!)
    };

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

class CorrectiveActionListResponse implements IConvertible
{
    ResponseStatus? ResponseStatus;
    List<CorrectiveAction>? Actions = [];

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

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

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

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

class CorrectiveActionCreateRequest implements IConvertible
{
    int? SafetyIncidentID;
    String? Description;
    String? Owner;
    DateTime? DueDate;
    String? Priority;

    CorrectiveActionCreateRequest({this.SafetyIncidentID,this.Description,this.Owner,this.DueDate,this.Priority});
    CorrectiveActionCreateRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        SafetyIncidentID = json['SafetyIncidentID'];
        Description = json['Description'];
        Owner = json['Owner'];
        DueDate = JsonConverters.fromJson(json['DueDate'],'DateTime',context!);
        Priority = json['Priority'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'SafetyIncidentID': SafetyIncidentID,
        'Description': Description,
        'Owner': Owner,
        'DueDate': JsonConverters.toJson(DueDate,'DateTime',context!),
        'Priority': Priority
    };

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

TypeContext _ctx = TypeContext(library: 'api.dev.dynamics.trendsic.com', types: <String, TypeInfo> {
    'CorrectiveAction': TypeInfo(TypeOf.Class, create:() => CorrectiveAction()),
    'CorrectiveActionListResponse': TypeInfo(TypeOf.Class, create:() => CorrectiveActionListResponse()),
    'List<CorrectiveAction>': TypeInfo(TypeOf.Class, create:() => <CorrectiveAction>[]),
    'CorrectiveActionCreateRequest': TypeInfo(TypeOf.Class, create:() => CorrectiveActionCreateRequest()),
});

Dart CorrectiveActionCreateRequest 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.

POST /v1/safety/actions HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	SafetyIncidentID: 0,
	Description: String,
	Owner: String,
	DueDate: 0001-01-01,
	Priority: String
}
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
		}
	},
	Actions: 
	[
		{
			CorrectiveActionID: 0,
			BranchId: 00000000000000000000000000000000,
			SafetyIncidentID: 0,
			Description: String,
			Owner: String,
			DueDate: 0001-01-01,
			Status: String,
			Priority: String,
			CompletedAt: 0001-01-01,
			IncidentNo: String,
			IncidentTitle: String,
			CreatedBy: String,
			CreatedAt: 0001-01-01,
			UpdatedAt: 0001-01-01
		}
	]
}