Example #1
0
        private static string BuildExtraText(Include inc, ReleaseStatus?status, ReleaseType?type = null)
        {
            var sb = new StringBuilder();

            Query.AddIncludeText(sb, inc);
            Query.AddReleaseFilter(sb, type, status);
            return(sb.ToString());
        }
 internal PhoneNumberRelease(string releaseId, DateTimeOffset?createdAt, ReleaseStatus?status, string errorMessage, IReadOnlyDictionary <string, PhoneNumberReleaseDetails> phoneNumberReleaseStatusDetails)
 {
     ReleaseId    = releaseId;
     CreatedAt    = createdAt;
     Status       = status;
     ErrorMessage = errorMessage;
     PhoneNumberReleaseStatusDetails = phoneNumberReleaseStatusDetails;
 }
Example #3
0
 internal override void LoadMissingDataCore ()
 {
     Release release = new Release (Id);
     type = release.GetReleaseType ();
     status = release.GetReleaseStatus ();
     language = release.GetLanguage ();
     script = release.GetScript ();
     asin = release.GetAsin ();
     events = release.GetEvents ();
     if (discs == null) discs = release.GetDiscs ();
     if (tracks == null) tracks = release.GetTracks ();
     base.LoadMissingDataCore (release);
 }
Example #4
0
        internal override void LoadMissingDataCore()
        {
            Release release = new Release(Id);

            type     = release.GetReleaseType();
            status   = release.GetReleaseStatus();
            language = release.GetLanguage();
            script   = release.GetScript();
            asin     = release.GetAsin();
            events   = release.GetEvents();
            if (discs == null)
            {
                discs = release.GetDiscs();
            }
            if (tracks == null)
            {
                tracks = release.GetTracks();
            }
            base.LoadMissingDataCore(release);
        }
Example #5
0
        internal override void ProcessAttributes(XmlReader reader)
        {
            // How sure am I about getting the type and status in the "Type Status" format?
            // MB really ought to specify these two things seperatly.
            string type_string = reader ["type"];

            if (type_string != null)
            {
                foreach (string token in type_string.Split(' '))
                {
                    if (type == null)
                    {
                        type = Utils.StringToEnumOrNull <ReleaseType> (token);
                        if (type != null)
                        {
                            continue;
                        }
                    }
                    this.status = Utils.StringToEnumOrNull <ReleaseStatus> (token);
                }
            }
        }
Example #6
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.ToString("D"), Query.BuildExtraText(inc, status)).ConfigureAwait(false);

            return(JsonConvert.DeserializeObject <ReleaseGroup>(json, Query.SerializerSettings));
        }
Example #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PhoneNumberRelease"/> class.
 /// </summary>
 /// <param name="releaseId"> The id of the release. </param>
 /// <param name="createdAt"> The creation time of the release. </param>
 /// <param name="status"> The release status. </param>
 /// <param name="errorMessage"> The underlying error message of a release. </param>
 /// <param name="phoneNumberReleaseStatusDetails"> The list of phone numbers in the release, mapped to its individual statuses. </param>
 /// <returns>A new <see cref="PhoneNumberRelease"/> instance for mocking.</returns>
 public static PhoneNumberRelease PhoneNumberRelease(string releaseId, DateTimeOffset?createdAt, ReleaseStatus?status, string errorMessage, IReadOnlyDictionary <string, PhoneNumberReleaseDetails> phoneNumberReleaseStatusDetails)
 => new PhoneNumberRelease(releaseId, createdAt, status, errorMessage, phoneNumberReleaseStatusDetails);
