| POST | /{Workspace}/ContactImport |
|---|
import 'package:servicestack/servicestack.dart';
class Location implements IConvertible
{
double? y;
double? x;
Location({this.y,this.x});
Location.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
y = JsonConverters.toDouble(json['y']);
x = JsonConverters.toDouble(json['x']);
return this;
}
Map<String, dynamic> toJson() => {
'y': y,
'x': x
};
getTypeName() => "Location";
TypeContext? context = _ctx;
}
class Address implements IConvertible
{
String? Street;
String? Unit;
String? City;
String? State;
String? Zip;
String? ContactTitle;
String? ContactName;
String? ContactPhone;
String? ContactEmail;
Location? Location;
String? SiteName;
bool? GeocodeFailed;
String? Country;
Address({this.Street,this.Unit,this.City,this.State,this.Zip,this.ContactTitle,this.ContactName,this.ContactPhone,this.ContactEmail,this.Location,this.SiteName,this.GeocodeFailed,this.Country});
Address.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Street = json['Street'];
Unit = json['Unit'];
City = json['City'];
State = json['State'];
Zip = json['Zip'];
ContactTitle = json['ContactTitle'];
ContactName = json['ContactName'];
ContactPhone = json['ContactPhone'];
ContactEmail = json['ContactEmail'];
Location = JsonConverters.fromJson(json['Location'],'Location',context!);
SiteName = json['SiteName'];
GeocodeFailed = json['GeocodeFailed'];
Country = json['Country'];
return this;
}
Map<String, dynamic> toJson() => {
'Street': Street,
'Unit': Unit,
'City': City,
'State': State,
'Zip': Zip,
'ContactTitle': ContactTitle,
'ContactName': ContactName,
'ContactPhone': ContactPhone,
'ContactEmail': ContactEmail,
'Location': JsonConverters.toJson(Location,'Location',context!),
'SiteName': SiteName,
'GeocodeFailed': GeocodeFailed,
'Country': Country
};
getTypeName() => "Address";
TypeContext? context = _ctx;
}
class DomainItem implements IConvertible
{
String? Workspace;
String? ObjectId;
String? VersionId;
String? LastUpdated;
DomainItem({this.Workspace,this.ObjectId,this.VersionId,this.LastUpdated});
DomainItem.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Workspace = json['Workspace'];
ObjectId = json['ObjectId'];
VersionId = json['VersionId'];
LastUpdated = json['LastUpdated'];
return this;
}
Map<String, dynamic> toJson() => {
'Workspace': Workspace,
'ObjectId': ObjectId,
'VersionId': VersionId,
'LastUpdated': LastUpdated
};
getTypeName() => "DomainItem";
TypeContext? context = _ctx;
}
class ClassedItem implements IConvertible
{
String? ObjectId;
String? Class;
String? VersionId;
List<String>? Ancestors;
String? Type;
ClassedItem({this.ObjectId,this.Class,this.VersionId,this.Ancestors,this.Type});
ClassedItem.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
ObjectId = json['ObjectId'];
Class = json['Class'];
VersionId = json['VersionId'];
Ancestors = JsonConverters.fromJson(json['Ancestors'],'List<String>',context!);
Type = json['Type'];
return this;
}
Map<String, dynamic> toJson() => {
'ObjectId': ObjectId,
'Class': Class,
'VersionId': VersionId,
'Ancestors': JsonConverters.toJson(Ancestors,'List<String>',context!),
'Type': Type
};
getTypeName() => "ClassedItem";
TypeContext? context = _ctx;
}
class EventItem implements IConvertible
{
String? ObjectId;
String? Date;
Location? Location;
String? Barcode;
String? Details;
String? Type;
bool? IsScan;
String? User;
String? SelectedBy;
String? Status;
String? StatusType;
String? DateCreated;
bool? Automatic;
EventItem({this.ObjectId,this.Date,this.Location,this.Barcode,this.Details,this.Type,this.IsScan,this.User,this.SelectedBy,this.Status,this.StatusType,this.DateCreated,this.Automatic});
EventItem.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
ObjectId = json['ObjectId'];
Date = json['Date'];
Location = JsonConverters.fromJson(json['Location'],'Location',context!);
Barcode = json['Barcode'];
Details = json['Details'];
Type = json['Type'];
IsScan = json['IsScan'];
User = json['User'];
SelectedBy = json['SelectedBy'];
Status = json['Status'];
StatusType = json['StatusType'];
DateCreated = json['DateCreated'];
Automatic = json['Automatic'];
return this;
}
Map<String, dynamic> toJson() => {
'ObjectId': ObjectId,
'Date': Date,
'Location': JsonConverters.toJson(Location,'Location',context!),
'Barcode': Barcode,
'Details': Details,
'Type': Type,
'IsScan': IsScan,
'User': User,
'SelectedBy': SelectedBy,
'Status': Status,
'StatusType': StatusType,
'DateCreated': DateCreated,
'Automatic': Automatic
};
getTypeName() => "EventItem";
TypeContext? context = _ctx;
}
/**
* Represents a DTO for a contact in a workspace. Calls without an ObjectId will retrieve an array of all active contact objects for the workspace.A call to /{Workspace}/ContactTasks/{ObjectId} will return a List<DomainItem> for the list of tasks associated to the contact.A core or custom sort field can be specified by using sort=fieldname&sortorder=ascending/descending. To filter for contacts based on full text search, use fulltext Custom contact field 'contains' filters can also be specified by using the binding/key as the query parameter. i.e. Comments=Quick Brown Fox. To filter and return all contacts modified since a date and time, use the query parameter modifiedsince = X where X = YYYY-MM-DDTHH:MM:SSZ To filter and return all contacts deleted since a date and time, use the query parameter deletedsince = X where X = YYYY-MM-DDTHH:MM:SSZ. Note only Object ID, Workspace and Version is populated. Spatial extents can be passed in using: bottomleft=Lat,Lon&topright=Lat,Lon. To filter on tasks inside a boundary, use boundary=Lat,Lon,Lat,Lon etc. Pagination - /{0}/ContactList?recstart=0&reccount=1 /{Workspace}/ContactList/Count returns a count, not the actual object list
*/
class Contact implements IConvertible
{
String? Workspace;
String? ObjectId;
String? TimeZone;
String? VersionId;
String? BasedOn;
String? ExternalId;
String? ContactName;
String? Company;
String? MobilePhone;
String? WorkPhone;
String? HomePhone;
String? Email;
bool? SMS;
Address? Address;
bool? Enabled;
bool? POI;
bool? EmailSiteDriving;
List<Address>? ServiceAddresses;
List<DomainItem>? Documents;
Map<String,String?>? Data;
ClassedItem? Owner;
List<String>? Tasks;
List<String>? Assets;
List<String>? Contacts;
List<EventItem>? Events;
List<String>? Teams;
String? Created;
String? LastUpdated;
String? CreatedBy;
Map<String,dynamic?>? ActiveLaborTypes;
Contact({this.Workspace,this.ObjectId,this.TimeZone,this.VersionId,this.BasedOn,this.ExternalId,this.ContactName,this.Company,this.MobilePhone,this.WorkPhone,this.HomePhone,this.Email,this.SMS,this.Address,this.Enabled,this.POI,this.EmailSiteDriving,this.ServiceAddresses,this.Documents,this.Data,this.Owner,this.Tasks,this.Assets,this.Contacts,this.Events,this.Teams,this.Created,this.LastUpdated,this.CreatedBy,this.ActiveLaborTypes});
Contact.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Workspace = json['Workspace'];
ObjectId = json['ObjectId'];
TimeZone = json['TimeZone'];
VersionId = json['VersionId'];
BasedOn = json['BasedOn'];
ExternalId = json['ExternalId'];
ContactName = json['ContactName'];
Company = json['Company'];
MobilePhone = json['MobilePhone'];
WorkPhone = json['WorkPhone'];
HomePhone = json['HomePhone'];
Email = json['Email'];
SMS = json['SMS'];
Address = JsonConverters.fromJson(json['Address'],'Address',context!);
Enabled = json['Enabled'];
POI = json['POI'];
EmailSiteDriving = json['EmailSiteDriving'];
ServiceAddresses = JsonConverters.fromJson(json['ServiceAddresses'],'List<Address>',context!);
Documents = JsonConverters.fromJson(json['Documents'],'List<DomainItem>',context!);
Data = JsonConverters.toStringMap(json['Data']);
Owner = JsonConverters.fromJson(json['Owner'],'ClassedItem',context!);
Tasks = JsonConverters.fromJson(json['Tasks'],'List<String>',context!);
Assets = JsonConverters.fromJson(json['Assets'],'List<String>',context!);
Contacts = JsonConverters.fromJson(json['Contacts'],'List<String>',context!);
Events = JsonConverters.fromJson(json['Events'],'List<EventItem>',context!);
Teams = JsonConverters.fromJson(json['Teams'],'List<String>',context!);
Created = json['Created'];
LastUpdated = json['LastUpdated'];
CreatedBy = json['CreatedBy'];
ActiveLaborTypes = JsonConverters.fromJson(json['ActiveLaborTypes'],'Map<String,dynamic?>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'Workspace': Workspace,
'ObjectId': ObjectId,
'TimeZone': TimeZone,
'VersionId': VersionId,
'BasedOn': BasedOn,
'ExternalId': ExternalId,
'ContactName': ContactName,
'Company': Company,
'MobilePhone': MobilePhone,
'WorkPhone': WorkPhone,
'HomePhone': HomePhone,
'Email': Email,
'SMS': SMS,
'Address': JsonConverters.toJson(Address,'Address',context!),
'Enabled': Enabled,
'POI': POI,
'EmailSiteDriving': EmailSiteDriving,
'ServiceAddresses': JsonConverters.toJson(ServiceAddresses,'List<Address>',context!),
'Documents': JsonConverters.toJson(Documents,'List<DomainItem>',context!),
'Data': Data,
'Owner': JsonConverters.toJson(Owner,'ClassedItem',context!),
'Tasks': JsonConverters.toJson(Tasks,'List<String>',context!),
'Assets': JsonConverters.toJson(Assets,'List<String>',context!),
'Contacts': JsonConverters.toJson(Contacts,'List<String>',context!),
'Events': JsonConverters.toJson(Events,'List<EventItem>',context!),
'Teams': JsonConverters.toJson(Teams,'List<String>',context!),
'Created': Created,
'LastUpdated': LastUpdated,
'CreatedBy': CreatedBy,
'ActiveLaborTypes': JsonConverters.toJson(ActiveLaborTypes,'Map<String,dynamic?>',context!)
};
getTypeName() => "Contact";
TypeContext? context = _ctx;
}
/**
* Bulk import a set of contacts..
*/
class ContactImport implements IConvertible
{
String? Workspace;
List<Contact>? Contacts;
String? RequestId;
ContactImport({this.Workspace,this.Contacts,this.RequestId});
ContactImport.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Workspace = json['Workspace'];
Contacts = JsonConverters.fromJson(json['Contacts'],'List<Contact>',context!);
RequestId = json['RequestId'];
return this;
}
Map<String, dynamic> toJson() => {
'Workspace': Workspace,
'Contacts': JsonConverters.toJson(Contacts,'List<Contact>',context!),
'RequestId': RequestId
};
getTypeName() => "ContactImport";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'dev.fieldsquared.com', types: <String, TypeInfo> {
'Location': TypeInfo(TypeOf.Class, create:() => Location()),
'Address': TypeInfo(TypeOf.Class, create:() => Address()),
'DomainItem': TypeInfo(TypeOf.Class, create:() => DomainItem()),
'ClassedItem': TypeInfo(TypeOf.Class, create:() => ClassedItem()),
'EventItem': TypeInfo(TypeOf.Class, create:() => EventItem()),
'Contact': TypeInfo(TypeOf.Class, create:() => Contact()),
'List<Address>': TypeInfo(TypeOf.Class, create:() => <Address>[]),
'List<DomainItem>': TypeInfo(TypeOf.Class, create:() => <DomainItem>[]),
'List<EventItem>': TypeInfo(TypeOf.Class, create:() => <EventItem>[]),
'Map<String,dynamic?>': TypeInfo(TypeOf.Class, create:() => Map<String,dynamic?>()),
'ContactImport': TypeInfo(TypeOf.Class, create:() => ContactImport()),
'List<Contact>': TypeInfo(TypeOf.Class, create:() => <Contact>[]),
});
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}/ContactImport HTTP/1.1
Host: dev.fieldsquared.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
Workspace: String,
Contacts:
[
{
Workspace: String,
ObjectId: String,
TimeZone: String,
VersionId: String,
BasedOn: String,
ExternalId: String,
ContactName: String,
Company: String,
MobilePhone: String,
WorkPhone: String,
HomePhone: String,
Email: String,
SMS: False,
Address:
{
Street: String,
Unit: String,
City: String,
State: String,
Zip: String,
ContactTitle: String,
ContactName: String,
ContactPhone: String,
ContactEmail: String,
Location:
{
y: 0,
x: 0
},
SiteName: String,
GeocodeFailed: False,
Country: String
},
Enabled: False,
POI: False,
EmailSiteDriving: False,
ServiceAddresses:
[
{
Street: String,
Unit: String,
City: String,
State: String,
Zip: String,
ContactTitle: String,
ContactName: String,
ContactPhone: String,
ContactEmail: String,
Location:
{
y: 0,
x: 0
},
SiteName: String,
GeocodeFailed: False,
Country: String
}
],
Documents:
[
{
Workspace: String,
ObjectId: String,
VersionId: String,
LastUpdated: String
}
],
Data:
{
String: String
},
Owner:
{
ObjectId: String,
Class: String,
VersionId: String,
Ancestors:
[
String
],
Type: String
},
Tasks:
[
String
],
Assets:
[
String
],
Contacts:
[
String
],
Events:
[
{
ObjectId: String,
Date: String,
Location:
{
y: 0,
x: 0
},
Barcode: String,
Details: String,
Type: String,
IsScan: False,
User: String,
SelectedBy: String,
Status: String,
StatusType: String,
DateCreated: String,
Automatic: False
}
],
Teams:
[
String
],
Created: String,
LastUpdated: String,
CreatedBy: String,
ActiveLaborTypes:
{
String: {}
}
}
],
RequestId: String
}