Required role: | User |
POST | /app/tokens |
---|
import 'package:servicestack/servicestack.dart';
import 'dart:typed_data';
enum DeviceTypes
{
Web,
iOS,
Android,
}
class DeviceTokenInfo implements IConvertible
{
DeviceTypes? deviceType;
String? token;
DeviceTokenInfo({this.deviceType,this.token});
DeviceTokenInfo.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
deviceType = JsonConverters.fromJson(json['deviceType'],'DeviceTypes',context!);
token = json['token'];
return this;
}
Map<String, dynamic> toJson() => {
'deviceType': JsonConverters.toJson(deviceType,'DeviceTypes',context!),
'token': token
};
getTypeName() => "DeviceTokenInfo";
TypeContext? context = _ctx;
}
/**
* Create a new device token if it doesn't exist already
*/
// @Api(Description="Create a new device token if it doesn't exist already")
class NewDeviceToken implements IPost, IConvertible
{
/**
* The type of device
*/
// @ApiMember(Description="The type of device")
DeviceTypes? deviceType;
/**
* The device token to save
*/
// @ApiMember(Description="The device token to save")
String? token;
NewDeviceToken({this.deviceType,this.token});
NewDeviceToken.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
deviceType = JsonConverters.fromJson(json['deviceType'],'DeviceTypes',context!);
token = json['token'];
return this;
}
Map<String, dynamic> toJson() => {
'deviceType': JsonConverters.toJson(deviceType,'DeviceTypes',context!),
'token': token
};
getTypeName() => "NewDeviceToken";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'team.evovoice.io', types: <String, TypeInfo> {
'DeviceTypes': TypeInfo(TypeOf.Enum, enumValues:DeviceTypes.values),
'DeviceTokenInfo': TypeInfo(TypeOf.Class, create:() => DeviceTokenInfo()),
'NewDeviceToken': TypeInfo(TypeOf.Class, create:() => NewDeviceToken()),
});
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /app/tokens HTTP/1.1
Host: team.evovoice.io
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"deviceType":"Web","token":"String"}
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {"deviceType":"Web","token":"String"}