Field Squared API Services

<back to all web services

PricingList

Represents a DTO for a pricing list in a workspace. Calls without an ObjectId will retrieve an array of all active pricing list objects for the workspace.

The following routes are available for this service:
GET,POST,PUT,DELETE/{Workspace}/PricingList/{ObjectId}
GET/{Workspace}/PricingList
import 'package:servicestack/servicestack.dart';

class PricingListItem implements IConvertible
{
    String? ObjectId;
    String? Description;
    String? Details;
    String? Manufacturer;
    String? Model;
    String? Photo;
    bool? IsTaxable;
    String? Unit;
    double? UnitPrice;
    String? Barcode;

    PricingListItem({this.ObjectId,this.Description,this.Details,this.Manufacturer,this.Model,this.Photo,this.IsTaxable,this.Unit,this.UnitPrice,this.Barcode});
    PricingListItem.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        ObjectId = json['ObjectId'];
        Description = json['Description'];
        Details = json['Details'];
        Manufacturer = json['Manufacturer'];
        Model = json['Model'];
        Photo = json['Photo'];
        IsTaxable = json['IsTaxable'];
        Unit = json['Unit'];
        UnitPrice = JsonConverters.toDouble(json['UnitPrice']);
        Barcode = json['Barcode'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'ObjectId': ObjectId,
        'Description': Description,
        'Details': Details,
        'Manufacturer': Manufacturer,
        'Model': Model,
        'Photo': Photo,
        'IsTaxable': IsTaxable,
        'Unit': Unit,
        'UnitPrice': UnitPrice,
        'Barcode': Barcode
    };

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

class PricingListCat implements IConvertible
{
    String? ObjectId;
    String? Name;
    List<PricingListCat>? Categories;
    List<PricingListItem>? Items;

    PricingListCat({this.ObjectId,this.Name,this.Categories,this.Items});
    PricingListCat.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        ObjectId = json['ObjectId'];
        Name = json['Name'];
        Categories = JsonConverters.fromJson(json['Categories'],'List<PricingListCat>',context!);
        Items = JsonConverters.fromJson(json['Items'],'List<PricingListItem>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'ObjectId': ObjectId,
        'Name': Name,
        'Categories': JsonConverters.toJson(Categories,'List<PricingListCat>',context!),
        'Items': JsonConverters.toJson(Items,'List<PricingListItem>',context!)
    };

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

/**
* Represents a DTO for a pricing list in a workspace.  Calls without an ObjectId will retrieve an array of all active pricing list objects for the workspace.
*/
class PricingList implements IConvertible
{
    String? Workspace;
    String? ObjectId;
    String? VersionId;
    String? BasedOn;
    String? Name;
    List<PricingListCat>? Categories;
    List<PricingListItem>? Items;

    PricingList({this.Workspace,this.ObjectId,this.VersionId,this.BasedOn,this.Name,this.Categories,this.Items});
    PricingList.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Workspace = json['Workspace'];
        ObjectId = json['ObjectId'];
        VersionId = json['VersionId'];
        BasedOn = json['BasedOn'];
        Name = json['Name'];
        Categories = JsonConverters.fromJson(json['Categories'],'List<PricingListCat>',context!);
        Items = JsonConverters.fromJson(json['Items'],'List<PricingListItem>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Workspace': Workspace,
        'ObjectId': ObjectId,
        'VersionId': VersionId,
        'BasedOn': BasedOn,
        'Name': Name,
        'Categories': JsonConverters.toJson(Categories,'List<PricingListCat>',context!),
        'Items': JsonConverters.toJson(Items,'List<PricingListItem>',context!)
    };

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

TypeContext _ctx = TypeContext(library: 'dev.fieldsquared.com', types: <String, TypeInfo> {
    'PricingListItem': TypeInfo(TypeOf.Class, create:() => PricingListItem()),
    'PricingListCat': TypeInfo(TypeOf.Class, create:() => PricingListCat()),
    'List<PricingListCat>': TypeInfo(TypeOf.Class, create:() => <PricingListCat>[]),
    'List<PricingListItem>': TypeInfo(TypeOf.Class, create:() => <PricingListItem>[]),
    'PricingList': TypeInfo(TypeOf.Class, create:() => PricingList()),
});

Dart PricingList 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 /{Workspace}/PricingList/{ObjectId} HTTP/1.1 
Host: dev.fieldsquared.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<PricingList xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Field2Office.API.Model.PricingLists">
  <BasedOn>String</BasedOn>
  <Categories>
    <PricingListCat>
      <Categories>
        <PricingListCat>
          <Categories>
            <PricingListCat>
              <Categories i:nil="true" />
              <Items>
                <PricingListItem>
                  <Barcode>String</Barcode>
                  <Description>String</Description>
                  <Details>String</Details>
                  <IsTaxable>false</IsTaxable>
                  <Manufacturer>String</Manufacturer>
                  <Model>String</Model>
                  <ObjectId>String</ObjectId>
                  <Photo>String</Photo>
                  <Unit>String</Unit>
                  <UnitPrice>0</UnitPrice>
                </PricingListItem>
              </Items>
              <Name>String</Name>
              <ObjectId>String</ObjectId>
            </PricingListCat>
          </Categories>
          <Items>
            <PricingListItem>
              <Barcode>String</Barcode>
              <Description>String</Description>
              <Details>String</Details>
              <IsTaxable>false</IsTaxable>
              <Manufacturer>String</Manufacturer>
              <Model>String</Model>
              <ObjectId>String</ObjectId>
              <Photo>String</Photo>
              <Unit>String</Unit>
              <UnitPrice>0</UnitPrice>
            </PricingListItem>
          </Items>
          <Name>String</Name>
          <ObjectId>String</ObjectId>
        </PricingListCat>
      </Categories>
      <Items>
        <PricingListItem>
          <Barcode>String</Barcode>
          <Description>String</Description>
          <Details>String</Details>
          <IsTaxable>false</IsTaxable>
          <Manufacturer>String</Manufacturer>
          <Model>String</Model>
          <ObjectId>String</ObjectId>
          <Photo>String</Photo>
          <Unit>String</Unit>
          <UnitPrice>0</UnitPrice>
        </PricingListItem>
      </Items>
      <Name>String</Name>
      <ObjectId>String</ObjectId>
    </PricingListCat>
  </Categories>
  <Items>
    <PricingListItem>
      <Barcode>String</Barcode>
      <Description>String</Description>
      <Details>String</Details>
      <IsTaxable>false</IsTaxable>
      <Manufacturer>String</Manufacturer>
      <Model>String</Model>
      <ObjectId>String</ObjectId>
      <Photo>String</Photo>
      <Unit>String</Unit>
      <UnitPrice>0</UnitPrice>
    </PricingListItem>
  </Items>
  <Name>String</Name>
  <ObjectId>String</ObjectId>
  <VersionId>String</VersionId>
  <Workspace>String</Workspace>
</PricingList>