Cochrane+ App API

<back to all web services

SubmitThunderBoltAction

Requires Authentication
The following routes are available for this service:
POST/thunderbolt/submit
import 'package:servicestack/servicestack.dart';

class ApiServiceRequest implements IServiceRequest, IHasApiKey, IHasDeviceInfo, IConvertible
{
    /**
    * The API Key required for authentication
    */
    // @ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true)
    String? apiKey;

    /**
    * Latitude of the user making this request
    */
    // @ApiMember(DataType="double", Description="Latitude of the user making this request")
    double? latitude;

    /**
    * Longitude of the user making this request
    */
    // @ApiMember(DataType="double", Description="Longitude of the user making this request")
    double? longitude;

    ApiServiceRequest({this.apiKey,this.latitude,this.longitude});
    ApiServiceRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        apiKey = json['apiKey'];
        latitude = JsonConverters.toDouble(json['latitude']);
        longitude = JsonConverters.toDouble(json['longitude']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'apiKey': apiKey,
        'latitude': latitude,
        'longitude': longitude
    };

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

class ApiServiceResponse implements IServiceResponse, IConvertible
{
    String? description;
    String? heading;
    bool? wasSuccessful;
    dynamic? modelState;

    ApiServiceResponse({this.description,this.heading,this.wasSuccessful,this.modelState});
    ApiServiceResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

    Map<String, dynamic> toJson() => {
        'description': description,
        'heading': heading,
        'wasSuccessful': wasSuccessful,
        'modelState': JsonConverters.toJson(modelState,'dynamic',context!)
    };

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

class EnumOption implements IConvertible
{
    int? value;
    String? label;

    EnumOption({this.value,this.label});
    EnumOption.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

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

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

class ThunderBoltActionData implements IConvertible
{
    int? id;
    String? actionName;
    String? color;
    int? dailyActionCount;
    bool? showNumberInput;
    bool? showEmailInput;
    bool? showPlatformInput;
    bool? showDateTimeInput;
    List<EnumOption>? contactInteractionPlatforms;

    ThunderBoltActionData({this.id,this.actionName,this.color,this.dailyActionCount,this.showNumberInput,this.showEmailInput,this.showPlatformInput,this.showDateTimeInput,this.contactInteractionPlatforms});
    ThunderBoltActionData.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        actionName = json['actionName'];
        color = json['color'];
        dailyActionCount = json['dailyActionCount'];
        showNumberInput = json['showNumberInput'];
        showEmailInput = json['showEmailInput'];
        showPlatformInput = json['showPlatformInput'];
        showDateTimeInput = json['showDateTimeInput'];
        contactInteractionPlatforms = JsonConverters.fromJson(json['contactInteractionPlatforms'],'List<EnumOption>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'actionName': actionName,
        'color': color,
        'dailyActionCount': dailyActionCount,
        'showNumberInput': showNumberInput,
        'showEmailInput': showEmailInput,
        'showPlatformInput': showPlatformInput,
        'showDateTimeInput': showDateTimeInput,
        'contactInteractionPlatforms': JsonConverters.toJson(contactInteractionPlatforms,'List<EnumOption>',context!)
    };

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

class ThunderBoltActionEventData implements IConvertible
{
    int? id;
    String? createdDate;
    int? actionId;
    String? actionName;
    String? color;
    String? notes;

    ThunderBoltActionEventData({this.id,this.createdDate,this.actionId,this.actionName,this.color,this.notes});
    ThunderBoltActionEventData.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        createdDate = json['createdDate'];
        actionId = json['actionId'];
        actionName = json['actionName'];
        color = json['color'];
        notes = json['notes'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'createdDate': createdDate,
        'actionId': actionId,
        'actionName': actionName,
        'color': color,
        'notes': notes
    };

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

class ContactData implements IConvertible
{
    int? contactId;
    String? contactName;
    String? email;
    String? phoneNumber;

    ContactData({this.contactId,this.contactName,this.email,this.phoneNumber});
    ContactData.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        contactId = json['contactId'];
        contactName = json['contactName'];
        email = json['email'];
        phoneNumber = json['phoneNumber'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'contactId': contactId,
        'contactName': contactName,
        'email': email,
        'phoneNumber': phoneNumber
    };

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

class GetThunderBoltActionsResponse extends ApiServiceResponse implements IConvertible
{
    int? dailyActionsNumber;
    int? supportingDocumentProbability;
    List<ThunderBoltActionData>? thunderBoltActions;
    List<ThunderBoltActionEventData>? thunderBoltActionEvents;
    List<ContactData>? contacts;

