using DbAPI.Connections;
using DTS.Common.Interface.Database;
using DTS.Common.Interface.Tags;
namespace DbAPI.Tags
{
///
/// defines functions to create, retrieve, update, delete tags
///
public interface ITags
{
///
/// inserts a tag assignment record into the database
///
/// user making request
/// connection request is being made on
/// assignment to be committed
/// 0 (ERROR_SUCCESS) on success, all other values are error codes
ulong TagAssignmentsInsert(IUserDbRecord user,
IConnectionDetails connection,
ITagAssignment tagAssignment);
///
/// deletes all matching tags.
///
/// user making request
/// connection request is being made on
/// object tags assigned to
/// the object type
/// 0 (ERROR_SUCCESS) on success, all other values are error codes
ulong TagAssignmentsDelete(IUserDbRecord user,
IConnectionDetails connection,
int objectId,
TagTypes tagType);
///
/// retrieves all tags that have been assigned to an object type
///
/// user making request
/// connection request is being made on
/// object type tags are assigned to (use null for all)
/// all matching assignments
/// 0 (ERROR_SUCCESS) on success, all other values are error codes
ulong TagAssignmentsGet(IUserDbRecord user,
IConnectionDetails connection,
TagTypes? tagType,
out ITagAssignment[] tagAssignments
);
///
/// inserts a new tag, modifies tag with new id after insert
///
/// user requesting insert
/// connection tag is being inserted on
/// tag to insert
/// 0 (ERROR_SUCCESS) on success, all other values are error codes
ulong TagsInsert(IUserDbRecord user,
IConnectionDetails connection,
ref ITag tag);
///
/// returns id for a given tag text
///
/// user making request
/// connection request is being made on
/// text associated with tag
/// id of tag (or null if not found)
/// 0 on success, all other values are error codes
ulong TagsGetId(IUserDbRecord user,
IConnectionDetails connection,
string tagText,
out int? id);
///
/// deletes all matching tags
///
/// id of tag to be deleted
/// connection tag should be deleted on
/// user requesting delete
/// 0 (ERROR_SUCCESS) on success, all other values are error codes
ulong TagsDelete(IUserDbRecord user,
IConnectionDetails connection,
int tagId);
///
/// retrieves all tags matching search criteria
///
/// user making request
/// connection request is made on
/// id of tag to search for (use null to get all tags)
/// all matching records
/// 0 (ERROR_SUCCESS) on success, all other values are error codes
ulong TagsGet(IUserDbRecord user,
IConnectionDetails connection,
int? tagId,
out ITag[] records);
}
}