Example #1
0
 /// <summary>Votes for the specified tag on the specified entities.</summary>
 /// <param name="tag">The tag to vote for.</param>
 /// <param name="vote">The vote to apply to the tag.</param>
 /// <param name="entities">The entities to tag.</param>
 /// <returns>This submission request.</returns>
 public TagSubmission Add(string tag, TagVote vote, params ITaggableEntity[] entities)
 {
     foreach (var item in entities)
     {
         this.Add(tag, vote, item.EntityType, item.Id);
     }
     return(this);
 }
Example #2
0
 /// <summary>Votes for the specified tag on the specified entities.</summary>
 /// <param name="tag">The tag to vote for.</param>
 /// <param name="vote">The vote to apply to the tag.</param>
 /// <param name="entityType">
 /// The type of entity identified by <paramref name="mbids"/>; must be an entity that supports tags.
 /// </param>
 /// <param name="mbids">The MBIDs of the entities to tag.</param>
 /// <returns>This submission request.</returns>
 public TagSubmission Add(string tag, TagVote vote, EntityType entityType, params Guid[] mbids)
 {
     foreach (var mbid in mbids)
     {
         this.Add(tag, vote, entityType, mbid);
     }
     return(this);
 }
Example #3
0
 /// <summary>Votes for the specified tags on the specified entity.</summary>
 /// <param name="entity">The entity to tag.</param>
 /// <param name="vote">The vote to apply to the tags.</param>
 /// <param name="tags">The tags to vote for.</param>
 /// <returns>This submission request.</returns>
 public TagSubmission Add(ITaggableEntity entity, TagVote vote, params string[] tags)
 {
     foreach (var tag in tags)
     {
         this.Add(tag, vote, entity.EntityType, entity.Id);
     }
     return(this);
 }
Example #4
0
 /// <summary>Votes for the specified tags on the specified entity.</summary>
 /// <param name="entityType">
 /// The type of entity identified by <paramref name="mbid"/>; must be an entity that supports tags.
 /// </param>
 /// <param name="mbid">The MBID of the entity to tag.</param>
 /// <param name="vote">The vote to apply to the tags.</param>
 /// <param name="tags">The tags to vote for.</param>
 /// <returns>This submission request.</returns>
 public TagSubmission Add(EntityType entityType, Guid mbid, TagVote vote, params string[] tags)
 {
     foreach (var tag in tags)
     {
         this.Add(tag, vote, entityType, mbid);
     }
     return(this);
 }
Example #5
0
    /// <summary>Votes for the specified tag on the specified entity.</summary>
    /// <param name="tag">The tag to vote for.</param>
    /// <param name="vote">The vote to apply to the tag.</param>
    /// <param name="entityType">
    /// The type of entity identified by <paramref name="mbid"/>; must be an entity that supports tags.
    /// </param>
    /// <param name="mbid">The MBID of the entity to tag.</param>
    /// <returns>This submission request.</returns>
    public TagSubmission Add(string tag, TagVote vote, EntityType entityType, Guid mbid)
    {
        var map = this.GetMap(entityType);

        if (!map.TryGetValue(mbid, out var tagVote))
        {
            map.Add(mbid, tagVote = new VoteMap());
        }
        tagVote[tag] = vote;
        return(this);
    }
Example #6
0
 /// <summary>Votes for the specified tags on the specified entity.</summary>
 /// <param name="entityType">The type of entity identified by <paramref name="mbid"/>; must be an entity that supports tags.</param>
 /// <param name="mbid">The MBID of the entity to tag.</param>
 /// <param name="vote">The vote to apply to the tags.</param>
 /// <param name="tags">The tags to vote for.</param>
 /// <returns>This submission request.</returns>
 public TagSubmission Add(EntityType entityType, Guid mbid, TagVote vote, params string[] tags)
 {
     if (tags == null)
     {
         throw new ArgumentNullException(nameof(tags));
     }
     foreach (var tag in tags)
     {
         this.Add(tag, vote, entityType, mbid);
     }
     return(this);
 }
