Sanctions Search API: v2

<back to all web services

AddSubUser

Account
The following routes are available for this service:
POST/subusers/createCreate a sub user
import 'package:servicestack/servicestack.dart';
import 'dart:typed_data';

// @DataContract
class Authentication implements IConvertible
{
    /**
    * The API User ID provided by us when you signed up to use our API
    */
    // @DataMember
    // @ApiMember(Description="The API User ID provided by us when you signed up to use our API", IsRequired=true, ParameterType="header, body")
    String? apiUserId;

    /**
    * The API User Key provided by us when you signed up to use our API
    */
    // @DataMember
    // @ApiMember(Description="The API User Key provided by us when you signed up to use our API", IsRequired=true, ParameterType="header, body")
    String? apiUserKey;

    Authentication({this.apiUserId,this.apiUserKey});
    Authentication.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

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

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

// @DataContract
class BaseRequest implements IBaseRequest, IConvertible
{
    /**
    * The authentication credentials
    */
    // @DataMember
    // @ApiMember(Description="The authentication credentials", IsRequired=true, ParameterType="header, body")
    Authentication? authentication;

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

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

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

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

// @DataContract
class ResponseError implements IConvertible
{
    // @DataMember(Order=1)
    String? errorCode;

    // @DataMember(Order=2)
    String? fieldName;

    // @DataMember(Order=3)
    String? message;

    // @DataMember(Order=4)
    Map<String,String?>? meta;

    ResponseError({this.errorCode,this.fieldName,this.message,this.meta});
    ResponseError.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        errorCode = json['errorCode'];
        fieldName = json['fieldName'];
        message = json['message'];
        meta = JsonConverters.toStringMap(json['meta']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'errorCode': errorCode,
        'fieldName': fieldName,
        'message': message,
        'meta': meta
    };

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

class ArrayOfResponseError extends ListBase<ResponseError> implements IConvertible
{
    final List<ResponseError> l = [];
    set length(int newLength) { l.length = newLength; }
    int get length => l.length;
    ResponseError operator [](int index) => l[index];
    void operator []=(int index, ResponseError value) { l[index] = value; }
    ArrayOfResponseError();
    ArrayOfResponseError.fromJson(Map<String, dynamic> json) : super();
    fromMap(Map<String, dynamic> json) {
        return this;
    }

    Map<String, dynamic> toJson() => {};
    getTypeName() => "ArrayOfResponseError";
    TypeContext? context = _ctx;
}

// @DataContract
class ResponseStatus implements IConvertible
{
    // @DataMember(Order=1)
    String? errorCode;

    // @DataMember(Order=2)
    String? message;

    // @DataMember(Order=3)
    String? stackTrace;

    // @DataMember(Order=4)
    ArrayOfResponseError? errors;

    // @DataMember(Order=5)
    Map<String,String?>? meta;

    ResponseStatus({this.errorCode,this.message,this.stackTrace,this.errors,this.meta});
    ResponseStatus.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        errorCode = json['errorCode'];
        message = json['message'];
        stackTrace = json['stackTrace'];
        errors = JsonConverters.fromJson(json['errors'],'ArrayOfResponseError',context!);
        meta = JsonConverters.toStringMap(json['meta']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'errorCode': errorCode,
        'message': message,
        'stackTrace': stackTrace,
        'errors': JsonConverters.toJson(errors,'ArrayOfResponseError',context!),
        'meta': meta
    };

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

class BaseResponse implements IBaseDataResponse, IHasResponseStatus, IConvertible
{
    /**
    * The status of the response
    */
    // @ApiMember(Description="The status of the response")
    ResponseStatus? responseStatus;

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

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

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

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

class ArrayOfUserNames extends ListBase<String> implements IConvertible
{
    final List<String> l = [];
    set length(int newLength) { l.length = newLength; }
    int get length => l.length;
    String operator [](int index) => l[index];
    void operator []=(int index, String value) { l[index] = value; }
    ArrayOfUserNames();
    ArrayOfUserNames.fromJson(Map<String, dynamic> json) : super();
    fromMap(Map<String, dynamic> json) {
        return this;
    }

    Map<String, dynamic> toJson() => {};
    getTypeName() => "ArrayOfUserNames";
    TypeContext? context = _ctx;
}

class SubUser implements IConvertible
{
    /**
    * Is this user the main user (i.e. the user who created the account)
    */
    // @ApiMember(Description="Is this user the main user (i.e. the user who created the account)")
    bool? isMainUser;

    /**
    * The sub user's id (GUID)
    */
    // @ApiMember(Description="The sub user's id (GUID)")
    String? userId;

    /**
    * The sub user's UserName (i.e. the sign-in username)
    */
    // @ApiMember(Description="The sub user's UserName (i.e. the sign-in username)")
    String? userName;

    /**
    * The sub user's name
    */
    // @ApiMember(Description="The sub user's name")
    String? name;

    /**
    * The sub user's email address
    */
    // @ApiMember(Description="The sub user's email address")
    String? email;

