Blazor Diffusion

<back to all web services

SearchData

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

class ArtistInfo implements IConvertible
{
    int? id;
    String? name;
    String? type;

    ArtistInfo({this.id,this.name,this.type});
    ArtistInfo.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

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

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

class ModifierInfo implements IConvertible
{
    int? id;
    String? name;
    String? category;

    ModifierInfo({this.id,this.name,this.category});
    ModifierInfo.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

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

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

class SearchDataResponse implements IConvertible
{
    List<ArtistInfo>? artists = [];
    List<ModifierInfo>? modifiers = [];

    SearchDataResponse({this.artists,this.modifiers});
    SearchDataResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

    Map<String, dynamic> toJson() => {
        'artists': JsonConverters.toJson(artists,'List<ArtistInfo>',context!),
        'modifiers': JsonConverters.toJson(modifiers,'List<ModifierInfo>',context!)
    };

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

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

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

TypeContext _ctx = TypeContext(library: 'blazordiffusion.com', types: <String, TypeInfo> {
    'ArtistInfo': TypeInfo(TypeOf.Class, create:() => ArtistInfo()),
    'ModifierInfo': TypeInfo(TypeOf.Class, create:() => ModifierInfo()),
    'SearchDataResponse': TypeInfo(TypeOf.Class, create:() => SearchDataResponse()),
    'List<ArtistInfo>': TypeInfo(TypeOf.Class, create:() => <ArtistInfo>[]),
    'List<ModifierInfo>': TypeInfo(TypeOf.Class, create:() => <ModifierInfo>[]),
    'SearchData': TypeInfo(TypeOf.Class, create:() => SearchData()),
});

Dart SearchData 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/SearchData HTTP/1.1 
Host: blazordiffusion.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	artists: 
	[
		{
			id: 0,
			name: String,
			type: String
		}
	],
	modifiers: 
	[
		{
			id: 0,
			name: String,
			category: String
		}
	]
}