Test

<back to all web services

StoreRockstars

The following routes are available for this service:
POST/rockstars
import 'package:servicestack/servicestack.dart';
import 'dart:typed_data';
import 'dart:collection';

class Rockstar implements IConvertible
{
    int? id;
    String? firstName;
    String? lastName;
    int? age;

    Rockstar({this.id,this.firstName,this.lastName,this.age});
    Rockstar.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

    Map<String, dynamic> toJson() => {
        'id': id,
        'firstName': firstName,
        'lastName': lastName,
        'age': age
    };

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

class StoreRockstars extends ListBase<Rockstar> implements IConvertible
{
    final List<Rockstar> l = [];
    set length(int newLength) { l.length = newLength; }
    int get length => l.length;
    Rockstar operator [](int index) => l[index];
    void operator []=(int index, Rockstar value) { l[index] = value; }
    StoreRockstars();
    StoreRockstars.fromJson(Map<String, dynamic> json) : super();
    fromMap(Map<String, dynamic> json) {
        return this;
    }

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

TypeContext _ctx = TypeContext(library: 'test.servicestack.net', types: <String, TypeInfo> {
    'Rockstar': TypeInfo(TypeOf.Class, create:() => Rockstar()),
    'StoreRockstars': TypeInfo(TypeOf.Class, create:() => StoreRockstars()),
});

Dart StoreRockstars DTOs

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

HTTP + CSV

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

POST /rockstars HTTP/1.1 
Host: test.servicestack.net 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

[]
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

[]