BokaMera.API.Host

<back to all web services

CreateCustomerArticleFromArticle

The following routes are available for this service:
POST/customerarticle/fromarticleCreate CustomerArticle.Create CustomerArticle.
import 'package:servicestack/servicestack.dart';

class CustomerBase implements ICustomerBase, IConvertible
{
    String? CustomerId;
    String Firstname = "";
    String Lastname = "";
    String Email = "";
    String Phone = "";
    bool SubscribedToNewsletter;
    String PersonalIdentityNumber = "";

    CustomerBase({this.CustomerId,this.Firstname,this.Lastname,this.Email,this.Phone,this.SubscribedToNewsletter,this.PersonalIdentityNumber});
    CustomerBase.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        CustomerId = json['CustomerId'];
        Firstname = json['Firstname'];
        Lastname = json['Lastname'];
        Email = json['Email'];
        Phone = json['Phone'];
        SubscribedToNewsletter = json['SubscribedToNewsletter'];
        PersonalIdentityNumber = json['PersonalIdentityNumber'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'CustomerId': CustomerId,
        'Firstname': Firstname,
        'Lastname': Lastname,
        'Email': Email,
        'Phone': Phone,
        'SubscribedToNewsletter': SubscribedToNewsletter,
        'PersonalIdentityNumber': PersonalIdentityNumber
    };

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

class CustomerToHandle extends CustomerBase implements IConvertible
{
    CustomerToHandle();
    CustomerToHandle.fromJson(Map<String, dynamic> json) : super.fromJson(json);
    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson();
    getTypeName() => "CustomerToHandle";
    TypeContext? context = _ctx;
}

class InvoiceAddressToHandle implements IInvoiceAddress, IConvertible
{
    String CorporateIdentityNumber = "";
    String InvoiceAddress1 = "";
    String InvoiceAddress2 = "";
    String InvoiceCity = "";
    String InvoicePostalCode = "";
    String InvoiceCountryCode = "";

    InvoiceAddressToHandle({this.CorporateIdentityNumber,this.InvoiceAddress1,this.InvoiceAddress2,this.InvoiceCity,this.InvoicePostalCode,this.InvoiceCountryCode});
    InvoiceAddressToHandle.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        CorporateIdentityNumber = json['CorporateIdentityNumber'];
        InvoiceAddress1 = json['InvoiceAddress1'];
        InvoiceAddress2 = json['InvoiceAddress2'];
        InvoiceCity = json['InvoiceCity'];
        InvoicePostalCode = json['InvoicePostalCode'];
        InvoiceCountryCode = json['InvoiceCountryCode'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'CorporateIdentityNumber': CorporateIdentityNumber,
        'InvoiceAddress1': InvoiceAddress1,
        'InvoiceAddress2': InvoiceAddress2,
        'InvoiceCity': InvoiceCity,
        'InvoicePostalCode': InvoicePostalCode,
        'InvoiceCountryCode': InvoiceCountryCode
    };

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

class FromArticleBase implements IConvertible
{
    /**
    * 
    */
    // @ApiMember(Description="")
    String? CompanyId;

    /**
    * Article ID for the rebate code
    */
    // @ApiMember(Description="Article ID for the rebate code", IsRequired=true)
    int ArticleId = 0;

    /**
    * Customer information
    */
    // @ApiMember(Description="Customer information")
    CustomerToHandle Customer;

    /**
    * If you want to book with customer information instead of the Customer Id send the customer information here. Note: If customer profile already exists with the same email the information will not be changed, instead the provided information will be added as BookingsComments if it differs from the ordinairy profile. 
    */
    // @ApiMember(Description="If you want to book with customer information instead of the Customer Id send the customer information here. Note: If customer profile already exists with the same email the information will not be changed, instead the provided information will be added as BookingsComments if it differs from the ordinairy profile. ")
    InvoiceAddressToHandle InvoiceAddress;

