Trendsic Platform Service

<back to all web services

GiftCardSurveyRequest

Requires Authentication
Requires any of the roles:Agent, Administrator
The following routes are available for this service:
GET/v1/Survey/GiftCard/{UID}
import 'package:servicestack/servicestack.dart';
import 'dart:typed_data';

class SurveyQuestion implements IConvertible
{
    int? QuestionId;
    String? QuestionType;
    String? HTML;
    String? DependsOn;

    SurveyQuestion({this.QuestionId,this.QuestionType,this.HTML,this.DependsOn});
    SurveyQuestion.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        QuestionId = json['QuestionId'];
        QuestionType = json['QuestionType'];
        HTML = json['HTML'];
        DependsOn = json['DependsOn'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'QuestionId': QuestionId,
        'QuestionType': QuestionType,
        'HTML': HTML,
        'DependsOn': DependsOn
    };

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

class Survey implements IConvertible
{
    int? SurveyId;
    int? ContactId;
    List<SurveyQuestion>? Questions = [];

    Survey({this.SurveyId,this.ContactId,this.Questions});
    Survey.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

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

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

class GiftCardSurvey extends Survey implements IConvertible
{
    int? GiftCardId;
    List<String>? GiftCards = [];

    GiftCardSurvey({this.GiftCardId,this.GiftCards});
    GiftCardSurvey.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

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

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

class GiftCardSurveyResponse implements IConvertible
{
    GiftCardSurvey? Survey;
    ResponseStatus? ResponseStatus;

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

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

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

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

class GiftCardSurveyRequest implements IConvertible
{
    String? UID;

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

    fromMap(Map<String, dynamic> json) {
        UID = json['UID'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'UID': UID
    };

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

TypeContext _ctx = TypeContext(library: 'api.dev.dynamics.trendsic.com', types: <String, TypeInfo> {
    'SurveyQuestion': TypeInfo(TypeOf.Class, create:() => SurveyQuestion()),
    'Survey': TypeInfo(TypeOf.Class, create:() => Survey()),
    'List<SurveyQuestion>': TypeInfo(TypeOf.Class, create:() => <SurveyQuestion>[]),
    'GiftCardSurvey': TypeInfo(TypeOf.Class, create:() => GiftCardSurvey()),
    'GiftCardSurveyResponse': TypeInfo(TypeOf.Class, create:() => GiftCardSurveyResponse()),
    'GiftCardSurveyRequest': TypeInfo(TypeOf.Class, create:() => GiftCardSurveyRequest()),
});

Dart GiftCardSurveyRequest 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.

GET /v1/Survey/GiftCard/{UID} HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Survey: 
	{
		GiftCardId: 0,
		GiftCards: 
		[
			String
		],
		SurveyId: 0,
		ContactId: 0,
		Questions: 
		[
			{
				QuestionId: 0,
				QuestionType: String,
				HTML: String,
				DependsOn: String
			}
		]
	},
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	}
}