Field Squared API Services

<back to all web services

PublicTeam

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

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 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 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 team in a workspace. Calls without an ObjectId will retrieve an array of all team objects for the workspace.
*/
class Team implements IConvertible
{
    String? Workspace;
    String? TimeZone;
    String? ObjectId;
    String? ExternalId;
    String? VersionId;
    String? BasedOn;
    String? Name;
    bool? Enabled;
    List<DomainItem>? Members;
    DomainItem? Lead;
    DomainItem? Parent;
    Address? Address;
    Map<String,String?>? Data;
    List<String>? Teams;
    List<EventItem>? Events;
    String? CreatedBy;
    Map<String,dynamic?>? ActiveLaborTypes;

    Team({this.Workspace,this.TimeZone,this.ObjectId,this.ExternalId,this.VersionId,this.BasedOn,this.Name,this.Enabled,this.Members,this.Lead,this.Parent,this.Address,this.Data,this.Teams,this.Events,this.CreatedBy,this.ActiveLaborTypes});
    Team.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Workspace = json['Workspace'];
        TimeZone = json['TimeZone'];
        ObjectId = json['ObjectId'];
        ExternalId = json['ExternalId'];
        VersionId = json['VersionId'];
        BasedOn = json['BasedOn'];
        Name = json['Name'];
        Enabled = json['Enabled'];
        Members = JsonConverters.fromJson(json['Members'],'List<DomainItem>',context!);
        Lead = JsonConverters.fromJson(json['Lead'],'DomainItem',context!);
        Parent = JsonConverters.fromJson(json['Parent'],'DomainItem',context!);
        Address = JsonConverters.fromJson(json['Address'],'Address',context!);
        Data = JsonConverters.toStringMap(json['Data']);
        Teams = JsonConverters.fromJson(json['Teams'],'List<String>',context!);
        Events = JsonConverters.fromJson(json['Events'],'List<EventItem>',context!);
        CreatedBy = json['CreatedBy'];
        ActiveLaborTypes = JsonConverters.fromJson(json['ActiveLaborTypes'],'Map<String,dynamic?>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Workspace': Workspace,
        'TimeZone': TimeZone,
        'ObjectId': ObjectId,
        'ExternalId': ExternalId,
        'VersionId': VersionId,
        'BasedOn': BasedOn,
        'Name': Name,
        'Enabled': Enabled,
        'Members': JsonConverters.toJson(Members,'List<DomainItem>',context!),
        'Lead': JsonConverters.toJson(Lead,'DomainItem',context!),
        'Parent': JsonConverters.toJson(Parent,'DomainItem',context!),
        'Address': JsonConverters.toJson(Address,'Address',context!),
        'Data': Data,
        'Teams': JsonConverters.toJson(Teams,'List<String>',context!),
        'Events': JsonConverters.toJson(Events,'List<EventItem>',context!),
        'CreatedBy': CreatedBy,
        'ActiveLaborTypes': JsonConverters.toJson(ActiveLaborTypes,'Map<String,dynamic?>',context!)
    };

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

// @DataContract
class PublicTeam implements IConvertible
{
    // @DataMember
    String? Id;

    // @DataMember
    String? Workspace;

    // @DataMember
    Team? Team;

    // @DataMember
    List<Team>? Teams;

    PublicTeam({this.Id,this.Workspace,this.Team,this.Teams});
    PublicTeam.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Id = json['Id'];
        Workspace = json['Workspace'];
        Team = JsonConverters.fromJson(json['Team'],'Team',context!);
        Teams = JsonConverters.fromJson(json['Teams'],'List<Team>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Id': Id,
        'Workspace': Workspace,
        'Team': JsonConverters.toJson(Team,'Team',context!),
        'Teams': JsonConverters.toJson(Teams,'List<Team>',context!)
    };

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

TypeContext _ctx = TypeContext(library: 'dev.fieldsquared.com', types: <String, TypeInfo> {
    'DomainItem': TypeInfo(TypeOf.Class, create:() => DomainItem()),
    'Location': TypeInfo(TypeOf.Class, create:() => Location()),
    'Address': TypeInfo(TypeOf.Class, create:() => Address()),
    'EventItem': TypeInfo(TypeOf.Class, create:() => EventItem()),
    'Team': TypeInfo(TypeOf.Class, create:() => Team()),
    'List<DomainItem>': TypeInfo(TypeOf.Class, create:() => <DomainItem>[]),
    'List<EventItem>': TypeInfo(TypeOf.Class, create:() => <EventItem>[]),
    'Map<String,dynamic?>': TypeInfo(TypeOf.Class, create:() => Map<String,dynamic?>()),
    'PublicTeam': TypeInfo(TypeOf.Class, create:() => PublicTeam()),
    'List<Team>': TypeInfo(TypeOf.Class, create:() => <Team>[]),
});

Dart PublicTeam 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 /{Workspace}/API/Team/{Id} HTTP/1.1 
Host: dev.fieldsquared.com 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"Id":"String","Workspace":"String","Team":{"ExternalId":"String","Name":"String","Lat":0,"Lon":0,"StreetAddress":"String","Unit":"String","City":"String","State":"String","Zip":"String","Country":"String","Enabled":false,"Members":["String"],"Teams":["String"],"LastUpdated":"String","Created":"String","Data":{"String":{}}},"Teams":[{"ExternalId":"String","Name":"String","Lat":0,"Lon":0,"StreetAddress":"String","Unit":"String","City":"String","State":"String","Zip":"String","Country":"String","Enabled":false,"Members":["String"],"Teams":["String"],"LastUpdated":"String","Created":"String","Data":{"String":{}}}]}