BokaMera.API.Host

<back to all web services

NewsletterCustomerQuery

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin, bookingsupplier-administrator-read
The following routes are available for this service:
GET/newsletter/customersGet all customers that are valid for sending newsletters to.Get all customers that are valid for sending newsletters to.
import 'package:servicestack/servicestack.dart';

class NewsletterCustomerInfo implements IConvertible
{
    String? Id;
    String? Firstname;
    String? Lastname;
    String? Email;
    String? Phone;
    String? FacebookUserName;
    Uri? ImageUrl;

    NewsletterCustomerInfo({this.Id,this.Firstname,this.Lastname,this.Email,this.Phone,this.FacebookUserName,this.ImageUrl});
    NewsletterCustomerInfo.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        Firstname = json['Firstname'];
        Lastname = json['Lastname'];
        Email = json['Email'];
        Phone = json['Phone'];
        FacebookUserName = json['FacebookUserName'];
        ImageUrl = JsonConverters.fromJson(json['ImageUrl'],'Uri',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'Firstname': Firstname,
        'Lastname': Lastname,
        'Email': Email,
        'Phone': Phone,
        'FacebookUserName': FacebookUserName,
        'ImageUrl': JsonConverters.toJson(ImageUrl,'Uri',context!)
    };

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

class NewsletterCustomerQueryResponse implements IConvertible
{
    String? Id;
    NewsletterCustomerInfo? Customer;

    NewsletterCustomerQueryResponse({this.Id,this.Customer});
    NewsletterCustomerQueryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        Customer = JsonConverters.fromJson(json['Customer'],'NewsletterCustomerInfo',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'Customer': JsonConverters.toJson(Customer,'NewsletterCustomerInfo',context!)
    };

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

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ValidateRequest(Validator="IsAuthenticated")
class NewsletterCustomerQuery 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;

    /**
    * Search for customer has done minimum number of bookings.
    */
    // @ApiMember(Description="Search for customer has done minimum number of bookings.")
    int? CustomerMinBookings;

    /**
    * Search for customer has done maximum number of bookings.
    */
    // @ApiMember(Description="Search for customer has done maximum number of bookings.")
    int? CustomerMaxBookings;

    /**
    * Search for customer has booked any of the service in the list (List contain service id's).
    */
    // @ApiMember(Description="Search for customer has booked any of the service in the list (List contain service id's).")
    List<int>? BookedServiceIds;

    /**
    * Search interval From datetime .
    */
    // @ApiMember(Description="Search interval From datetime .")
    DateTime? From;

    /**
    * Search interval To datetime .
    */
    // @ApiMember(Description="Search interval To datetime .")
    DateTime? To;

    /**
    * The max number of records you want to collect
    */
    // @ApiMember(Description="The max number of records you want to collect")
    int? MaxRecords;

    /**
    * If you want to include the full customer information in the response
    */
    // @ApiMember(Description="If you want to include the full customer information in the response")
    bool? IncludeCustomerInformation;

    NewsletterCustomerQuery({this.CompanyId,this.CustomerMinBookings,this.CustomerMaxBookings,this.BookedServiceIds,this.From,this.To,this.MaxRecords,this.IncludeCustomerInformation});
    NewsletterCustomerQuery.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        CompanyId = json['CompanyId'];
        CustomerMinBookings = json['CustomerMinBookings'];
        CustomerMaxBookings = json['CustomerMaxBookings'];
        BookedServiceIds = JsonConverters.fromJson(json['BookedServiceIds'],'List<int>',context!);
        From = JsonConverters.fromJson(json['From'],'DateTime',context!);
        To = JsonConverters.fromJson(json['To'],'DateTime',context!);
        MaxRecords = json['MaxRecords'];
        IncludeCustomerInformation = json['IncludeCustomerInformation'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'CompanyId': CompanyId,
        'CustomerMinBookings': CustomerMinBookings,
        'CustomerMaxBookings': CustomerMaxBookings,
        'BookedServiceIds': JsonConverters.toJson(BookedServiceIds,'List<int>',context!),
        'From': JsonConverters.toJson(From,'DateTime',context!),
        'To': JsonConverters.toJson(To,'DateTime',context!),
        'MaxRecords': MaxRecords,
        'IncludeCustomerInformation': IncludeCustomerInformation
    };

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

TypeContext _ctx = TypeContext(library: 'api.bokamera.se', types: <String, TypeInfo> {
    'NewsletterCustomerInfo': TypeInfo(TypeOf.Class, create:() => NewsletterCustomerInfo()),
    'Uri': TypeInfo(TypeOf.Class, create:() => Uri()),
    'NewsletterCustomerQueryResponse': TypeInfo(TypeOf.Class, create:() => NewsletterCustomerQueryResponse()),
    'NewsletterCustomerQuery': TypeInfo(TypeOf.Class, create:() => NewsletterCustomerQuery()),
});

Dart NewsletterCustomerQuery 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.

GET /newsletter/customers HTTP/1.1 
Host: api.bokamera.se 
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"Customer":{"Firstname":"String","Lastname":"String","Email":"String","Phone":"String","FacebookUserName":"String"}}