Trendsic Platform Service

<back to all web services

ResourceRequest

Requires Authentication
Requires any of the roles:Agent, Administrator, Agent, Administrator
The following routes are available for this service:
GET,POST,OPTIONS/v1/Resource
import 'package:servicestack/servicestack.dart';
import 'dart:typed_data';

class ResourceCategory implements IConvertible
{
    String? CategoryName;
    List<String>? Subcategories = [];

    ResourceCategory({this.CategoryName,this.Subcategories});
    ResourceCategory.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

    Map<String, dynamic> toJson() => {
        'CategoryName': CategoryName,
        'Subcategories': JsonConverters.toJson(Subcategories,'List<String>',context!)
    };

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

class Document implements IConvertible
{
    String? DocumentId;
    String? DocType;
    String? DocCategory;
    String? DocSubCategory;
    String? DocTitle;
    String? DocDescription;
    Uint8List? DocData = [];
    DateTime? DocExpiration;
    String? DocMimeType;
    int? DisplayOrder;
    double? FileSizeInKB;
    String? Link;
    DateTime? UploadDate;
    String? DocKey;

    Document({this.DocumentId,this.DocType,this.DocCategory,this.DocSubCategory,this.DocTitle,this.DocDescription,this.DocData,this.DocExpiration,this.DocMimeType,this.DisplayOrder,this.FileSizeInKB,this.Link,this.UploadDate,this.DocKey});
    Document.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        DocumentId = json['DocumentId'];
        DocType = json['DocType'];
        DocCategory = json['DocCategory'];
        DocSubCategory = json['DocSubCategory'];
        DocTitle = json['DocTitle'];
        DocDescription = json['DocDescription'];
        DocData = JsonConverters.fromJson(json['DocData'],'Uint8List',context!);
        DocExpiration = JsonConverters.fromJson(json['DocExpiration'],'DateTime',context!);
        DocMimeType = json['DocMimeType'];
        DisplayOrder = json['DisplayOrder'];
        FileSizeInKB = JsonConverters.toDouble(json['FileSizeInKB']);
        Link = json['Link'];
        UploadDate = JsonConverters.fromJson(json['UploadDate'],'DateTime',context!);
        DocKey = json['DocKey'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'DocumentId': DocumentId,
        'DocType': DocType,
        'DocCategory': DocCategory,
        'DocSubCategory': DocSubCategory,
        'DocTitle': DocTitle,
        'DocDescription': DocDescription,
        'DocData': JsonConverters.toJson(DocData,'Uint8List',context!),
        'DocExpiration': JsonConverters.toJson(DocExpiration,'DateTime',context!),
        'DocMimeType': DocMimeType,
        'DisplayOrder': DisplayOrder,
        'FileSizeInKB': FileSizeInKB,
        'Link': Link,
        'UploadDate': JsonConverters.toJson(UploadDate,'DateTime',context!),
        'DocKey': DocKey
    };

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

class Resource implements IConvertible
{
    String? ResourceType;
    List<ResourceCategory>? Categories = [];
    List<Document>? Documents = [];

    Resource({this.ResourceType,this.Categories,this.Documents});
    Resource.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        ResourceType = json['ResourceType'];
        Categories = JsonConverters.fromJson(json['Categories'],'List<ResourceCategory>',context!);
        Documents = JsonConverters.fromJson(json['Documents'],'List<Document>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'ResourceType': ResourceType,
        'Categories': JsonConverters.toJson(Categories,'List<ResourceCategory>',context!),
        'Documents': JsonConverters.toJson(Documents,'List<Document>',context!)
    };

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

class ResourceResponse implements IConvertible
{
    ResponseStatus? ResponseStatus;
    List<Resource>? Resource = [];

    ResourceResponse({this.ResponseStatus,this.Resource});
    ResourceResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

    Map<String, dynamic> toJson() => {
        'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!),
        'Resource': JsonConverters.toJson(Resource,'List<Resource>',context!)
    };

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

class ResourceRequest implements IConvertible
{
    List<Resource>? Resource = [];

    ResourceRequest({this.Resource});
    ResourceRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

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

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

TypeContext _ctx = TypeContext(library: 'api.dev.dynamics.trendsic.com', types: <String, TypeInfo> {
    'ResourceCategory': TypeInfo(TypeOf.Class, create:() => ResourceCategory()),
    'Document': TypeInfo(TypeOf.Class, create:() => Document()),
    'Uint8List': TypeInfo(TypeOf.Class, create:() => Uint8List(0)),
    'Resource': TypeInfo(TypeOf.Class, create:() => Resource()),
    'List<ResourceCategory>': TypeInfo(TypeOf.Class, create:() => <ResourceCategory>[]),
    'List<Document>': TypeInfo(TypeOf.Class, create:() => <Document>[]),
    'ResourceResponse': TypeInfo(TypeOf.Class, create:() => ResourceResponse()),
    'List<Resource>': TypeInfo(TypeOf.Class, create:() => <Resource>[]),
    'ResourceRequest': TypeInfo(TypeOf.Class, create:() => ResourceRequest()),
});

Dart ResourceRequest 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 /v1/Resource HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	Resource: 
	[
		{
			ResourceType: String,
			Categories: 
			[
				{
					CategoryName: String,
					Subcategories: 
					[
						String
					]
				}
			],
			Documents: 
			[
				{
					DocumentId: 00000000000000000000000000000000,
					DocType: String,
					DocCategory: String,
					DocSubCategory: String,
					DocTitle: String,
					DocDescription: String,
					DocData: AA==,
					DocExpiration: 0001-01-01,
					DocMimeType: String,
					DisplayOrder: 0,
					FileSizeInKB: 0,
					Link: String,
					UploadDate: 0001-01-01,
					DocKey: String
				}
			]
		}
	]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	},
	Resource: 
	[
		{
			ResourceType: String,
			Categories: 
			[
				{
					CategoryName: String,
					Subcategories: 
					[
						String
					]
				}
			],
			Documents: 
			[
				{
					DocumentId: 00000000000000000000000000000000,
					DocType: String,
					DocCategory: String,
					DocSubCategory: String,
					DocTitle: String,
					DocDescription: String,
					DocData: AA==,
					DocExpiration: 0001-01-01,
					DocMimeType: String,
					DisplayOrder: 0,
					FileSizeInKB: 0,
					Link: String,
					UploadDate: 0001-01-01,
					DocKey: String
				}
			]
		}
	]
}