Пример #1
0
        /// <summary>Looks up the specified URL.</summary>
        /// <param name="resource">The resource to look up.</param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <returns>An asynchronous operation returning the requested URL.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public async Task <IUrl> LookupUrlAsync(Uri resource, Include inc = Include.None)
        {
            if (resource == null)
            {
                throw new ArgumentNullException(nameof(resource));
            }
            var json = await this.PerformRequestAsync("url", null, Query.BuildExtraText(inc, resource)).ConfigureAwait(false);

            return(JsonConvert.DeserializeObject <Url>(json, Query.SerializerSettings));
        }
Пример #2
0
        /// <summary>Looks up the specified URL.</summary>
        /// <param name="resource">The resource to look up.</param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <returns>The requested URL.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public IUrl LookupUrl(Uri resource, Include inc = Include.None)
        {
            if (resource == null)
            {
                throw new ArgumentNullException(nameof(resource));
            }
            var json = this.PerformRequest("url", null, Query.BuildExtraText(inc, resource));

            return(JsonConvert.DeserializeObject <Url>(json, Query.SerializerSettings));
        }
Пример #3
0
        /// <summary>Looks up the specified collection.</summary>
        /// <param name="mbid">The MBID for the collection to look up.</param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <returns>The requested collection.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public ICollection LookupCollection(Guid mbid, Include inc = Include.None)
        {
            var json = this.PerformRequest("collection", mbid, Query.BuildExtraText(inc));

            return(Query.Deserialize <Collection>(json));
        }
Пример #4
0
        /// <summary>Looks up the specified artist.</summary>
        /// <param name="mbid">The MBID for the artist to look up.</param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <param name="type">
        /// The release type to filter on; applies only when <paramref name="inc"/> includes <see cref="Include.ReleaseGroups"/> and/or
        /// <see cref="Include.Releases"/>.
        /// </param>
        /// <param name="status">
        /// The release status to filter on; applies only when <paramref name="inc"/> includes <see cref="Include.Releases"/>.
        /// </param>
        /// <returns>The requested artist.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public IArtist LookupArtist(Guid mbid, Include inc = Include.None, ReleaseType?type = null, ReleaseStatus?status = null)
        {
            var json = this.PerformRequest("artist", mbid, Query.BuildExtraText(inc, status, type));

            return(Query.Deserialize <Artist>(json));
        }
Пример #5
0
        /// <summary>Looks up the specified work.</summary>
        /// <param name="mbid">The MBID for the work to look up.</param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <returns>The requested work.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public IWork LookupWork(Guid mbid, Include inc = Include.None)
        {
            var json = this.PerformRequest("work", mbid, Query.BuildExtraText(inc));

            return(Query.Deserialize <Work>(json));
        }
Пример #6
0
        /// <summary>Looks up the specified URL.</summary>
        /// <param name="resource">The resource to look up.</param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <returns>The requested URL.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public IUrl LookupUrl(Uri resource, Include inc = Include.None)
        {
            var json = this.PerformRequest("url", null, Query.BuildExtraText(inc, resource));

            return(Query.Deserialize <Url>(json));
        }
Пример #7
0
        /// <summary>Looks up the specified series.</summary>
        /// <param name="mbid">The MBID for the series to look up.</param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <returns>The requested series.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public ISeries LookupSeries(Guid mbid, Include inc = Include.None)
        {
            var json = this.PerformRequest("series", mbid, Query.BuildExtraText(inc));

            return(Query.Deserialize <Series>(json));
        }
Пример #8
0
        /// <summary>Looks up the specified release group.</summary>
        /// <param name="mbid">The MBID for the release group to look up.</param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <param name="status">The release status to filter on; applies only when <paramref name="inc"/> includes <see cref="Include.Releases"/>.</param>
        /// <returns>The requested release group.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public IReleaseGroup LookupReleaseGroup(Guid mbid, Include inc = Include.None, ReleaseStatus?status = null)
        {
            var json = this.PerformRequest("release-group", mbid, Query.BuildExtraText(inc, status));

            return(Query.Deserialize <ReleaseGroup>(json));
        }
Пример #9
0
        /// <summary>Looks up the specified area.</summary>
        /// <param name="mbid">The MBID for the area to look up.</param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <returns>The requested area.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public IArea LookupArea(Guid mbid, Include inc = Include.None)
        {
            var json = this.PerformRequest("area", mbid, Query.BuildExtraText(inc));

            return(Query.Deserialize <Area>(json));
        }