    FromArticleBase({this.CompanyId,this.ArticleId,this.Customer,this.InvoiceAddress});
    FromArticleBase.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        CompanyId = json['CompanyId'];
        ArticleId = json['ArticleId'];
        Customer = JsonConverters.fromJson(json['Customer'],'CustomerToHandle',context!);
        InvoiceAddress = JsonConverters.fromJson(json['InvoiceAddress'],'InvoiceAddressToHandle',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'CompanyId': CompanyId,
        'ArticleId': ArticleId,
        'Customer': JsonConverters.toJson(Customer,'CustomerToHandle',context!),
        'InvoiceAddress': JsonConverters.toJson(InvoiceAddress,'InvoiceAddressToHandle',context!)
    };

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

class BaseModel implements IConvertible
{
    BaseModel();
    BaseModel.fromJson(Map<String, dynamic> json) : super();
    fromMap(Map<String, dynamic> json) {
        return this;
    }

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

class ArticleServiceRelation extends BaseModel implements IConvertible
{
    // @Required()
    String CompanyId = "";

    int Id = 0;
    // @Required()
    int ServiceId = 0;

    // @Required()
    int ArticleId = 0;

    ArticleServiceRelation({this.CompanyId,this.Id,this.ServiceId,this.ArticleId});
    ArticleServiceRelation.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        CompanyId = json['CompanyId'];
        Id = json['Id'];
        ServiceId = json['ServiceId'];
        ArticleId = json['ArticleId'];
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'CompanyId': CompanyId,
        'Id': Id,
        'ServiceId': ServiceId,
        'ArticleId': ArticleId
    });

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

class ArticleResponse implements IConvertible
{
    String CompanyId = "";
    int Id = 0;
    String Name = "";
    int ArticleTypeId = 0;
    String Description = "";
    String ImageUrl = "";
    bool Active;
    int Amount = 0;
    double Price = 0;
    String CurrencyId = "";
    int SortOrder = 0;
    DateTime UpdatedDate = DateTime(0);
    DateTime CreatedDate = DateTime(0);
    List<ArticleServiceRelation> Services = [];
    List<int> ServiceIds = [];
    String PriceSign = "";
    double? VAT;

    ArticleResponse({this.CompanyId,this.Id,this.Name,this.ArticleTypeId,this.Description,this.ImageUrl,this.Active,this.Amount,this.Price,this.CurrencyId,this.SortOrder,this.UpdatedDate,this.CreatedDate,this.Services,this.ServiceIds,this.PriceSign,this.VAT});
    ArticleResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        CompanyId = json['CompanyId'];
        Id = json['Id'];
        Name = json['Name'];
        ArticleTypeId = json['ArticleTypeId'];
        Description = json['Description'];
        ImageUrl = json['ImageUrl'];
        Active = json['Active'];
        Amount = json['Amount'];
        Price = JsonConverters.toDouble(json['Price']);
        CurrencyId = json['CurrencyId'];
        SortOrder = json['SortOrder'];
        UpdatedDate = JsonConverters.fromJson(json['UpdatedDate'],'DateTime',context!);
        CreatedDate = JsonConverters.fromJson(json['CreatedDate'],'DateTime',context!);
        Services = JsonConverters.fromJson(json['Services'],'List<ArticleServiceRelation>',context!);
        ServiceIds = JsonConverters.fromJson(json['ServiceIds'],'List<int>',context!);
        PriceSign = json['PriceSign'];
        VAT = JsonConverters.toDouble(json['VAT']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'CompanyId': CompanyId,
        'Id': Id,
        'Name': Name,
        'ArticleTypeId': ArticleTypeId,
        'Description': Description,
        'ImageUrl': ImageUrl,
        'Active': Active,
        'Amount': Amount,
        'Price': Price,
        'CurrencyId': CurrencyId,
        'SortOrder': SortOrder,
        'UpdatedDate': JsonConverters.toJson(UpdatedDate,'DateTime',context!),
        'CreatedDate': JsonConverters.toJson(CreatedDate,'DateTime',context!),
        'Services': JsonConverters.toJson(Services,'List<ArticleServiceRelation>',context!),
        'ServiceIds': JsonConverters.toJson(ServiceIds,'List<int>',context!),
        'PriceSign': PriceSign,
        'VAT': VAT
    };

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

class CustomerArticleCustomerResponse implements IConvertible
{
    String Id = "";
    String Firstname = "";
    String Lastname = "";
    String Email = "";
    String Phone = "";

    CustomerArticleCustomerResponse({this.Id,this.Firstname,this.Lastname,this.Email,this.Phone});
    CustomerArticleCustomerResponse.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'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'Firstname': Firstname,
        'Lastname': Lastname,
        'Email': Email,
        'Phone': Phone
    };

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

class CustomerArticleCompanyResponse implements IConvertible
{
    String Id = "";
    String Name = "";
    String LogoType = "";
    String Email = "";
    String Phone = "";
    String City = "";
    String Street1 = "";
    String ZipCode = "";
    String CountryId = "";