    GetThunderBoltActionsResponse({this.dailyActionsNumber,this.supportingDocumentProbability,this.thunderBoltActions,this.thunderBoltActionEvents,this.contacts});
    GetThunderBoltActionsResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        dailyActionsNumber = json['dailyActionsNumber'];
        supportingDocumentProbability = json['supportingDocumentProbability'];
        thunderBoltActions = JsonConverters.fromJson(json['thunderBoltActions'],'List<ThunderBoltActionData>',context!);
        thunderBoltActionEvents = JsonConverters.fromJson(json['thunderBoltActionEvents'],'List<ThunderBoltActionEventData>',context!);
        contacts = JsonConverters.fromJson(json['contacts'],'List<ContactData>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'dailyActionsNumber': dailyActionsNumber,
        'supportingDocumentProbability': supportingDocumentProbability,
        'thunderBoltActions': JsonConverters.toJson(thunderBoltActions,'List<ThunderBoltActionData>',context!),
        'thunderBoltActionEvents': JsonConverters.toJson(thunderBoltActionEvents,'List<ThunderBoltActionEventData>',context!),
        'contacts': JsonConverters.toJson(contacts,'List<ContactData>',context!)
    });

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

class SubmitThunderBoltActionResponse extends GetThunderBoltActionsResponse implements IConvertible
{
    int? thunderboltActionEventId;

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

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

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'thunderboltActionEventId': thunderboltActionEventId
    });

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

class ContactInteractionPlatform
{
    static const ContactInteractionPlatform None = const ContactInteractionPlatform._(0);
    static const ContactInteractionPlatform Whatsapp = const ContactInteractionPlatform._(1);
    static const ContactInteractionPlatform Linkus = const ContactInteractionPlatform._(2);
    static const ContactInteractionPlatform Mobile = const ContactInteractionPlatform._(3);
    static const ContactInteractionPlatform Outlook = const ContactInteractionPlatform._(4);
    static const ContactInteractionPlatform LinkedIn = const ContactInteractionPlatform._(5);
    static const ContactInteractionPlatform Telegram = const ContactInteractionPlatform._(6);
    static const ContactInteractionPlatform Signal = const ContactInteractionPlatform._(7);
    static const ContactInteractionPlatform Sms = const ContactInteractionPlatform._(8);

    final int _value;
    const ContactInteractionPlatform._(this._value);
    int get value => _value;
    static List<ContactInteractionPlatform> get values => const [None,Whatsapp,Linkus,Mobile,Outlook,LinkedIn,Telegram,Signal,Sms];
}

class SubmitThunderBoltAction extends ApiServiceRequest implements IConvertible
{
    int? actionId;
    ContactInteractionPlatform? platform;
    String? number;
    String? email;
    String? notes;
    DateTime? dateTime;
    int? contactId;

    SubmitThunderBoltAction({this.actionId,this.platform,this.number,this.email,this.notes,this.dateTime,this.contactId});
    SubmitThunderBoltAction.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        actionId = json['actionId'];
        platform = JsonConverters.fromJson(json['platform'],'ContactInteractionPlatform',context!);
        number = json['number'];
        email = json['email'];
        notes = json['notes'];
        dateTime = JsonConverters.fromJson(json['dateTime'],'DateTime',context!);
        contactId = json['contactId'];
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'actionId': actionId,
        'platform': JsonConverters.toJson(platform,'ContactInteractionPlatform',context!),
        'number': number,
        'email': email,
        'notes': notes,
        'dateTime': JsonConverters.toJson(dateTime,'DateTime',context!),
        'contactId': contactId
    });

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

TypeContext _ctx = TypeContext(library: 'cochraneplus_api_dev.happen.zone', types: <String, TypeInfo> {
    'ApiServiceRequest': TypeInfo(TypeOf.Class, create:() => ApiServiceRequest()),
    'ApiServiceResponse': TypeInfo(TypeOf.Class, create:() => ApiServiceResponse()),
    'EnumOption': TypeInfo(TypeOf.Class, create:() => EnumOption()),
    'ThunderBoltActionData': TypeInfo(TypeOf.Class, create:() => ThunderBoltActionData()),
    'List<EnumOption>': TypeInfo(TypeOf.Class, create:() => <EnumOption>[]),
    'ThunderBoltActionEventData': TypeInfo(TypeOf.Class, create:() => ThunderBoltActionEventData()),
    'ContactData': TypeInfo(TypeOf.Class, create:() => ContactData()),
    'GetThunderBoltActionsResponse': TypeInfo(TypeOf.Class, create:() => GetThunderBoltActionsResponse()),
    'List<ThunderBoltActionData>': TypeInfo(TypeOf.Class, create:() => <ThunderBoltActionData>[]),
    'List<ThunderBoltActionEventData>': TypeInfo(TypeOf.Class, create:() => <ThunderBoltActionEventData>[]),
    'List<ContactData>': TypeInfo(TypeOf.Class, create:() => <ContactData>[]),
    'SubmitThunderBoltActionResponse': TypeInfo(TypeOf.Class, create:() => SubmitThunderBoltActionResponse()),
    'ContactInteractionPlatform': TypeInfo(TypeOf.Enum, enumValues:ContactInteractionPlatform.values),
    'SubmitThunderBoltAction': TypeInfo(TypeOf.Class, create:() => SubmitThunderBoltAction()),
});

Dart SubmitThunderBoltAction 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 /thunderbolt/submit HTTP/1.1 
Host: cochraneplus-api-dev.happen.zone 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"actionId":0,"platform":0,"number":"String","email":"String","notes":"String","dateTime":"0001-01-01T00:00:00.0000000","contactId":0,"apiKey":"String","latitude":0,"longitude":0}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"thunderboltActionEventId":0,"dailyActionsNumber":0,"supportingDocumentProbability":0,"thunderBoltActions":[{"id":0,"actionName":"String","color":"String","dailyActionCount":0,"showNumberInput":false,"showEmailInput":false,"showPlatformInput":false,"showDateTimeInput":false,"contactInteractionPlatforms":[{"value":0,"label":"String"}]}],"thunderBoltActionEvents":[{"id":0,"createdDate":"String","actionId":0,"actionName":"String","color":"String","notes":"String"}],"contacts":[{}],"description":"String","heading":"String","wasSuccessful":false,"modelState":{}}