Пример #10
0
        /// <summary>Looks up the specified disc ID.</summary>
        /// <param name="discid">
        /// The disc ID to look up.
        /// When <paramref name="toc"/> is specified, this can be <c>"-"</c> to indicate that only a fuzzy TOC lookup should be done.
        /// </param>
        /// <param name="toc">
        /// The TOC (table of contents) to use for a fuzzy lookup if <paramref name="discid"/> has no exact matches.
        /// The array should contain the first track number, last track number and the address of the disc's lead-out (in sectors),
        /// followed by the start address of each track (in sectors).
        /// </param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <param name="allMediaFormats">If true, all media formats are considered for a fuzzy lookup; otherwise, only CDs are considered.</param>
        /// <param name="noStubs">If true, CD stubs are not returned.</param>
        /// <returns>An asynchronous operation returning the result of the disc ID lookup. This can be a single disc or CD stub, or a list of matching releases.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public async Task <IDiscIdLookupResult> LookupDiscIdAsync(string discid, int[]?toc = null, Include inc = Include.None, bool allMediaFormats = false, bool noStubs = false)
        {
            var json = await this.PerformRequestAsync("discid", discid, Query.BuildExtraText(inc, toc, allMediaFormats, noStubs)).ConfigureAwait(false);

            return(Query.Deserialize <DiscIdLookupResult>(json));
        }
Пример #11
0
        /// <summary>Looks up the specified disc ID.</summary>
        /// <param name="discid">
        /// The disc ID to look up.
        /// When <paramref name="toc"/> is specified, this can be <c>"-"</c> to indicate that only a fuzzy TOC lookup should be done.
        /// </param>
        /// <param name="toc">
        /// The TOC (table of contents) to use for a fuzzy lookup if <paramref name="discid"/> has no exact matches.
        /// The array should contain the first track number, last track number and the address of the disc's lead-out (in sectors),
        /// followed by the start address of each track (in sectors).
        /// </param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <param name="allMedia">If true, all media types are considered for a fuzzy lookup; otherwise, only CDs are considered.</param>
        /// <param name="noStubs">If true, CD stubs are not returned.</param>
        /// <returns>The result of the disc ID lookup. This can be a single disc or CD stub, or a list of matching releases.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public IDiscIdLookupResult LookupDiscId(string discid, int[]?toc = null, Include inc = Include.None, bool allMedia = false, bool noStubs = false)
        {
            var json = this.PerformRequest("discid", discid, Query.BuildExtraText(inc, toc, allMedia, noStubs));

            return(Query.Deserialize <DiscIdLookupResult>(json));
        }
Пример #12
0
        /// <summary>Looks up the specified event.</summary>
        /// <param name="mbid">The MBID for the event to look up.</param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <returns>The requested event.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public IEvent LookupEvent(Guid mbid, Include inc = Include.None)
        {
            var json = this.PerformRequest("event", mbid.ToString("D"), Query.BuildExtraText(inc));

            return(JsonConvert.DeserializeObject <Event>(json, Query.SerializerSettings));
        }
Пример #13
0
 /// <summary>Looks up the specified disc ID.</summary>
 /// <param name="discid">The disc ID to look up.</param>
 /// <param name="toc">
 ///   The TOC (table of contents) to use for a fuzzy lookup if <paramref name="discid"/> has no exact matches.
 ///   The array should contain the first track number, last track number and the address of the disc's lead-out (in sectors),
 ///   followed by the start address of each track (in sectors).
 /// </param>
 /// <param name="inc">Additional information to include in the result.</param>
 /// <param name="allMedia">If true, all media types are considered for a fuzzy lookup; otherwise, only CDs are considered.</param>
 /// <param name="noStubs">If true, CD stubs are not returned.</param>
 /// <returns>The result of the disc ID lookup. This can be a single disc or CD stub, or a list of matching releases.</returns>
 /// <exception cref="QueryException">When the web service reports an error.</exception>
 /// <exception cref="WebException">When something goes wrong with the web request.</exception>
 public IDiscIdLookupResult LookupDiscId(string discid, int[] toc = null, Include inc = Include.None, bool allMedia = false, bool noStubs = false)
 {
     return(new DiscIdLookupResult(discid, this.PerformRequest("discid", discid, Query.BuildExtraText(inc, toc, allMedia, noStubs)), Query.SerializerSettings));
 }
