PUT | /newsletter/subscribe | Subscribed to newsletter |
---|
import 'package:servicestack/servicestack.dart';
class SubscribedUserResponse implements IConvertible
{
bool? Subscribed;
String? CompanyId;
SubscribedUserResponse({this.Subscribed,this.CompanyId});
SubscribedUserResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Subscribed = json['Subscribed'];
CompanyId = json['CompanyId'];
return this;
}
Map<String, dynamic> toJson() => {
'Subscribed': Subscribed,
'CompanyId': CompanyId
};
getTypeName() => "SubscribedUserResponse";
TypeContext? context = _ctx;
}
// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
class SubscribeToNewsletter implements ICompany, IConvertible
{
/**
* The company id, if empty will use the company id for the user you are logged in with.
*/
// @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.")
String? CompanyId;
/**
* Companies for which user is subscribed.
*/
// @ApiMember(Description="Companies for which user is subscribed.", IsRequired=true)
List<SubscribedUserResponse>? SubscribedCompanies;
SubscribeToNewsletter({this.CompanyId,this.SubscribedCompanies});
SubscribeToNewsletter.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
CompanyId = json['CompanyId'];
SubscribedCompanies = JsonConverters.fromJson(json['SubscribedCompanies'],'List<SubscribedUserResponse>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'CompanyId': CompanyId,
'SubscribedCompanies': JsonConverters.toJson(SubscribedCompanies,'List<SubscribedUserResponse>',context!)
};
getTypeName() => "SubscribeToNewsletter";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'api.bokamera.se', types: <String, TypeInfo> {
'SubscribedUserResponse': TypeInfo(TypeOf.Class, create:() => SubscribedUserResponse()),
'SubscribeToNewsletter': TypeInfo(TypeOf.Class, create:() => SubscribeToNewsletter()),
'List<SubscribedUserResponse>': TypeInfo(TypeOf.Class, create:() => <SubscribedUserResponse>[]),
});
Dart SubscribeToNewsletter DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
PUT /newsletter/subscribe HTTP/1.1
Host: api.bokamera.se
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
CompanyId: 00000000-0000-0000-0000-000000000000,
SubscribedCompanies:
[
{
Subscribed: False
}
]
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length [ { Subscribed: False } ]