Exemple #1
0
        /// <summary>
        /// Sends a lookup request to the webservice.
        /// </summary>
        /// <typeparam name="T">Any type derived from <see cref="Entity"/>.</typeparam>
        /// <param name="entity">The name of the XML entity to lookup.</param>
        /// <param name="id">The MusicBrainz id of the entity.</param>
        /// <param name="inc">A list of entities to include (subqueries).</param>
        /// <returns></returns>
        protected async static Task <T> GetAsync <T>(string entity, string id, params string[] inc) where T : Entity
        {
            if (string.IsNullOrEmpty(entity))
            {
                throw new ArgumentException(string.Format(Resources.Messages.MissingParameter, "entity"));
            }

            if (string.IsNullOrEmpty(id))
            {
                throw new ArgumentException(string.Format(Resources.Messages.MissingParameter, "id"));
            }

            return(await WebRequestHelper.GetAsync <T>(WebRequestHelper.CreateLookupUrl(entity, id, CreateIncludeQuery(inc))));
        }