Пример #14
0
        /// <summary>Looks up the specified collection.</summary>
        /// <param name="mbid">The MBID for the collection to look up.</param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <returns>The requested collection.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public ICollection LookupCollection(Guid mbid, Include inc = Include.None)
        {
            var json = this.PerformRequest("collection", mbid.ToString("D"), Query.BuildExtraText(inc));

            return(JsonConvert.DeserializeObject <Collection>(json, Query.SerializerSettings));
        }
Пример #15
0
        /// <summary>Looks up the specified work.</summary>
        /// <param name="mbid">The MBID for the work to look up.</param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <returns>An asynchronous operation returning the requested work.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public async Task <IWork> LookupWorkAsync(Guid mbid, Include inc = Include.None)
        {
            var json = await this.PerformRequestAsync("work", mbid.ToString("D"), Query.BuildExtraText(inc)).ConfigureAwait(false);

            return(JsonConvert.DeserializeObject <Work>(json, Query.SerializerSettings));
        }
Пример #16
0
        /// <summary>Looks up the specified recording.</summary>
        /// <param name="mbid">The MBID for the recording to look up.</param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <param name="type">The release type to filter on; applies only when <paramref name="inc"/> includes <see cref="Include.Releases"/>.</param>
        /// <param name="status">The release status to filter on; applies only when <paramref name="inc"/> includes <see cref="Include.Releases"/>.</param>
        /// <returns>The requested recording.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public IRecording LookupRecording(Guid mbid, Include inc = Include.None, ReleaseType?type = null, ReleaseStatus?status = null)
        {
            var json = this.PerformRequest("recording", mbid, Query.BuildExtraText(inc, status, type));

            return(Query.Deserialize <Recording>(json));
        }
Пример #17
0
        /// <summary>Looks up the specified release.</summary>
        /// <param name="mbid">The MBID for the release to look up.</param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <returns>The requested release.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public IRelease LookupRelease(Guid mbid, Include inc = Include.None)
        {
            var json = this.PerformRequest("release", mbid, Query.BuildExtraText(inc));

            return(Query.Deserialize <Release>(json));
        }
Пример #18
0
        /// <summary>Looks up the specified instrument.</summary>
        /// <param name="mbid">The MBID for the instrument to look up.</param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <returns>The requested instrument.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public IInstrument LookupInstrument(Guid mbid, Include inc = Include.None)
        {
            var json = this.PerformRequest("instrument", mbid, Query.BuildExtraText(inc));

            return(Query.Deserialize <Instrument>(json));
        }
Пример #19
0
        /// <summary>Looks up the specified release group.</summary>
        /// <param name="mbid">The MBID for the release group to look up.</param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <param name="status">The release status to filter on; applies only when <paramref name="inc"/> includes <see cref="Include.Releases"/>.</param>
        /// <returns>An asynchronous operation returning the requested release group.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public async Task <IReleaseGroup> LookupReleaseGroupAsync(Guid mbid, Include inc = Include.None, ReleaseStatus?status = null)
        {
            var json = await this.PerformRequestAsync("release-group", mbid, Query.BuildExtraText(inc, status)).ConfigureAwait(false);

            return(Query.Deserialize <ReleaseGroup>(json));
        }
Пример #20
0
        /// <summary>Looks up the specified instrument.</summary>
        /// <param name="mbid">The MBID for the instrument to look up.</param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <returns>An asynchronous operation returning the requested instrument.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public async Task <IInstrument> LookupInstrumentAsync(Guid mbid, Include inc = Include.None)
        {
            var json = await this.PerformRequestAsync("instrument", mbid, Query.BuildExtraText(inc)).ConfigureAwait(false);

            return(Query.Deserialize <Instrument>(json));
        }
Пример #21
0
        /// <summary>Looks up the specified URL.</summary>
        /// <param name="mbid">The MBID for the URL to look up.</param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <returns>The requested URL.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public IUrl LookupUrl(Guid mbid, Include inc = Include.None)
        {
            var json = this.PerformRequest("url", mbid, Query.BuildExtraText(inc));

            return(Query.Deserialize <Url>(json));
        }
Пример #22
0
        /// <summary>Looks up the recordings associated with the specified ISRC value.</summary>
        /// <param name="isrc">The ISRC to look up.</param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <returns>The recordings associated with the requested ISRC.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public IIsrc LookupIsrc(string isrc, Include inc = Include.None)
        {
            var json = this.PerformRequest("isrc", isrc, Query.BuildExtraText(inc));

            return(Query.Deserialize <Isrc>(json));
        }