Example #8
0
        public async Task <List <WorldRES> > Get(WorldGroups?endpoint        = null, bool?featured    = null,
                                                 SortOptions?sort            = null, UserOptions?user = null,
                                                 string userId               = null, string keyword   = null, string tags = null, string excludeTags = null,
                                                 ReleaseStatus?releaseStatus = null, int offset       = 0, int count      = 20)
        {
            var param = new StringBuilder();

            param.Append($"&n={count}");
            param.Append($"&offset={offset}");

            if (featured.HasValue)
            {
                param.Append($"&featured={featured.Value}");

                if (featured.Value && sort.HasValue == false)
                {
                    param.Append("&sort=order");
                }
            }

            if (sort.HasValue)
            {
                param.Append($"&sort={sort.Value.ToString().ToLowerInvariant()}");

                if (sort.Value == SortOptions.Popularity && featured.HasValue == false)
                {
                    param.Append("&featured=false");
                }
            }

            if (user.HasValue)
            {
                param.Append($"&user={user.Value.ToString().ToLowerInvariant()}");
            }
            if (!string.IsNullOrEmpty(userId))
            {
                param.Append($"&userId={userId}");
            }
            if (!string.IsNullOrEmpty(keyword))
            {
                param.Append($"&search={keyword}");
            }
            if (!string.IsNullOrEmpty(tags))
            {
                param.Append($"&tag={tags}");
            }
            if (!string.IsNullOrEmpty(excludeTags))
            {
                param.Append($"&notag={excludeTags}");
            }
            if (releaseStatus.HasValue)
            {
                param.Append($"&releaseStatus={releaseStatus.Value.ToString().ToLowerInvariant()}");
            }

            string baseUrl = "worlds";

            if (endpoint.HasValue)
            {
                switch (endpoint.Value)
                {
                case WorldGroups.Active:
                    baseUrl = "worlds/active";
                    break;

                case WorldGroups.Recent:
                    baseUrl = "worlds/recent";
                    break;

                case WorldGroups.Favorite:
                    baseUrl = "worlds/favorites";
                    break;
                }
            }

            Universal       universal        = new Universal();
            List <WorldRES> worldSelfRESList = await universal.GET <List <WorldRES> >(baseUrl, true, param.ToString());

            Console.WriteLine($"Grabbed {worldSelfRESList.Count} Worlds!");
            Console.WriteLine();

            return(worldSelfRESList);
        }
 /// <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)
 => Utils.ResultOf(this.LookupRecordingAsync(mbid, inc, type, status));
Example #10
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));
        }
Example #11
0
 public async Task <IReleaseGroup> LookupReleaseGroupAsync(Guid mbid, Include inc = Include.None, ReleaseStatus?status = null)
 {
     return(await _query.LookupReleaseGroupAsync(mbid, inc, status));
 }
 /// <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)
 => Utils.ResultOf(this.LookupReleaseGroupAsync(mbid, inc, status));
Example #13
0
        public async Task <List <WorldBriefResponse> > Search(WorldGroups?endpoint        = null, bool?featured    = null,
                                                              SortOptions?sort            = null, UserOptions?user = null,
                                                              string userId               = null, string keyword   = null, string tags = null, string excludeTags = null,
                                                              ReleaseStatus?releaseStatus = null, int offset       = 0, int count      = 20)
        {
            Logger.Debug(() => "Getting world list");

            var param = new StringBuilder();

            param.Append($"&n={count}");
            param.Append($"&offset={offset}");

            if (featured.HasValue)
            {
                param.Append($"&featured={featured.Value}");

                if (featured.Value && sort.HasValue == false)
                {
                    param.Append("&sort=order");
                }
            }

            if (sort.HasValue)
            {
                param.Append($"&sort={sort.Value.ToString().ToLowerInvariant()}");

                if (sort.Value == SortOptions.Popularity && featured.HasValue == false)
                {
                    param.Append("&featured=false");
                }
            }

            if (user.HasValue)
            {
                param.Append($"&user={user.Value.ToString().ToLowerInvariant()}");
            }

            if (!string.IsNullOrEmpty(userId))
            {
                param.Append($"&userId={userId}");
            }

            if (!string.IsNullOrEmpty(keyword))
            {
                param.Append($"&search={keyword}");
            }

            if (!string.IsNullOrEmpty(tags))
            {
                param.Append($"&tag={tags}");
            }

            if (!string.IsNullOrEmpty(excludeTags))
            {
                param.Append($"&notag={excludeTags}");
            }

            if (releaseStatus.HasValue)
            {
                param.Append($"&releaseStatus={releaseStatus.Value.ToString().ToLowerInvariant()}");
            }

            string baseUrl = "worlds";

            if (endpoint.HasValue)
            {
                switch (endpoint.Value)
                {
                case WorldGroups.Active:
                    baseUrl = "worlds/active";
                    break;

                case WorldGroups.Recent:
                    baseUrl = "worlds/recent";
                    break;

                case WorldGroups.Favorite:
                    baseUrl = "worlds/favorites";
                    break;
                }
            }

            HttpResponseMessage response = await Global.HttpClient.GetAsync($"{baseUrl}?apiKey={Global.ApiKey}{param.ToString()}");

            return(await Utils.ParseResponse <List <WorldBriefResponse> >(response));
        }