    CustomerArticleCompanyResponse({this.Id,this.Name,this.LogoType,this.Email,this.Phone,this.City,this.Street1,this.ZipCode,this.CountryId});
    CustomerArticleCompanyResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        Name = json['Name'];
        LogoType = json['LogoType'];
        Email = json['Email'];
        Phone = json['Phone'];
        City = json['City'];
        Street1 = json['Street1'];
        ZipCode = json['ZipCode'];
        CountryId = json['CountryId'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'Name': Name,
        'LogoType': LogoType,
        'Email': Email,
        'Phone': Phone,
        'City': City,
        'Street1': Street1,
        'ZipCode': ZipCode,
        'CountryId': CountryId
    };

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

class PaymentLogResponse implements IConvertible
{
    int Id = 0;
    double? Amount;
    double? AmountCredited;
    String CurrencyId = "";
    String Comments = "";
    DateTime Created = DateTime(0);
    DateTime Updated = DateTime(0);

    PaymentLogResponse({this.Id,this.Amount,this.AmountCredited,this.CurrencyId,this.Comments,this.Created,this.Updated});
    PaymentLogResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        Amount = JsonConverters.toDouble(json['Amount']);
        AmountCredited = JsonConverters.toDouble(json['AmountCredited']);
        CurrencyId = json['CurrencyId'];
        Comments = json['Comments'];
        Created = JsonConverters.fromJson(json['Created'],'DateTime',context!);
        Updated = JsonConverters.fromJson(json['Updated'],'DateTime',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'Amount': Amount,
        'AmountCredited': AmountCredited,
        'CurrencyId': CurrencyId,
        'Comments': Comments,
        'Created': JsonConverters.toJson(Created,'DateTime',context!),
        'Updated': JsonConverters.toJson(Updated,'DateTime',context!)
    };

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

class CustomerArticleResponse implements IConvertible
{
    int Id = 0;
    String CompanyId = "";
    int? ArticleId;
    double? Price;
    double? VAT;
    String CurrencyId = "";
    int StatusId = 0;
    String StatusName = "";
    String? CustomerId;
    DateTime CreatedDate = DateTime(0);
    DateTime UpdatedDate = DateTime(0);
    ArticleResponse Article;
    CustomerArticleCustomerResponse Customer;
    CustomerArticleCompanyResponse Company;
    List<PaymentLogResponse> PaymentLog = [];
    ResponseStatus ResponseStatus;

