CoreService

<back to all web services

QueryUserNotes

UserNote - CRUD

Returns a list of user notes

Requires Authentication
Required roles:TenantReader, TenantReader
The following routes are available for this service:
GET/api/usernotesReturns a list of user notes, filterable by ConfigItemId
GET/usernotesReturns a list of user notes, filterable by ConfigItemId
import 'package:servicestack/servicestack.dart';

// @DataContract
abstract class QueryBase
{
    // @DataMember(Order=1)
    int? skip;

    // @DataMember(Order=2)
    int? take;

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

    // @DataMember(Order=4)
    String? orderByDesc;

    // @DataMember(Order=5)
    String? include;

    // @DataMember(Order=6)
    String? fields;

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

    QueryBase({this.skip,this.take,this.orderBy,this.orderByDesc,this.include,this.fields,this.meta});
    QueryBase.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        skip = json['skip'];
        take = json['take'];
        orderBy = json['orderBy'];
        orderByDesc = json['orderByDesc'];
        include = json['include'];
        fields = json['fields'];
        meta = JsonConverters.toStringMap(json['meta']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'skip': skip,
        'take': take,
        'orderBy': orderBy,
        'orderByDesc': orderByDesc,
        'include': include,
        'fields': fields,
        'meta': meta
    };

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

abstract class QueryDb<T> extends QueryBase
{
    QueryDb();
    QueryDb.fromJson(Map<String, dynamic> json) : super.fromJson(json);
    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson();
    getTypeName() => "QueryDb<$T>";
    TypeContext? context = _ctx;
}

class Auditable implements IAuditable, IConvertible
{
    // @required()
    DateTime created = DateTime(0);

    // @required()
    String createUser = "";

    // @required()
    String createUserId = "";

    // @required()
    DateTime modified = DateTime(0);

    // @required()
    String modifyUser = "";

    // @required()
    String modifyUserId = "";

    // @required()
    bool isDeleted;

    DateTime? deleted;
    String? deleteUser;
    String? deleteUserId;

    Auditable({this.created,this.createUser,this.createUserId,this.modified,this.modifyUser,this.modifyUserId,this.isDeleted,this.deleted,this.deleteUser,this.deleteUserId});
    Auditable.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        created = JsonConverters.fromJson(json['created'],'DateTime',context!);
        createUser = json['createUser'];
        createUserId = json['createUserId'];
        modified = JsonConverters.fromJson(json['modified'],'DateTime',context!);
        modifyUser = json['modifyUser'];
        modifyUserId = json['modifyUserId'];
        isDeleted = json['isDeleted'];
        deleted = JsonConverters.fromJson(json['deleted'],'DateTime',context!);
        deleteUser = json['deleteUser'];
        deleteUserId = json['deleteUserId'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'created': JsonConverters.toJson(created,'DateTime',context!),
        'createUser': createUser,
        'createUserId': createUserId,
        'modified': JsonConverters.toJson(modified,'DateTime',context!),
        'modifyUser': modifyUser,
        'modifyUserId': modifyUserId,
        'isDeleted': isDeleted,
        'deleted': JsonConverters.toJson(deleted,'DateTime',context!),
        'deleteUser': deleteUser,
        'deleteUserId': deleteUserId
    };

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

enum ObjectTypes
{
    None,
    ConfigItem,
    Tenant,
    Collection,
    Resource,
    ComputeNode,
    VirtualMachine,
    PhysicalMachine,
    Disk,
    Subnet,
    IPAddress,
    Job,
    JobEvent,
    FreezePeriod,
    ResourceGroup,
    Deployment,
    ResourceGroupTemplate,
    DeploymentTemplate,
    ResourceProvider,
    GenericResource,
    Role,
    Permission,
    User,
    PatchingWindow,
    Update,
    ReportDefinition,
    TimeSeries,
    DataPoint,
    Action,
    ActionAssignment,
    UserNote,
}

class UserNote extends Auditable implements IHasId, IHasObjectType, IHasTenantId, IConvertible
{
    String id = "";
    // @required()
    // @StringLength(1000)
    String message = "";