Example #7
0
 /// <summary>Votes for the specified tag on the specified entity.</summary>
 /// <param name="tag">The tag to vote for.</param>
 /// <param name="vote">The vote to apply to the tag.</param>
 /// <param name="entity">The entity to tag.</param>
 /// <returns>This submission request.</returns>
 public TagSubmission Add(string tag, TagVote vote, ITaggableEntity entity)
 {
     if (tag == null)
     {
         throw new ArgumentNullException(nameof(tag));
     }
     if (entity == null)
     {
         throw new ArgumentNullException(nameof(entity));
     }
     return(this.Add(tag, vote, entity.EntityType, entity.MbId));
 }
Example #8
0
        /// <summary>Votes for the specified tag on the specified entity.</summary>
        /// <param name="tag">The tag to vote for.</param>
        /// <param name="vote">The vote to apply to the tag.</param>
        /// <param name="entityType">The type of entity identified by <paramref name="mbid"/>; must be an entity that supports tags.</param>
        /// <param name="mbid">The MBID of the entity to tag.</param>
        /// <returns>This submission request.</returns>
        public TagSubmission Add(string tag, TagVote vote, EntityType entityType, Guid mbid)
        {
            if (tag == null)
            {
                throw new ArgumentNullException(nameof(tag));
            }
            var map = this.GetMap(entityType);

            if (!map.TryGetValue(mbid, out var tagvote))
            {
                map.Add(mbid, tagvote = new VoteMap());
            }
            tagvote[tag] = vote;
            return(this);
        }
Example #9
0
 /// <summary>Votes for the specified tag on the specified entities.</summary>
 /// <param name="tag">The tag to vote for.</param>
 /// <param name="vote">The vote to apply to the tag.</param>
 /// <param name="entityType">The type of entity identified by <paramref name="mbids"/>; must be an entity that supports tags.</param>
 /// <param name="mbids">The MBID of the entity to tag.</param>
 /// <returns>This submission request.</returns>
 public TagSubmission Add(string tag, TagVote vote, EntityType entityType, params Guid[] mbids)
 {
     if (tag == null)
     {
         throw new ArgumentNullException(nameof(tag));
     }
     if (mbids == null)
     {
         throw new ArgumentNullException(nameof(mbids));
     }
     foreach (var mbid in mbids)
     {
         this.Add(tag, vote, entityType, mbid);
     }
     return(this);
 }
Example #10
0
 /// <summary>Votes for the specified tags on the specified entity.</summary>
 /// <param name="entity">The entity to tag.</param>
 /// <param name="vote">The vote to apply to the tags.</param>
 /// <param name="tags">The tags to vote for.</param>
 /// <returns>This submission request.</returns>
 public TagSubmission Add(ITaggableEntity entity, TagVote vote, params string[] tags)
 {
     if (entity == null)
     {
         throw new ArgumentNullException(nameof(entity));
     }
     if (tags == null)
     {
         throw new ArgumentNullException(nameof(tags));
     }
     foreach (var tag in tags)
     {
         this.Add(tag, vote, entity.EntityType, entity.MbId);
     }
     return(this);
 }
Example #11
0
 /// <summary>Votes for the specified tag on the specified entities.</summary>
 /// <param name="tag">The tag to vote for.</param>
 /// <param name="vote">The vote to apply to the tag.</param>
 /// <param name="entities">The entities to tag.</param>
 /// <returns>This submission request.</returns>
 public TagSubmission Add(string tag, TagVote vote, params ITaggableEntity[] entities)
 {
     if (tag == null)
     {
         throw new ArgumentNullException(nameof(tag));
     }
     if (entities == null)
     {
         throw new ArgumentNullException(nameof(entities));
     }
     foreach (var item in entities)
     {
         if (item == null)
         {
             continue;
         }
         this.Add(tag, vote, item.EntityType, item.MbId);
     }
     return(this);
 }
Example #12
0
 /// <summary>Votes for the specified tag on the specified entity.</summary>
 /// <param name="tag">The tag to vote for.</param>
 /// <param name="vote">The vote to apply to the tag.</param>
 /// <param name="entity">The entity to tag.</param>
 /// <returns>This submission request.</returns>
 public TagSubmission Add(string tag, TagVote vote, ITaggableEntity entity)
 {
     return(this.Add(tag, vote, entity.EntityType, entity.Id));
 }