    CustomerArticleResponse({this.Id,this.CompanyId,this.ArticleId,this.Price,this.VAT,this.CurrencyId,this.StatusId,this.StatusName,this.CustomerId,this.CreatedDate,this.UpdatedDate,this.Article,this.Customer,this.Company,this.PaymentLog,this.ResponseStatus});
    CustomerArticleResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        CompanyId = json['CompanyId'];
        ArticleId = json['ArticleId'];
        Price = JsonConverters.toDouble(json['Price']);
        VAT = JsonConverters.toDouble(json['VAT']);
        CurrencyId = json['CurrencyId'];
        StatusId = json['StatusId'];
        StatusName = json['StatusName'];
        CustomerId = json['CustomerId'];
        CreatedDate = JsonConverters.fromJson(json['CreatedDate'],'DateTime',context!);
        UpdatedDate = JsonConverters.fromJson(json['UpdatedDate'],'DateTime',context!);
        Article = JsonConverters.fromJson(json['Article'],'ArticleResponse',context!);
        Customer = JsonConverters.fromJson(json['Customer'],'CustomerArticleCustomerResponse',context!);
        Company = JsonConverters.fromJson(json['Company'],'CustomerArticleCompanyResponse',context!);
        PaymentLog = JsonConverters.fromJson(json['PaymentLog'],'List<PaymentLogResponse>',context!);
        ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'CompanyId': CompanyId,
        'ArticleId': ArticleId,
        'Price': Price,
        'VAT': VAT,
        'CurrencyId': CurrencyId,
        'StatusId': StatusId,
        'StatusName': StatusName,
        'CustomerId': CustomerId,
        'CreatedDate': JsonConverters.toJson(CreatedDate,'DateTime',context!),
        'UpdatedDate': JsonConverters.toJson(UpdatedDate,'DateTime',context!),
        'Article': JsonConverters.toJson(Article,'ArticleResponse',context!),
        'Customer': JsonConverters.toJson(Customer,'CustomerArticleCustomerResponse',context!),
        'Company': JsonConverters.toJson(Company,'CustomerArticleCompanyResponse',context!),
        'PaymentLog': JsonConverters.toJson(PaymentLog,'List<PaymentLogResponse>',context!),
        'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!)
    };

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

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
class CreateCustomerArticleFromArticle extends FromArticleBase implements ICompany, IConvertible
{
    CreateCustomerArticleFromArticle();
    CreateCustomerArticleFromArticle.fromJson(Map<String, dynamic> json) : super.fromJson(json);
    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson();
    getTypeName() => "CreateCustomerArticleFromArticle";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'testapi.bokamera.se', types: <String, TypeInfo> {
    'CustomerBase': TypeInfo(TypeOf.Class, create:() => CustomerBase()),
    'CustomerToHandle': TypeInfo(TypeOf.Class, create:() => CustomerToHandle()),
    'InvoiceAddressToHandle': TypeInfo(TypeOf.Class, create:() => InvoiceAddressToHandle()),
    'FromArticleBase': TypeInfo(TypeOf.Class, create:() => FromArticleBase()),
    'BaseModel': TypeInfo(TypeOf.Class, create:() => BaseModel()),
    'ArticleServiceRelation': TypeInfo(TypeOf.Class, create:() => ArticleServiceRelation()),
    'ArticleResponse': TypeInfo(TypeOf.Class, create:() => ArticleResponse()),
    'List<ArticleServiceRelation>': TypeInfo(TypeOf.Class, create:() => <ArticleServiceRelation>[]),
    'CustomerArticleCustomerResponse': TypeInfo(TypeOf.Class, create:() => CustomerArticleCustomerResponse()),
    'CustomerArticleCompanyResponse': TypeInfo(TypeOf.Class, create:() => CustomerArticleCompanyResponse()),
    'PaymentLogResponse': TypeInfo(TypeOf.Class, create:() => PaymentLogResponse()),
    'CustomerArticleResponse': TypeInfo(TypeOf.Class, create:() => CustomerArticleResponse()),
    'List<PaymentLogResponse>': TypeInfo(TypeOf.Class, create:() => <PaymentLogResponse>[]),
    'CreateCustomerArticleFromArticle': TypeInfo(TypeOf.Class, create:() => CreateCustomerArticleFromArticle()),
});

Dart CreateCustomerArticleFromArticle DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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

POST /customerarticle/fromarticle HTTP/1.1 
Host: testapi.bokamera.se 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"CompanyId":"00000000-0000-0000-0000-000000000000","ArticleId":0,"Customer":{"CustomerId":"00000000-0000-0000-0000-000000000000","Firstname":"String","Lastname":"String","Email":"String","Phone":"String","SubscribedToNewsletter":false,"PersonalIdentityNumber":"String"},"InvoiceAddress":{"CorporateIdentityNumber":"String","InvoiceAddress1":"String","InvoiceAddress2":"String","InvoiceCity":"String","InvoicePostalCode":"String","InvoiceCountryCode":"String"}}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"Id":0,"ArticleId":0,"Price":0,"VAT":0,"CurrencyId":"String","StatusId":0,"StatusName":"String","CustomerId":"00000000-0000-0000-0000-000000000000","Article":{"Id":0,"Name":"String","ArticleTypeId":0,"Description":"String","ImageUrl":"String","Active":false,"Amount":0,"Price":0,"CurrencyId":"String","SortOrder":0,"Services":[{"Id":0,"ServiceId":0,"ArticleId":0}],"ServiceIds":[0],"PriceSign":"String","VAT":0},"Customer":{"Firstname":"String","Lastname":"String","Email":"String","Phone":"String"},"Company":{"Name":"String","LogoType":"String","Email":"String","Phone":"String","City":"String","Street1":"String","ZipCode":"String","CountryId":"String"},"PaymentLog":[{"Id":0,"Amount":0,"AmountCredited":0,"CurrencyId":"String","Comments":"String"}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}