    // @required()
    String configItemId = "";

    // @required()
    ObjectTypes configItemType;

    // @required()
    String configItemName = "";

    // @required()
    String tenantId = "";

    // @ignore()
    ObjectTypes objectType;

    UserNote({this.id,this.message,this.configItemId,this.configItemType,this.configItemName,this.tenantId,this.objectType});
    UserNote.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        id = json['id'];
        message = json['message'];
        configItemId = json['configItemId'];
        configItemType = JsonConverters.fromJson(json['configItemType'],'ObjectTypes',context!);
        configItemName = json['configItemName'];
        tenantId = json['tenantId'];
        objectType = JsonConverters.fromJson(json['objectType'],'ObjectTypes',context!);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'id': id,
        'message': message,
        'configItemId': configItemId,
        'configItemType': JsonConverters.toJson(configItemType,'ObjectTypes',context!),
        'configItemName': configItemName,
        'tenantId': tenantId,
        'objectType': JsonConverters.toJson(objectType,'ObjectTypes',context!)
    });

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

/**
* Returns a list of user notes
*/
// @Api(Description="Returns a list of user notes")
// @ApiResponse(Description="Ok", ResponseType=typeof(0, Culture=neutral, PublicKeyToken=null]]), StatusCode=200)
class QueryUserNotes extends QueryDb<UserNote> implements IGetMultipleRequest, IHasTenantName, IGet, IConvertible
{
    // @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
    // @Validate(Validator="NotEmpty")
    String tenantName = "";

    /**
    * Filter notes by the config item they are attached to
    */
    // @ApiMember(DataType="string", Description="Filter notes by the config item they are attached to", Format="guid", ParameterType="query")
    String? configItemId;

    /**
    * If true, also soft deleted items will be returned
    */
    // @ApiMember(Description="If true, also soft deleted items will be returned", ParameterType="query")
    bool? includeDeleted;

    QueryUserNotes({this.tenantName,this.configItemId,this.includeDeleted});
    QueryUserNotes.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

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

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

class Tag implements IConvertible
{
    String name = "";
    String? value;
    bool isProtected;

    Tag({this.name,this.value,this.isProtected});
    Tag.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

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

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

class PathItem implements IConvertible
{
    String label = "";
    String link = "";
    ObjectTypes objectType;
    String objectId = "";

    PathItem({this.label,this.link,this.objectType,this.objectId});
    PathItem.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        label = json['label'];
        link = json['link'];
        objectType = JsonConverters.fromJson(json['objectType'],'ObjectTypes',context!);
        objectId = json['objectId'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'label': label,
        'link': link,
        'objectType': JsonConverters.toJson(objectType,'ObjectTypes',context!),
        'objectId': objectId
    };

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

class ConfigItem extends Auditable implements IConfigItem, IConvertible
{
    String id = "";
    // @required()
    String name = "";

    // @required()
    // @StringLength(250)
    String displayName = "";

    // @StringLength(8000)
    String? description;

    ObjectTypes objectType;
    // @ignore()
    String selfLink = "";

    // @required()
    List<Tag>? tags;

    // @required()
    List<PathItem>? path;

    ConfigItem({this.id,this.name,this.displayName,this.description,this.objectType,this.selfLink,this.tags,this.path});
    ConfigItem.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        id = json['id'];
        name = json['name'];
        displayName = json['displayName'];
        description = json['description'];
        objectType = JsonConverters.fromJson(json['objectType'],'ObjectTypes',context!);
        selfLink = json['selfLink'];
        tags = JsonConverters.fromJson(json['tags'],'List<Tag>',context!);
        path = JsonConverters.fromJson(json['path'],'List<PathItem>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'id': id,
        'name': name,
        'displayName': displayName,
        'description': description,
        'objectType': JsonConverters.toJson(objectType,'ObjectTypes',context!),
        'selfLink': selfLink,
        'tags': JsonConverters.toJson(tags,'List<Tag>',context!),
        'path': JsonConverters.toJson(path,'List<PathItem>',context!)
    });

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

enum ValueDataType
{
    String,
    Number,
    Boolean,
    List,
}

enum Environments
{
    Lab,
    Poc,
    Dev,
    Test,
    Int,
    Uat,
    Prod,
}

class Variable implements IConvertible
{
    String name = "";
    String value = "";
    ValueDataType type;
    String? description;
    bool isInherited;
    Environments? environment;