Example #14
0
        public async Task <List <WorldBriefResponse> > Search(WorldGroups?endpoint        = null, bool?featured    = null,
                                                              SortOptions?sort            = null, UserOptions?user = null,
                                                              string userId               = null, string keyword   = null, string tags = null, string excludeTags = null,
                                                              ReleaseStatus?releaseStatus = null, int offset       = 0, int count      = 20)
        {
            Console.WriteLine("Getting world list");
            var param = new StringBuilder();

            param.Append($"&n={count}");
            param.Append($"&offset={offset}");

            if (featured.HasValue)
            {
                param.Append($"&featured={featured.Value}");

                if (featured.Value && sort.HasValue == false)
                {
                    param.Append("&sort=order");
                }
            }

            if (sort.HasValue)
            {
                param.Append($"&sort={sort.Value.ToString().ToLowerInvariant()}");

                if (sort.Value == SortOptions.Popularity && featured.HasValue == false)
                {
                    param.Append("&featured=false");
                }
            }

            if (user.HasValue)
            {
                param.Append($"&user={user.Value.ToString().ToLowerInvariant()}");
            }
            if (!string.IsNullOrEmpty(userId))
            {
                param.Append($"&userId={userId}");
            }
            if (!string.IsNullOrEmpty(keyword))
            {
                param.Append($"&search={keyword}");
            }
            if (!string.IsNullOrEmpty(tags))
            {
                param.Append($"&tag={tags}");
            }
            if (!string.IsNullOrEmpty(excludeTags))
            {
                param.Append($"&notag={excludeTags}");
            }
            if (releaseStatus.HasValue)
            {
                param.Append($"&releaseStatus={releaseStatus.Value.ToString().ToLowerInvariant()}");
            }

            string baseUrl = "worlds";

            if (endpoint.HasValue)
            {
                switch (endpoint.Value)
                {
                case WorldGroups.Active:
                    baseUrl = "worlds/active";
                    break;

                case WorldGroups.Recent:
                    baseUrl = "worlds/recent";
                    break;

                case WorldGroups.Favorite:
                    baseUrl = "worlds/favorites";
                    break;
                }
            }

            HttpResponseMessage response = await Global.HttpClient.GetAsync($"{baseUrl}?apiKey={Global.ApiKey}{param.ToString()}");

            List <WorldBriefResponse> res = null;

            if (response.IsSuccessStatusCode)
            {
                string json = await response.Content.ReadAsStringAsync();

                Console.WriteLine($"JSON received: {json}");
                res = JsonConvert.DeserializeObject <List <WorldBriefResponse> >(json);
            }

            return(res);
        }
Example #15
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.ToString("D"), Query.BuildExtraText(inc, status, type));

            return(JsonConvert.DeserializeObject <Artist>(json, Query.SerializerSettings));
        }
Example #16
0
        /// <summary>Looks up the specified label.</summary>
        /// <param name="mbid">The MBID for the label 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>An asynchronous operation returning the requested label.</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 <ILabel> LookupLabelAsync(Guid mbid, Include inc = Include.None, ReleaseType?type = null, ReleaseStatus?status = null)
        {
            var json = await this.PerformRequestAsync("label", mbid.ToString("D"), Query.BuildExtraText(inc, status, type)).ConfigureAwait(false);

            return(JsonConvert.DeserializeObject <Label>(json, Query.SerializerSettings));
        }
Example #17
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.ToString("D"), Query.BuildExtraText(inc, status));

            return(JsonConvert.DeserializeObject <ReleaseGroup>(json, Query.SerializerSettings));
        }
 /// <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)
 => await this.PerformRequestAsync <Artist>("artist", mbid, Query.BuildExtraText(inc, status, type)).ConfigureAwait(false);
 /// <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)
 => Utils.ResultOf(this.LookupArtistAsync(mbid, inc, type, status));
 /// <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)
 => await this.PerformRequestAsync <ReleaseGroup>("release-group", mbid, Query.BuildExtraText(inc, status)).ConfigureAwait(false);
Example #21
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));
        }
Example #22
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));
        }
