Cochrane+ App API

<back to all web services

UserLogin

The following routes are available for this service:
POST/user/login
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 SystemUserPermission implements IConvertible
{
    bool? meeting;
    bool? journey;
    bool? attendance;
    bool? notificationCenter;
    bool? internalRating;
    bool? debrief;
    bool? thunderBoltActions;
    bool? onTheMove;

    SystemUserPermission({this.meeting,this.journey,this.attendance,this.notificationCenter,this.internalRating,this.debrief,this.thunderBoltActions,this.onTheMove});
    SystemUserPermission.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        meeting = json['meeting'];
        journey = json['journey'];
        attendance = json['attendance'];
        notificationCenter = json['notificationCenter'];
        internalRating = json['internalRating'];
        debrief = json['debrief'];
        thunderBoltActions = json['thunderBoltActions'];
        onTheMove = json['onTheMove'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'meeting': meeting,
        'journey': journey,
        'attendance': attendance,
        'notificationCenter': notificationCenter,
        'internalRating': internalRating,
        'debrief': debrief,
        'thunderBoltActions': thunderBoltActions,
        'onTheMove': onTheMove
    };

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

class AppSettings implements IConvertible
{
    bool? allowAbstainRatings;
    bool? showMoodIndicatorOnApp;
    bool? takePhotoForAnalysis;

    AppSettings({this.allowAbstainRatings,this.showMoodIndicatorOnApp,this.takePhotoForAnalysis});
    AppSettings.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

    Map<String, dynamic> toJson() => {
        'allowAbstainRatings': allowAbstainRatings,
        'showMoodIndicatorOnApp': showMoodIndicatorOnApp,
        'takePhotoForAnalysis': takePhotoForAnalysis
    };

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

class UserLoginResponse extends ApiServiceResponse implements IConvertible
{
    bool? allowAttendanceOnLaptop;
    String? profileImageUrl;
    String? friendlyName;
    int? systemUserId;
    String? username;
    SystemUserPermission? permissions;
    AppSettings? settings;
    double? startLatitude;
    double? startLongitude;
    bool? hasStartLocation;
    double? endLatitude;
    double? endLongitude;
    bool? hasEndLocation;
    bool? isSalesPerson;
    List<String>? feelingStatusMappings;
    bool? hasAiPermissions;
    String? refreshToken;
    bool? isManagerOrPromotedTo;
    bool? isTemplateApprover;
    int? outstandingApprovals;

    UserLoginResponse({this.allowAttendanceOnLaptop,this.profileImageUrl,this.friendlyName,this.systemUserId,this.username,this.permissions,this.settings,this.startLatitude,this.startLongitude,this.hasStartLocation,this.endLatitude,this.endLongitude,this.hasEndLocation,this.isSalesPerson,this.feelingStatusMappings,this.hasAiPermissions,this.refreshToken,this.isManagerOrPromotedTo,this.isTemplateApprover,this.outstandingApprovals});
    UserLoginResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        allowAttendanceOnLaptop = json['allowAttendanceOnLaptop'];
        profileImageUrl = json['profileImageUrl'];
        friendlyName = json['friendlyName'];
        systemUserId = json['systemUserId'];
        username = json['username'];
        permissions = JsonConverters.fromJson(json['permissions'],'SystemUserPermission',context!);
        settings = JsonConverters.fromJson(json['settings'],'AppSettings',context!);
        startLatitude = JsonConverters.toDouble(json['startLatitude']);
        startLongitude = JsonConverters.toDouble(json['startLongitude']);
        hasStartLocation = json['hasStartLocation'];
        endLatitude = JsonConverters.toDouble(json['endLatitude']);
        endLongitude = JsonConverters.toDouble(json['endLongitude']);
        hasEndLocation = json['hasEndLocation'];
        isSalesPerson = json['isSalesPerson'];
        feelingStatusMappings = JsonConverters.fromJson(json['feelingStatusMappings'],'List<String>',context!);
        hasAiPermissions = json['hasAiPermissions'];
        refreshToken = json['refreshToken'];
        isManagerOrPromotedTo = json['isManagerOrPromotedTo'];
        isTemplateApprover = json['isTemplateApprover'];
        outstandingApprovals = json['outstandingApprovals'];
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'allowAttendanceOnLaptop': allowAttendanceOnLaptop,
        'profileImageUrl': profileImageUrl,
        'friendlyName': friendlyName,
        'systemUserId': systemUserId,
        'username': username,
        'permissions': JsonConverters.toJson(permissions,'SystemUserPermission',context!),
        'settings': JsonConverters.toJson(settings,'AppSettings',context!),
        'startLatitude': startLatitude,
        'startLongitude': startLongitude,
        'hasStartLocation': hasStartLocation,
        'endLatitude': endLatitude,
        'endLongitude': endLongitude,
        'hasEndLocation': hasEndLocation,
        'isSalesPerson': isSalesPerson,
        'feelingStatusMappings': JsonConverters.toJson(feelingStatusMappings,'List<String>',context!),
        'hasAiPermissions': hasAiPermissions,
        'refreshToken': refreshToken,
        'isManagerOrPromotedTo': isManagerOrPromotedTo,
        'isTemplateApprover': isTemplateApprover,
        'outstandingApprovals': outstandingApprovals
    });

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

class UserLogin extends ApiServiceRequest implements IConvertible
{
    String? username;
    String? password;
    int? utcOffset;

    UserLogin({this.username,this.password,this.utcOffset});
    UserLogin.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

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

    getTypeName() => "UserLogin";
    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()),
    'SystemUserPermission': TypeInfo(TypeOf.Class, create:() => SystemUserPermission()),
    'AppSettings': TypeInfo(TypeOf.Class, create:() => AppSettings()),
    'UserLoginResponse': TypeInfo(TypeOf.Class, create:() => UserLoginResponse()),
    'UserLogin': TypeInfo(TypeOf.Class, create:() => UserLogin()),
});

Dart UserLogin 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 /user/login HTTP/1.1 
Host: cochraneplus-api-dev.happen.zone 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	username: String,
	password: String,
	utcOffset: 0,
	apiKey: String,
	latitude: 0,
	longitude: 0
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	allowAttendanceOnLaptop: False,
	profileImageUrl: String,
	friendlyName: String,
	systemUserId: 0,
	username: String,
	permissions: 
	{
		meeting: False,
		journey: False,
		attendance: False,
		notificationCenter: False,
		internalRating: False,
		debrief: False,
		thunderBoltActions: False,
		onTheMove: False
	},
	settings: 
	{
		allowAbstainRatings: False,
		showMoodIndicatorOnApp: False,
		takePhotoForAnalysis: False
	},
	startLatitude: 0,
	startLongitude: 0,
	hasStartLocation: False,
	endLatitude: 0,
	endLongitude: 0,
	hasEndLocation: False,
	isSalesPerson: False,
	feelingStatusMappings: 
	[
		String
	],
	hasAiPermissions: False,
	refreshToken: String,
	isManagerOrPromotedTo: False,
	isTemplateApprover: False,
	outstandingApprovals: 0,
	description: String,
	heading: String,
	wasSuccessful: False,
	modelState: {}
}