    Variable({this.name,this.value,this.type,this.description,this.isInherited,this.environment});
    Variable.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        name = json['name'];
        value = json['value'];
        type = JsonConverters.fromJson(json['type'],'ValueDataType',context!);
        description = json['description'];
        isInherited = json['isInherited'];
        environment = JsonConverters.fromJson(json['environment'],'Environments',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'name': name,
        'value': value,
        'type': JsonConverters.toJson(type,'ValueDataType',context!),
        'description': description,
        'isInherited': isInherited,
        'environment': JsonConverters.toJson(environment,'Environments',context!)
    };

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

class Tenant extends ConfigItem implements IHasVariables, IConvertible
{
    // @required()
    // @StringLength(10)
    String name = "";

    // @required()
    ObjectTypes objectType;

    // @ignore()
    String selfLink = "";

    // @required()
    List<Variable>? variables;

    // @required()
    List<String>? allowedMailDomains;

    // @required()
    List<String>? licensedModules;

    // @required()
    int defaultDeploymentLifetimeDays = 0;

    // @required()
    int maxDeploymentLifetimeDays = 0;

    // @required()
    int systemUnpatchedWarningDays = 0;

    // @required()
    int systemBackupMissingWarningHours = 0;

    // @required()
    int stopVulnerableResourceAfterDays = 0;

    // @required()
    int deploymentExpirationWarningDays = 0;

    // @required()
    int patchNotificationDays = 0;

    // @required()
    bool useCustomHostnames;

    // @required()
    int removeInactiveVulnerabilitiesAfterDays = 0;

    Tenant({this.name,this.objectType,this.selfLink,this.variables,this.allowedMailDomains,this.licensedModules,this.defaultDeploymentLifetimeDays,this.maxDeploymentLifetimeDays,this.systemUnpatchedWarningDays,this.systemBackupMissingWarningHours,this.stopVulnerableResourceAfterDays,this.deploymentExpirationWarningDays,this.patchNotificationDays,this.useCustomHostnames,this.removeInactiveVulnerabilitiesAfterDays});
    Tenant.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        name = json['name'];
        objectType = JsonConverters.fromJson(json['objectType'],'ObjectTypes',context!);
        selfLink = json['selfLink'];
        variables = JsonConverters.fromJson(json['variables'],'List<Variable>',context!);
        allowedMailDomains = JsonConverters.fromJson(json['allowedMailDomains'],'List<String>',context!);
        licensedModules = JsonConverters.fromJson(json['licensedModules'],'List<String>',context!);
        defaultDeploymentLifetimeDays = json['defaultDeploymentLifetimeDays'];
        maxDeploymentLifetimeDays = json['maxDeploymentLifetimeDays'];
        systemUnpatchedWarningDays = json['systemUnpatchedWarningDays'];
        systemBackupMissingWarningHours = json['systemBackupMissingWarningHours'];
        stopVulnerableResourceAfterDays = json['stopVulnerableResourceAfterDays'];
        deploymentExpirationWarningDays = json['deploymentExpirationWarningDays'];
        patchNotificationDays = json['patchNotificationDays'];
        useCustomHostnames = json['useCustomHostnames'];
        removeInactiveVulnerabilitiesAfterDays = json['removeInactiveVulnerabilitiesAfterDays'];
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'name': name,
        'objectType': JsonConverters.toJson(objectType,'ObjectTypes',context!),
        'selfLink': selfLink,
        'variables': JsonConverters.toJson(variables,'List<Variable>',context!),
        'allowedMailDomains': JsonConverters.toJson(allowedMailDomains,'List<String>',context!),
        'licensedModules': JsonConverters.toJson(licensedModules,'List<String>',context!),
        'defaultDeploymentLifetimeDays': defaultDeploymentLifetimeDays,
        'maxDeploymentLifetimeDays': maxDeploymentLifetimeDays,
        'systemUnpatchedWarningDays': systemUnpatchedWarningDays,
        'systemBackupMissingWarningHours': systemBackupMissingWarningHours,
        'stopVulnerableResourceAfterDays': stopVulnerableResourceAfterDays,
        'deploymentExpirationWarningDays': deploymentExpirationWarningDays,
        'patchNotificationDays': patchNotificationDays,
        'useCustomHostnames': useCustomHostnames,
        'removeInactiveVulnerabilitiesAfterDays': removeInactiveVulnerabilitiesAfterDays
    });

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

enum IntervalUnits
{
    Second,
    Minute,
    Hour,
    Day,
    Week,
    Month,
    Year,
}

class TimeSeriesDefinition extends Auditable implements IHasIdName, IHasTenantId, IHasObjectType, IConvertible
{
    String id = "";
    // @References(typeof(Tenant))
    String tenantId = "";

