예제 #1
0
        public async Task <Platforms> GetPlatformsAsync(bool includeOptional = false)
        {
            if (!IsInitialized())
            {
                throw new InvalidOperationException("API is not initialized");
            }

            var uriString = new StringBuilder();

            uriString.Append(_BASE_URL);
            uriString.Append(_PLATFORMS);
            uriString.Append(String.Format(_API_KEY_FMT, ApiKey));

            if (includeOptional)
            {
                uriString.Append(_PLATFORMS_OPTIONAL_FIELDS);
            }

            var uri = new Uri(uriString.ToString());

            var jsonResult = await _httpClient.GetStringAsync(uri);

            return(Platforms.FromJson(jsonResult));
        }
예제 #2
0
 public static string ToJson(this Platforms self) => JsonConvert.SerializeObject(self, PlatformsConverter.Settings);