BokaMera.API.Host

<back to all web services

CreateArticle

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
POST/articlesAdd new articleAdd article to the company for the currently logged in user
import 'package:servicestack/servicestack.dart';

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 ArticleServiceDb extends BaseModel implements IConvertible
{
    // @Required()
    String? CompanyId;

    int? Id;
    // @Required()
    int? ServiceId;

    // @Required()
    int? ArticleId;

    ArticleServiceDb({this.CompanyId,this.Id,this.ServiceId,this.ArticleId});
    ArticleServiceDb.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() => "ArticleServiceDb";
    TypeContext? context = _ctx;
}

class ArticleResponse implements IConvertible
{
    String? CompanyId;
    int? Id;
    String? Name;
    int? ArticleTypeId;
    String? Description;
    String? ImageUrl;
    bool? Active;
    int? Amount;
    double? Price;
    String? CurrencyId;
    DateTime? UpdatedDate;
    DateTime? CreatedDate;
    List<ArticleServiceDb>? Services;
    List<int>? ServiceIds;
    String? PriceSign;

    ArticleResponse({this.CompanyId,this.Id,this.Name,this.ArticleTypeId,this.Description,this.ImageUrl,this.Active,this.Amount,this.Price,this.CurrencyId,this.UpdatedDate,this.CreatedDate,this.Services,this.ServiceIds,this.PriceSign});
    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'];
        UpdatedDate = JsonConverters.fromJson(json['UpdatedDate'],'DateTime',context!);
        CreatedDate = JsonConverters.fromJson(json['CreatedDate'],'DateTime',context!);
        Services = JsonConverters.fromJson(json['Services'],'List<ArticleServiceDb>',context!);
        ServiceIds = JsonConverters.fromJson(json['ServiceIds'],'List<int>',context!);
        PriceSign = json['PriceSign'];
        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,
        'UpdatedDate': JsonConverters.toJson(UpdatedDate,'DateTime',context!),
        'CreatedDate': JsonConverters.toJson(CreatedDate,'DateTime',context!),
        'Services': JsonConverters.toJson(Services,'List<ArticleServiceDb>',context!),
        'ServiceIds': JsonConverters.toJson(ServiceIds,'List<int>',context!),
        'PriceSign': PriceSign
    };

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

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

    /**
    * 
    */
    // @ApiMember(Description="", IsRequired=true)
    String? Name;

    /**
    * 
    */
    // @ApiMember(Description="", IsRequired=true)
    int? ArticleTypeId;

    /**
    * 
    */
    // @ApiMember(Description="", IsRequired=true)
    String? Description;

    /**
    * 
    */
    // @ApiMember(Description="")
    Uri? ImageUrl;

    /**
    * 
    */
    // @ApiMember(Description="", IsRequired=true)
    bool? Active;

    /**
    * 
    */
    // @ApiMember(Description="", IsRequired=true)
    int? Amount;

    /**
    * .
    */
    // @ApiMember(Description=".", IsRequired=true)
    double? Price;

    /**
    * The payment currency id
    */
    // @ApiMember(Description="The payment currency id", IsRequired=true)
    String? CurrencyId;

    /**
    * Query for specific services.
    */
    // @ApiMember(Description="Query for specific services.", ParameterType="query")
    List<int>? ServiceIds;

    CreateArticle({this.CompanyId,this.Name,this.ArticleTypeId,this.Description,this.ImageUrl,this.Active,this.Amount,this.Price,this.CurrencyId,this.ServiceIds});
    CreateArticle.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        CompanyId = json['CompanyId'];
        Name = json['Name'];
        ArticleTypeId = json['ArticleTypeId'];
        Description = json['Description'];
        ImageUrl = JsonConverters.fromJson(json['ImageUrl'],'Uri',context!);
        Active = json['Active'];
        Amount = json['Amount'];
        Price = JsonConverters.toDouble(json['Price']);
        CurrencyId = json['CurrencyId'];
        ServiceIds = JsonConverters.fromJson(json['ServiceIds'],'List<int>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'CompanyId': CompanyId,
        'Name': Name,
        'ArticleTypeId': ArticleTypeId,
        'Description': Description,
        'ImageUrl': JsonConverters.toJson(ImageUrl,'Uri',context!),
        'Active': Active,
        'Amount': Amount,
        'Price': Price,
        'CurrencyId': CurrencyId,
        'ServiceIds': JsonConverters.toJson(ServiceIds,'List<int>',context!)
    };

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

TypeContext _ctx = TypeContext(library: 'api.bokamera.se', types: <String, TypeInfo> {
    'BaseModel': TypeInfo(TypeOf.Class, create:() => BaseModel()),
    'ArticleServiceDb': TypeInfo(TypeOf.Class, create:() => ArticleServiceDb()),
    'ArticleResponse': TypeInfo(TypeOf.Class, create:() => ArticleResponse()),
    'List<ArticleServiceDb>': TypeInfo(TypeOf.Class, create:() => <ArticleServiceDb>[]),
    'CreateArticle': TypeInfo(TypeOf.Class, create:() => CreateArticle()),
    'Uri': TypeInfo(TypeOf.Class, create:() => Uri()),
});

Dart CreateArticle DTOs

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

HTTP + XML

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

POST /articles HTTP/1.1 
Host: api.bokamera.se 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<CreateArticle xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
  <Active>false</Active>
  <Amount>0</Amount>
  <ArticleTypeId>0</ArticleTypeId>
  <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
  <CurrencyId>String</CurrencyId>
  <Description>String</Description>
  <ImageUrl i:nil="true" />
  <Name>String</Name>
  <Price>0</Price>
  <ServiceIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:int>0</d2p1:int>
  </ServiceIds>
</CreateArticle>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<ArticleResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
  <Active>false</Active>
  <Amount>0</Amount>
  <ArticleTypeId>0</ArticleTypeId>
  <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
  <CreatedDate>0001-01-01T00:00:00</CreatedDate>
  <CurrencyId>String</CurrencyId>
  <Description>String</Description>
  <Id>0</Id>
  <ImageUrl>String</ImageUrl>
  <Name>String</Name>
  <Price>0</Price>
  <PriceSign>String</PriceSign>
  <ServiceIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:int>0</d2p1:int>
  </ServiceIds>
  <Services xmlns:d2p1="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Db">
    <d2p1:ArticleServiceDb>
      <d2p1:ArticleId>0</d2p1:ArticleId>
      <d2p1:CompanyId>00000000-0000-0000-0000-000000000000</d2p1:CompanyId>
      <d2p1:Id>0</d2p1:Id>
      <d2p1:ServiceId>0</d2p1:ServiceId>
    </d2p1:ArticleServiceDb>
  </Services>
  <UpdatedDate>0001-01-01T00:00:00</UpdatedDate>
</ArticleResponse>