    Tenant? tenant;
    String name = "";
    String? displayName;
    // @ignore()
    String selfLink = "";

    // @required()
    ObjectTypes objectType;

    String? description;
    ObjectTypes sourceType;
    bool autoCollection;
    String? autoCollectionQuery;
    int? autoCollectionInterval;
    IntervalUnits? autoCollectionIntervalUnit;
    Duration? autoCollectionTime;
    DateTime? lastAutoCollected;
    int retentionTimeMonths = 0;

    TimeSeriesDefinition({this.id,this.tenantId,this.tenant,this.name,this.displayName,this.selfLink,this.objectType,this.description,this.sourceType,this.autoCollection,this.autoCollectionQuery,this.autoCollectionInterval,this.autoCollectionIntervalUnit,this.autoCollectionTime,this.lastAutoCollected,this.retentionTimeMonths});
    TimeSeriesDefinition.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        id = json['id'];
        tenantId = json['tenantId'];
        tenant = JsonConverters.fromJson(json['tenant'],'Tenant',context!);
        name = json['name'];
        displayName = json['displayName'];
        selfLink = json['selfLink'];
        objectType = JsonConverters.fromJson(json['objectType'],'ObjectTypes',context!);
        description = json['description'];
        sourceType = JsonConverters.fromJson(json['sourceType'],'ObjectTypes',context!);
        autoCollection = json['autoCollection'];
        autoCollectionQuery = json['autoCollectionQuery'];
        autoCollectionInterval = json['autoCollectionInterval'];
        autoCollectionIntervalUnit = JsonConverters.fromJson(json['autoCollectionIntervalUnit'],'IntervalUnits',context!);
        autoCollectionTime = JsonConverters.fromJson(json['autoCollectionTime'],'Duration',context!);
        lastAutoCollected = JsonConverters.fromJson(json['lastAutoCollected'],'DateTime',context!);
        retentionTimeMonths = json['retentionTimeMonths'];
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'id': id,
        'tenantId': tenantId,
        'tenant': JsonConverters.toJson(tenant,'Tenant',context!),
        'name': name,
        'displayName': displayName,
        'selfLink': selfLink,
        'objectType': JsonConverters.toJson(objectType,'ObjectTypes',context!),
        'description': description,
        'sourceType': JsonConverters.toJson(sourceType,'ObjectTypes',context!),
        'autoCollection': autoCollection,
        'autoCollectionQuery': autoCollectionQuery,
        'autoCollectionInterval': autoCollectionInterval,
        'autoCollectionIntervalUnit': JsonConverters.toJson(autoCollectionIntervalUnit,'IntervalUnits',context!),
        'autoCollectionTime': JsonConverters.toJson(autoCollectionTime,'Duration',context!),
        'lastAutoCollected': JsonConverters.toJson(lastAutoCollected,'DateTime',context!),
        'retentionTimeMonths': retentionTimeMonths
    });

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

// @DataContract
class QueryResponse<T> implements IConvertible
{
    // @DataMember(Order=1)
    int offset = 0;