    /**
    * Does this sub user have admin privileges, such as managing purchases and sub users
    */
    // @ApiMember(Description="Does this sub user have admin privileges, such as managing purchases and sub users")
    bool? isAdmin;

    /**
    * Can this sub user resolve searches (UpdateSearch) they have access to
    */
    // @ApiMember(Description="Can this sub user resolve searches (UpdateSearch) they have access to")
    bool? canResolveSearches;

    /**
    * Can this sub user delete searches (DeleteSearch) they have access to
    */
    // @ApiMember(Description="Can this sub user delete searches (DeleteSearch) they have access to")
    bool? canDeleteSearches;

    /**
    * The user names for which searches will be made available to the sub user
    */
    // @ApiMember(Description="The user names for which searches will be made available to the sub user")
    ArrayOfUserNames? permissions;

    SubUser({this.isMainUser,this.userId,this.userName,this.name,this.email,this.isAdmin,this.canResolveSearches,this.canDeleteSearches,this.permissions});
    SubUser.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        isMainUser = json['isMainUser'];
        userId = json['userId'];
        userName = json['userName'];
        name = json['name'];
        email = json['email'];
        isAdmin = json['isAdmin'];
        canResolveSearches = json['canResolveSearches'];
        canDeleteSearches = json['canDeleteSearches'];
        permissions = JsonConverters.fromJson(json['permissions'],'ArrayOfUserNames',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'isMainUser': isMainUser,
        'userId': userId,
        'userName': userName,
        'name': name,
        'email': email,
        'isAdmin': isAdmin,
        'canResolveSearches': canResolveSearches,
        'canDeleteSearches': canDeleteSearches,
        'permissions': JsonConverters.toJson(permissions,'ArrayOfUserNames',context!)
    };

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

class AddSubUserData extends BaseResponse implements IConvertible
{
    /**
    * The sub user
    */
    // @ApiMember(Description="The sub user")
    SubUser? subUser;

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

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

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

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

// @DataContract
class AddSubUserResponse implements IConvertible
{
    /**
    * The response data
    */
    // @DataMember
    // @ApiMember(Description="The response data")
    AddSubUserData? data;

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

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

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

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

class AddSubUserRequest implements IConvertible
{
    String? userName;
    String? name;
    String? email;
    bool? isAdmin;
    bool? canResolveSearches;
    bool? canDeleteSearches;
    bool? sendWelcomeEmail;

    AddSubUserRequest({this.userName,this.name,this.email,this.isAdmin,this.canResolveSearches,this.canDeleteSearches,this.sendWelcomeEmail});
    AddSubUserRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        userName = json['userName'];
        name = json['name'];
        email = json['email'];
        isAdmin = json['isAdmin'];
        canResolveSearches = json['canResolveSearches'];
        canDeleteSearches = json['canDeleteSearches'];
        sendWelcomeEmail = json['sendWelcomeEmail'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'userName': userName,
        'name': name,
        'email': email,
        'isAdmin': isAdmin,
        'canResolveSearches': canResolveSearches,
        'canDeleteSearches': canDeleteSearches,
        'sendWelcomeEmail': sendWelcomeEmail
    };

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

// @DataContract
class AddSubUser extends BaseRequest implements IConvertible
{
    // @DataMember
    AddSubUserRequest? request;

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

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

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

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

TypeContext _ctx = TypeContext(library: 'api.sanctionssearch.com', types: <String, TypeInfo> {
    'Authentication': TypeInfo(TypeOf.Class, create:() => Authentication()),
    'BaseRequest': TypeInfo(TypeOf.Class, create:() => BaseRequest()),
    'ArrayOfResponseError': TypeInfo(TypeOf.Class, create:() => ArrayOfResponseError()),
    'BaseResponse': TypeInfo(TypeOf.Class, create:() => BaseResponse()),
    'ArrayOfUserNames': TypeInfo(TypeOf.Class, create:() => ArrayOfUserNames()),
    'SubUser': TypeInfo(TypeOf.Class, create:() => SubUser()),
    'AddSubUserData': TypeInfo(TypeOf.Class, create:() => AddSubUserData()),
    'AddSubUserResponse': TypeInfo(TypeOf.Class, create:() => AddSubUserResponse()),
    'AddSubUserRequest': TypeInfo(TypeOf.Class, create:() => AddSubUserRequest()),
    'AddSubUser': TypeInfo(TypeOf.Class, create:() => AddSubUser()),
});

Dart AddSubUser 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 /subusers/create HTTP/1.1 
Host: api.sanctionssearch.com 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"request":{"userName":"String","name":"String","email":"String","isAdmin":false,"canResolveSearches":false,"canDeleteSearches":false,"sendWelcomeEmail":false},"authentication":{"apiUserId":"String","apiUserKey":"String"}}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"data":{"subUser":{"isMainUser":false,"userName":"String","name":"String","email":"String","isAdmin":false,"canResolveSearches":false,"canDeleteSearches":false,"permissions":["String"]},"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}}