Пример #23
0
        /// <summary>Looks up the specified URL.</summary>
        /// <param name="resource">The resource to look up.</param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <returns>An asynchronous operation returning the requested URL.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public async Task <IUrl> LookupUrlAsync(Uri resource, Include inc = Include.None)
        {
            var json = await this.PerformRequestAsync("url", null, Query.BuildExtraText(inc, resource)).ConfigureAwait(false);

            return(Query.Deserialize <Url>(json));
        }
Пример #24
0
        /// <summary>Looks up the recordings associated with the specified ISRC value.</summary>
        /// <param name="isrc">The ISRC to look up.</param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <returns>An asynchronous operation returning the recordings associated with the requested ISRC.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public async Task <IIsrc> LookupIsrcAsync(string isrc, Include inc = Include.None)
        {
            var json = await this.PerformRequestAsync("isrc", isrc, Query.BuildExtraText(inc)).ConfigureAwait(false);

            return(Query.Deserialize <Isrc>(json));
        }
Пример #25
0
        /// <summary>Looks up the specified work.</summary>
        /// <param name="mbid">The MBID for the work to look up.</param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <returns>An asynchronous operation returning the requested work.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public async Task <IWork> LookupWorkAsync(Guid mbid, Include inc = Include.None)
        {
            var json = await this.PerformRequestAsync("work", mbid, Query.BuildExtraText(inc)).ConfigureAwait(false);

            return(Query.Deserialize <Work>(json));
        }
Пример #26
0
 /// <summary>Looks up the works associated with the specified ISWC.</summary>
 /// <param name="iswc">The ISWC to look up.</param>
 /// <param name="inc">Additional information to include in the result.</param>
 /// <returns>The works associated with the requested ISWC.</returns>
 /// <exception cref="QueryException">When the web service reports an error.</exception>
 /// <exception cref="WebException">When something goes wrong with the web request.</exception>
 public IReadOnlyList <IWork> LookupIswc(string iswc, Include inc = Include.None)
 {
     // This "lookup" behaves like a browse, except that it does not support offset/limit.
     return(new IswcLookup(this, iswc, Query.BuildExtraText(inc)).Next().Results);
 }
Пример #27
0
        /// <summary>Looks up the specified artist.</summary>
        /// <param name="mbid">The MBID for the artist to look up.</param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <param name="type">
        /// The release type to filter on; applies only when <paramref name="inc"/> includes <see cref="Include.ReleaseGroups"/> and/or
        /// <see cref="Include.Releases"/>.
        /// </param>
        /// <param name="status">
        /// The release status to filter on; applies only when <paramref name="inc"/> includes <see cref="Include.Releases"/>.
        /// </param>
        /// <returns>An asynchronous operation returning the requested artist.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public async Task <IArtist> LookupArtistAsync(Guid mbid, Include inc = Include.None, ReleaseType?type = null, ReleaseStatus?status = null)
        {
            var json = await this.PerformRequestAsync("artist", mbid, Query.BuildExtraText(inc, status, type)).ConfigureAwait(false);

            return(Query.Deserialize <Artist>(json));
        }
Пример #28
0
        /// <summary>Looks up the works associated with the specified ISWC.</summary>
        /// <param name="iswc">The ISWC to look up.</param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <returns>An asynchronous operation returning the works associated with the requested ISWC.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public async Task <IReadOnlyList <IWork> > LookupIswcAsync(string iswc, Include inc = Include.None)
        {
            var il = await new IswcLookup(this, iswc, Query.BuildExtraText(inc)).NextAsync().ConfigureAwait(false);

            return(il.Results);
        }
Пример #29
0
        /// <summary>Looks up the specified collection.</summary>
        /// <param name="mbid">The MBID for the collection to look up.</param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <returns>An asynchronous operation returning the requested collection.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public async Task <ICollection> LookupCollectionAsync(Guid mbid, Include inc = Include.None)
        {
            var json = await this.PerformRequestAsync("collection", mbid, Query.BuildExtraText(inc)).ConfigureAwait(false);

            return(Query.Deserialize <Collection>(json));
        }
Пример #30
0
        /// <summary>Looks up the specified place.</summary>
        /// <param name="mbid">The MBID for the place to look up.</param>
        /// <param name="inc">Additional information to include in the result.</param>
        /// <returns>The requested place.</returns>
        /// <exception cref="QueryException">When the web service reports an error.</exception>
        /// <exception cref="WebException">When something goes wrong with the web request.</exception>
        public IPlace LookupPlace(Guid mbid, Include inc = Include.None)
        {
            var json = this.PerformRequest("place", mbid, Query.BuildExtraText(inc));

            return(Query.Deserialize <Place>(json));
        }