    // @DataMember(Order=2)
    int total = 0;

    // @DataMember(Order=3)
    List<TimeSeriesDefinition> results = [];

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

    // @DataMember(Order=5)
    ResponseStatus? responseStatus;

    QueryResponse({this.offset,this.total,this.results,this.meta,this.responseStatus});
    QueryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        offset = json['offset'];
        total = json['total'];
        results = JsonConverters.fromJson(json['results'],'List<TimeSeriesDefinition>',context!);
        meta = JsonConverters.toStringMap(json['meta']);
        responseStatus = JsonConverters.fromJson(json['responseStatus'],'ResponseStatus',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'offset': offset,
        'total': total,
        'results': JsonConverters.toJson(results,'List<TimeSeriesDefinition>',context!),
        'meta': meta,
        'responseStatus': JsonConverters.toJson(responseStatus,'ResponseStatus',context!)
    };

    getTypeName() => "QueryResponse<$T>";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'duneframework.com', types: <String, TypeInfo> {
    'Auditable': TypeInfo(TypeOf.Class, create:() => Auditable()),
    'ObjectTypes': TypeInfo(TypeOf.Enum, enumValues:ObjectTypes.values),
    'UserNote': TypeInfo(TypeOf.Class, create:() => UserNote()),
    'QueryUserNotes': TypeInfo(TypeOf.Class, create:() => QueryUserNotes()),
    'List<UserNote>': TypeInfo(TypeOf.Class, create:() => <UserNote>[]),
    'Tag': TypeInfo(TypeOf.Class, create:() => Tag()),
    'PathItem': TypeInfo(TypeOf.Class, create:() => PathItem()),
    'ConfigItem': TypeInfo(TypeOf.Class, create:() => ConfigItem()),
    'List<Tag>': TypeInfo(TypeOf.Class, create:() => <Tag>[]),
    'List<PathItem>': TypeInfo(TypeOf.Class, create:() => <PathItem>[]),
    'ValueDataType': TypeInfo(TypeOf.Enum, enumValues:ValueDataType.values),
    'Environments': TypeInfo(TypeOf.Enum, enumValues:Environments.values),
    'Variable': TypeInfo(TypeOf.Class, create:() => Variable()),
    'Tenant': TypeInfo(TypeOf.Class, create:() => Tenant()),
    'List<Variable>': TypeInfo(TypeOf.Class, create:() => <Variable>[]),
    'IntervalUnits': TypeInfo(TypeOf.Enum, enumValues:IntervalUnits.values),
    'TimeSeriesDefinition': TypeInfo(TypeOf.Class, create:() => TimeSeriesDefinition()),
    'List<TimeSeriesDefinition>': TypeInfo(TypeOf.Class, create:() => <TimeSeriesDefinition>[]),
});

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

GET /api/usernotes HTTP/1.1 
Host: core.starburst.svc 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"offset":0,"total":0,"results":[{"id":"00000000-0000-0000-0000-000000000000","message":"String","configItemId":"00000000-0000-0000-0000-000000000000","configItemType":"None","configItemName":"String","tenantId":"00000000-0000-0000-0000-000000000000","objectType":"UserNote","created":"0001-01-01T00:00:00.0000000Z","createUser":"String","createUserId":"String","modified":"0001-01-01T00:00:00.0000000Z","modifyUser":"String","modifyUserId":"String","isDeleted":false,"deleted":"0001-01-01T00:00:00.0000000Z","deleteUser":"String","deleteUserId":"String"}],"meta":{"String":"String"},"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}