| GET,PUT,POST,DELETE | /{Workspace}/InventoryItemTemplate |
|---|
import 'package:servicestack/servicestack.dart';
enum CustomFieldDataType
{
Text,
Number,
Decimal,
Money,
PhoneNumber,
Ssn,
List,
Date,
File,
Barcode,
GPS,
Photo,
Spacer,
Separator,
AutoNumber,
TextArea,
Contact,
User,
Asset,
Checkbox,
CoreAssetList,
CoreTaskList,
CoreParentTask,
CoreContactList,
ComboBox,
DateTime,
Time,
Location,
CoreLocation,
Label,
EventLog,
Address,
Catalog,
CoreTeamList,
Segment,
CoreTimeSeries,
TimeSeries,
Command,
AutoNumberNumeric,
CatalogList,
CatalogComboBox,
DateRange,
DocumentGrid,
ReportLink,
Hyperlink,
PercentComplete,
Chart,
Range,
ExternalId,
AssetCatalog,
Inventory,
CoreTaskLaborItemTypes,
CoreTaskLaborItems,
ObjectList,
CoreTimeZone,
}
class CustomField implements IConvertible
{
String? Key;
String? Label;
bool? IsActive;
bool? IsReadOnly;
bool? IsHidden;
bool? IsMandatory;
bool? DisplayOnMap;
CustomFieldDataType? CustomFieldDataType;
String? Values;
String? Prompt;
String? Default;
bool? DefaultAutoUpdate;
String? RequiredIf;
List<String>? Hidden;
List<String>? ReadOnly;
Map<String,dynamic?>? ControlArgs;
String? IndexSlot;
String? Index;
CustomField({this.Key,this.Label,this.IsActive,this.IsReadOnly,this.IsHidden,this.IsMandatory,this.DisplayOnMap,this.CustomFieldDataType,this.Values,this.Prompt,this.Default,this.DefaultAutoUpdate,this.RequiredIf,this.Hidden,this.ReadOnly,this.ControlArgs,this.IndexSlot,this.Index});
CustomField.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Key = json['Key'];
Label = json['Label'];
IsActive = json['IsActive'];
IsReadOnly = json['IsReadOnly'];
IsHidden = json['IsHidden'];
IsMandatory = json['IsMandatory'];
DisplayOnMap = json['DisplayOnMap'];
CustomFieldDataType = JsonConverters.fromJson(json['CustomFieldDataType'],'CustomFieldDataType',context!);
Values = json['Values'];
Prompt = json['Prompt'];
Default = json['Default'];
DefaultAutoUpdate = json['DefaultAutoUpdate'];
RequiredIf = json['RequiredIf'];
Hidden = JsonConverters.fromJson(json['Hidden'],'List<String>',context!);
ReadOnly = JsonConverters.fromJson(json['ReadOnly'],'List<String>',context!);
ControlArgs = JsonConverters.fromJson(json['ControlArgs'],'Map<String,dynamic?>',context!);
IndexSlot = json['IndexSlot'];
Index = json['Index'];
return this;
}
Map<String, dynamic> toJson() => {
'Key': Key,
'Label': Label,
'IsActive': IsActive,
'IsReadOnly': IsReadOnly,
'IsHidden': IsHidden,
'IsMandatory': IsMandatory,
'DisplayOnMap': DisplayOnMap,
'CustomFieldDataType': JsonConverters.toJson(CustomFieldDataType,'CustomFieldDataType',context!),
'Values': Values,
'Prompt': Prompt,
'Default': Default,
'DefaultAutoUpdate': DefaultAutoUpdate,
'RequiredIf': RequiredIf,
'Hidden': JsonConverters.toJson(Hidden,'List<String>',context!),
'ReadOnly': JsonConverters.toJson(ReadOnly,'List<String>',context!),
'ControlArgs': JsonConverters.toJson(ControlArgs,'Map<String,dynamic?>',context!),
'IndexSlot': IndexSlot,
'Index': Index
};
getTypeName() => "CustomField";
TypeContext? context = _ctx;
}
class InventoryItemTemplate implements IConvertible
{
String? ObjectId;
String? Workspace;
String? Name;
List<CustomField>? CustomFields;
InventoryItemTemplate({this.ObjectId,this.Workspace,this.Name,this.CustomFields});
InventoryItemTemplate.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
ObjectId = json['ObjectId'];
Workspace = json['Workspace'];
Name = json['Name'];
CustomFields = JsonConverters.fromJson(json['CustomFields'],'List<CustomField>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'ObjectId': ObjectId,
'Workspace': Workspace,
'Name': Name,
'CustomFields': JsonConverters.toJson(CustomFields,'List<CustomField>',context!)
};
getTypeName() => "InventoryItemTemplate";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'dev.fieldsquared.com', types: <String, TypeInfo> {
'CustomFieldDataType': TypeInfo(TypeOf.Enum, enumValues:CustomFieldDataType.values),
'CustomField': TypeInfo(TypeOf.Class, create:() => CustomField()),
'Map<String,dynamic?>': TypeInfo(TypeOf.Class, create:() => Map<String,dynamic?>()),
'InventoryItemTemplate': TypeInfo(TypeOf.Class, create:() => InventoryItemTemplate()),
'List<CustomField>': TypeInfo(TypeOf.Class, create:() => <CustomField>[]),
});
Dart InventoryItemTemplate 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.
POST /{Workspace}/InventoryItemTemplate HTTP/1.1
Host: dev.fieldsquared.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
ObjectId: String,
Workspace: String,
Name: String,
CustomFields:
[
{
Key: String,
Label: String,
IsActive: False,
IsReadOnly: False,
IsHidden: False,
IsMandatory: False,
DisplayOnMap: False,
CustomFieldDataType: Text,
Values: String,
Prompt: String,
Default: String,
DefaultAutoUpdate: False,
RequiredIf: String,
Hidden:
[
String
],
ReadOnly:
[
String
],
ControlArgs:
{
String: {}
},
IndexSlot: String,
Index: String
}
]
}