Пример #1
0
        /// <summary>
        /// Lookup an recording in the MusicBrainz database.
        /// </summary>
        /// <param name="id">The recording MusicBrainz id.</param>
        /// <param name="inc">A list of entities to include (subqueries).</param>
        /// <returns></returns>
        public async Task <Recording> GetAsync(string id, params string[] inc)
        {
            if (string.IsNullOrEmpty(id))
            {
                throw new ArgumentException(string.Format(Resources.Messages.MissingParameter, "id"));
            }

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

            return(await client.GetAsync <Recording>(url));
        }
Пример #2
0
        protected override async Task <ReleaseList> BrowseAsync(MusicBrainzClient client, CancellationToken ct)
        {
            string url = builder.CreateBrowseUrl(EntityName, relatedEntity, id, type, status, limit, offset, include);

            var list = await client.GetAsync <ReleaseListBrowse>(url, ct);

            return(new ReleaseList()
            {
                Items = list.Items, Count = list.Count, Offset = list.Offset
            });
        }
Пример #3
0
        /// <summary>
        /// Execute the lookup request.
        /// </summary>
        /// <param name="ct">The cancellation token.</param>
        /// <returns></returns>
        public async Task <T> GetAsync(CancellationToken ct = default)
        {
            if (string.IsNullOrEmpty(id))
            {
                throw new ArgumentException(string.Format(Resources.Messages.MissingParameter, "id"));
            }

            string url = builder.CreateLookupUrl(EntityName, id, include);

            return(await client.GetAsync <T>(url, ct));
        }
Пример #4
0
        /// <summary>
        /// Execute the search request.
        /// </summary>
        /// <param name="ct">The cancellation token.</param>
        /// <returns></returns>
        public async Task <T> GetAsync(CancellationToken ct = default)
        {
            if (string.IsNullOrEmpty(query))
            {
                throw new ArgumentException(string.Format(Resources.Messages.MissingParameter, "query"));
            }

            string url = builder.CreateSearchUrl(EntityName, query, limit, offset);

            return(await client.GetAsync <T>(url, ct));
        }