Example #23
0
 internal override void ProcessAttributes(XmlReader reader)
 {
     // How sure am I about getting the type and status in the "Type Status" format?
     // MB really ought to specify these two things seperatly.
     string type_string = reader ["type"];
     if (type_string != null) {
         foreach (string token in type_string.Split (' ')) {
             if (type == null) {
                 type = Utils.StringToEnumOrNull<ReleaseType> (token);
                 if (type != null) continue;
             }
             this.status = Utils.StringToEnumOrNull<ReleaseStatus> (token);
         }
     }
 }
Example #24
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));
        }
Example #25
0
 private static void AddReleaseFilter(StringBuilder sb, ReleaseType?type, ReleaseStatus?status)
 {
     if (type.HasValue)
     {
         sb.Append((sb.Length == 0) ? '?' : '&').Append("type");
         var letter = '=';
         // Primary Types
         if ((type.Value & ReleaseType.Album) != 0)
         {
             sb.Append(letter).Append("album");          letter = '|';
         }
         if ((type.Value & ReleaseType.Broadcast) != 0)
         {
             sb.Append(letter).Append("broadcast");      letter = '|';
         }
         if ((type.Value & ReleaseType.EP) != 0)
         {
             sb.Append(letter).Append("ep");             letter = '|';
         }
         if ((type.Value & ReleaseType.Other) != 0)
         {
             sb.Append(letter).Append("other");          letter = '|';
         }
         if ((type.Value & ReleaseType.Single) != 0)
         {
             sb.Append(letter).Append("single");         letter = '|';
         }
         // Secondary Types
         if ((type.Value & ReleaseType.Audiobook) != 0)
         {
             sb.Append(letter).Append("audiobook");      letter = '|';
         }
         if ((type.Value & ReleaseType.Compilation) != 0)
         {
             sb.Append(letter).Append("compilation");    letter = '|';
         }
         if ((type.Value & ReleaseType.DJMix) != 0)
         {
             sb.Append(letter).Append("dj-mix");         letter = '|';
         }
         if ((type.Value & ReleaseType.Interview) != 0)
         {
             sb.Append(letter).Append("interview");      letter = '|';
         }
         if ((type.Value & ReleaseType.Live) != 0)
         {
             sb.Append(letter).Append("live");           letter = '|';
         }
         if ((type.Value & ReleaseType.MixTape) != 0)
         {
             sb.Append(letter).Append("mixtape/street"); letter = '|';
         }
         if ((type.Value & ReleaseType.Remix) != 0)
         {
             sb.Append(letter).Append("remix");          letter = '|';
         }
         if ((type.Value & ReleaseType.Soundtrack) != 0)
         {
             sb.Append(letter).Append("soundtrack");     letter = '|';
         }
         if ((type.Value & ReleaseType.SpokenWord) != 0)
         {
             sb.Append(letter).Append("spokenword");     letter = '|';
         }
     }
     if (status.HasValue)
     {
         sb.Append((sb.Length == 0) ? '?' : '&').Append("status");
         var letter = '=';
         if ((status.Value & ReleaseStatus.Bootleg) != 0)
         {
             sb.Append(letter).Append("bootleg");        letter = '|';
         }
         if ((status.Value & ReleaseStatus.Official) != 0)
         {
             sb.Append(letter).Append("official");       letter = '|';
         }
         if ((status.Value & ReleaseStatus.Promotion) != 0)
         {
             sb.Append(letter).Append("promotion");      letter = '|';
         }
         if ((status.Value & ReleaseStatus.PseudoRelease) != 0)
         {
             sb.Append(letter).Append("pseudo-release"); letter = '|';
         }
     }
 }
Example #26
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));
        }
Example #27
0
        private static string BuildExtraText(Include inc, string query, ReleaseType?type = null, ReleaseStatus?status = null)
        {
            if (string.IsNullOrWhiteSpace(query))
            {
                throw new ArgumentException("A browse or search query must not be blank.", nameof(query));
            }
            var sb = new StringBuilder();

            sb.Append('?').Append(query);
            Query.AddIncludeText(sb, inc);
            Query.AddReleaseFilter(sb, type, status);
            return(sb.ToString());
        }
Example #28
0
 public async Task <IArtist> LookupArtistAsync(Guid mbid, Include inc = Include.None, ReleaseType?type = null, ReleaseStatus?status = null)
 {
     return(await _query.LookupArtistAsync(mbid, inc, type, status));
 }