Test

<back to all web services

StoreLogs

import 'package:servicestack/servicestack.dart';
import 'dart:typed_data';

class Channel implements IConvertible
{
    String? name;
    String? value;

    Channel({this.name,this.value});
    Channel.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        name = json['name'];
        value = json['value'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'name': name,
        'value': value
    };

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

class Device implements IConvertible
{
    int? id;
    String? type;
    int? timeStamp;
    List<Channel>? channels;

    Device({this.id,this.type,this.timeStamp,this.channels});
    Device.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        type = json['type'];
        timeStamp = json['timeStamp'];
        channels = JsonConverters.fromJson(json['channels'],'List<Channel>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'type': type,
        'timeStamp': timeStamp,
        'channels': JsonConverters.toJson(channels,'List<Channel>',context!)
    };

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

class Logger implements IConvertible
{
    int? id;
    List<Device>? devices;

    Logger({this.id,this.devices});
    Logger.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

    Map<String, dynamic> toJson() => {
        'id': id,
        'devices': JsonConverters.toJson(devices,'List<Device>',context!)
    };

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

class StoreLogs implements IConvertible
{
    List<Logger>? loggers;

    StoreLogs({this.loggers});
    StoreLogs.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

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

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

class StoreLogsResponse implements IConvertible
{
    List<Logger>? existingLogs;
    ResponseStatus? responseStatus;

    StoreLogsResponse({this.existingLogs,this.responseStatus});
    StoreLogsResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

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

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

TypeContext _ctx = TypeContext(library: 'test.servicestack.net', types: <String, TypeInfo> {
    'Channel': TypeInfo(TypeOf.Class, create:() => Channel()),
    'Device': TypeInfo(TypeOf.Class, create:() => Device()),
    'List<Channel>': TypeInfo(TypeOf.Class, create:() => <Channel>[]),
    'Logger': TypeInfo(TypeOf.Class, create:() => Logger()),
    'List<Device>': TypeInfo(TypeOf.Class, create:() => <Device>[]),
    'StoreLogs': TypeInfo(TypeOf.Class, create:() => StoreLogs()),
    'List<Logger>': TypeInfo(TypeOf.Class, create:() => <Logger>[]),
    'StoreLogsResponse': TypeInfo(TypeOf.Class, create:() => StoreLogsResponse()),
});

Dart StoreLogs 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 /jsv/reply/StoreLogs HTTP/1.1 
Host: test.servicestack.net 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	loggers: 
	[
		{
			id: 0,
			devices: 
			[
				{
					id: 0,
					type: String,
					timeStamp: 0,
					channels: 
					[
						{
							name: String,
							value: String
						}
					]
				}
			]
		}
	]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	existingLogs: 
	[
		{
			id: 0,
			devices: 
			[
				{
					id: 0,
					type: String,
					timeStamp: 0,
					channels: 
					[
						{
							name: String,
							value: String
						}
					]
				}
			]
		}
	],
	responseStatus: 
	{
		errorCode: String,
		message: String,
		stackTrace: String,
		errors: 
		[
			{
				errorCode: String,
				fieldName: String,
				message: String,
				meta: 
				{
					String: String
				}
			}
		],
		meta: 
		{
			String: String
		}
	}
}