Blazor Diffusion

<back to all web services

UpdateSignup

Analytics
Requires Authentication
Required role:Moderator
import 'package:servicestack/servicestack.dart';

class StatBase implements IConvertible
{
    String? refId;
    int? appUserId;
    String? rawUrl;
    String? remoteIp;
    DateTime? createdDate;

    StatBase({this.refId,this.appUserId,this.rawUrl,this.remoteIp,this.createdDate});
    StatBase.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        refId = json['refId'];
        appUserId = json['appUserId'];
        rawUrl = json['rawUrl'];
        remoteIp = json['remoteIp'];
        createdDate = JsonConverters.fromJson(json['createdDate'],'DateTime',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'refId': refId,
        'appUserId': appUserId,
        'rawUrl': rawUrl,
        'remoteIp': remoteIp,
        'createdDate': JsonConverters.toJson(createdDate,'DateTime',context!)
    };

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

enum SignupType
{
    Updates,
    Beta,
}

class Signup extends StatBase implements IConvertible
{
    int? id;
    SignupType? type;
    String? email;
    String? name;
    DateTime? cancelledDate;

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

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        id = json['id'];
        type = JsonConverters.fromJson(json['type'],'SignupType',context!);
        email = json['email'];
        name = json['name'];
        cancelledDate = JsonConverters.fromJson(json['cancelledDate'],'DateTime',context!);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'id': id,
        'type': JsonConverters.toJson(type,'SignupType',context!),
        'email': email,
        'name': name,
        'cancelledDate': JsonConverters.toJson(cancelledDate,'DateTime',context!)
    });

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

// @ValidateRequest(Validator="HasRole(`Moderator`)")
class UpdateSignup implements IPatchDb<Signup>, IConvertible
{
    int? id;
    SignupType? type;
    // @Validate(Validator="Email")
    String? email;

    String? name;
    DateTime? cancelledDate;

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

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        type = JsonConverters.fromJson(json['type'],'SignupType',context!);
        email = json['email'];
        name = json['name'];
        cancelledDate = JsonConverters.fromJson(json['cancelledDate'],'DateTime',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'type': JsonConverters.toJson(type,'SignupType',context!),
        'email': email,
        'name': name,
        'cancelledDate': JsonConverters.toJson(cancelledDate,'DateTime',context!)
    };

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

TypeContext _ctx = TypeContext(library: 'blazordiffusion.com', types: <String, TypeInfo> {
    'StatBase': TypeInfo(TypeOf.Class, create:() => StatBase()),
    'SignupType': TypeInfo(TypeOf.Enum, enumValues:SignupType.values),
    'Signup': TypeInfo(TypeOf.Class, create:() => Signup()),
    'UpdateSignup': TypeInfo(TypeOf.Class, create:() => UpdateSignup()),
});

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

{"id":0,"type":"Updates","email":"String","name":"String","cancelledDate":"0001-01-01T00:00:00"}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"id":0,"type":"Updates","email":"String","name":"String","cancelledDate":"0001-01-01T00:00:00","refId":"String","appUserId":0,"rawUrl":"String","remoteIp":"String","createdDate":"0001-01-01T00:00:00"}