Field Squared API Services

<back to all web services

Conversation

The following routes are available for this service:
GET,POST/{Workspace}/Conversation
GET/{Workspace}/Conversation/{ObjectId}
GET/{Workspace}/Conversation/Search/{MemberId}
GET/{Workspace}/Conversation/Search/{SearchType}/{SearchText}
import 'package:servicestack/servicestack.dart';

class ConversationEvent implements IConvertible
{
    String? ObjectId;
    String? Workspace;
    String? Date;
    String? ConversationId;
    String? UserId;
    String? Text;
    String? ThumbnailId;
    bool? IsLink;

    ConversationEvent({this.ObjectId,this.Workspace,this.Date,this.ConversationId,this.UserId,this.Text,this.ThumbnailId,this.IsLink});
    ConversationEvent.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        ObjectId = json['ObjectId'];
        Workspace = json['Workspace'];
        Date = json['Date'];
        ConversationId = json['ConversationId'];
        UserId = json['UserId'];
        Text = json['Text'];
        ThumbnailId = json['ThumbnailId'];
        IsLink = json['IsLink'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'ObjectId': ObjectId,
        'Workspace': Workspace,
        'Date': Date,
        'ConversationId': ConversationId,
        'UserId': UserId,
        'Text': Text,
        'ThumbnailId': ThumbnailId,
        'IsLink': IsLink
    };

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

class Conversation implements IConvertible
{
    String? ObjectId;
    String? Workspace;
    String? TeamId;
    List<String>? Members;
    List<ConversationEvent>? Events;
    int? Unread;
    String? MemberId;
    String? SearchType;
    String? SearchText;

    Conversation({this.ObjectId,this.Workspace,this.TeamId,this.Members,this.Events,this.Unread,this.MemberId,this.SearchType,this.SearchText});
    Conversation.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        ObjectId = json['ObjectId'];
        Workspace = json['Workspace'];
        TeamId = json['TeamId'];
        Members = JsonConverters.fromJson(json['Members'],'List<String>',context!);
        Events = JsonConverters.fromJson(json['Events'],'List<ConversationEvent>',context!);
        Unread = json['Unread'];
        MemberId = json['MemberId'];
        SearchType = json['SearchType'];
        SearchText = json['SearchText'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'ObjectId': ObjectId,
        'Workspace': Workspace,
        'TeamId': TeamId,
        'Members': JsonConverters.toJson(Members,'List<String>',context!),
        'Events': JsonConverters.toJson(Events,'List<ConversationEvent>',context!),
        'Unread': Unread,
        'MemberId': MemberId,
        'SearchType': SearchType,
        'SearchText': SearchText
    };

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

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

Dart Conversation DTOs

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

HTTP + JSV

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

POST /{Workspace}/Conversation HTTP/1.1 
Host: dev.fieldsquared.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	ObjectId: String,
	Workspace: String,
	TeamId: String,
	Members: 
	[
		String
	],
	Events: 
	[
		{
			ObjectId: String,
			Workspace: String,
			Date: String,
			ConversationId: String,
			UserId: String,
			Text: String,
			ThumbnailId: String,
			IsLink: False
		}
	],
	Unread: 0,
	MemberId: String,
	SearchType: String,
	SearchText: String
}