Example #1
0
        /// <summary>
        /// Browse all the releases in the MusicBrainz database, which are directly linked to the entity with given id.
        /// </summary>
        /// <param name="entity">The name of the related entity.</param>
        /// <param name="id">The id of the related entity.</param>
        /// <param name="limit">The maximum number of releases to return (default = 25).</param>
        /// <param name="offset">The offset to the releases list (enables paging, default = 0).</param>
        /// <param name="inc">A list of entities to include (subqueries).</param>
        /// <returns></returns>
        public static async Task <ReleaseList> BrowseAsync(string entity, string id, int limit = 25,
                                                           int offset = 0, params string[] inc)
        {
            string url = WebServiceHelper.CreateBrowseTemplate(EntityName, entity, id, limit, offset, inc);

            return(await WebServiceHelper.GetAsync <ReleaseList>(url));
        }
Example #2
0
        /// <summary>
        /// Search for a release in the MusicBrainz database, matching the given query.
        /// </summary>
        /// <param name="query">The query string.</param>
        /// <param name="limit">The maximum number of releases to return (default = 25).</param>
        /// <param name="offset">The offset to the releases list (enables paging, default = 0).</param>
        /// <returns></returns>
        public static async Task <ReleaseList> SearchAsync(string query, int limit = 25, int offset = 0)
        {
            if (string.IsNullOrEmpty(query))
            {
                throw new ArgumentException(string.Format(Resources.Messages.MissingParameter, "query"));
            }

            string url = WebServiceHelper.CreateSearchTemplate(EntityName, query, limit, offset);

            return(await WebServiceHelper.GetAsync <ReleaseList>(url));
        }
Example #3
0
        /// <summary>
        /// Lookup a release in the MusicBrainz database.
        /// </summary>
        /// <param name="id">The release MusicBrainz id.</param>
        /// <param name="inc">A list of entities to include (subqueries).</param>
        /// <returns></returns>
        public static async Task <Release> GetAsync(string id, params string[] inc)
        {
            if (string.IsNullOrEmpty(id))
            {
                throw new ArgumentException(string.Format(Resources.Messages.MissingParameter, "id"));
            }

            string url = WebServiceHelper.CreateLookupUrl(EntityName, id, inc);

            return(await WebServiceHelper.GetAsync <Release>(url));
        }
Example #4
0
        /// <summary>
        /// Search for a release-group in the MusicBrainz database, matching the given query.
        /// </summary>
        /// <param name="query">The query string.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
        /// <param name="limit">The maximum number of release-groups to return (default = 25).</param>
        /// <param name="offset">The offset to the release-groups list (enables paging, default = 0).</param>
        /// <returns></returns>
        public static async Task <ReleaseGroupList> SearchAsync(string query, int limit = 25, int offset = 0, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (string.IsNullOrEmpty(query))
            {
                throw new ArgumentException(string.Format(Resources.Messages.MissingParameter, "query"));
            }

            string url = WebServiceHelper.CreateSearchTemplate(EntityName, query, limit, offset);

            return(await WebServiceHelper.GetAsync <ReleaseGroupList>(url, cancellationToken).ConfigureAwait(false));
        }
Example #5
0
        /// <summary>
        /// Lookup a release-group in the MusicBrainz database.
        /// </summary>
        /// <param name="id">The release-group MusicBrainz id.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
        /// <param name="inc">A list of entities to include (subqueries).</param>
        /// <returns></returns>
        public static async Task <ReleaseGroup> GetAsync(string id, CancellationToken cancellationToken, params string[] inc)
        {
            if (string.IsNullOrEmpty(id))
            {
                throw new ArgumentException(string.Format(Resources.Messages.MissingParameter, "id"));
            }

            string url = WebServiceHelper.CreateLookupUrl(EntityName, id, inc);

            return(await WebServiceHelper.GetAsync <ReleaseGroup>(url, cancellationToken).ConfigureAwait(false));
        }
Example #6
0
        /// <summary>
        /// Browse all the release-groups in the MusicBrainz database, which are directly linked to the entity with given id.
        /// </summary>
        /// <param name="entity">The name of the related entity.</param>
        /// <param name="id">The id of the related entity.</param>
        /// <param name="type">If releases or release-groups are included in the result, filter by type (for example 'album').</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
        /// <param name="limit">The maximum number of release-groups to return (default = 25).</param>
        /// <param name="offset">The offset to the release-groups list (enables paging, default = 0).</param>
        /// <param name="inc">A list of entities to include (subqueries).</param>
        /// <returns></returns>
        /// <remarks>
        /// See http://musicbrainz.org/doc/Development/XML_Web_Service/Version_2#Release_Type_and_Status for supported values of type and status.
        /// </remarks>
        public static async Task <ReleaseGroupList> BrowseAsync(string entity, string id, string type, int limit = 25, int offset = 0, CancellationToken cancellationToken = default(CancellationToken), params string[] inc)
        {
            string url = WebServiceHelper.CreateBrowseTemplate(EntityName, entity, id, type, null, limit, offset, inc);

            return(await WebServiceHelper.GetAsync <ReleaseGroupList>(url, cancellationToken).ConfigureAwait(false));
        }
Example #7
0
        /// <summary>
        /// Browse all the recordings in the MusicBrainz database, which are directly linked to the entity with given id.
        /// </summary>
        /// <param name="entity">The name of the related entity.</param>
        /// <param name="id">The id of the related entity.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
        /// <param name="limit">The maximum number of recordings to return (default = 25).</param>
        /// <param name="offset">The offset to the recordings list (enables paging, default = 0).</param>
        /// <param name="inc">A list of entities to include (subqueries).</param>
        /// <returns></returns>
        public static async Task <RecordingList> BrowseAsync(string entity, string id, CancellationToken cancellationToken, int limit = 25, int offset = 0, params string[] inc)
        {
            string url = WebServiceHelper.CreateBrowseTemplate(EntityName, entity, id, limit, offset, inc);

            return(await WebServiceHelper.GetAsync <RecordingList>(url, cancellationToken).ConfigureAwait(false));
        }