Ejemplo n.º 1
0
        /// <summary>
        ///     Gets details of a confirmation request as a string in HTML format.
        /// </summary>
        /// <param name="confirmation">The confirmation to get details of.</param>
        /// <returns>The details of confirmation as a string in HTML format; or null if the confirmation is not valid</returns>
        public async Task <string> GetConfirmationDetails(Confirmation confirmation)
        {
            var parameters = await GetConfirmationParameters("details").ConfigureAwait(false);

            var referer = (await GetConfirmationParameters("conf").ConfigureAwait(false)).AppendToUrl(
                MobileConfirmationsUrl);
            var serverResponse = await OperationRetryHelper.Default.RetryOperationAsync(
                () => SteamWeb.FetchObject <ConfirmationDetailsResponse>(
                    new SteamWebAccessRequest(
                        string.Format(MobileConfirmationDetailUrl, confirmation.Id),
                        SteamWebAccessRequestMethod.Get,
                        parameters
                        )
            {
                Referer = referer
            }
                    )
                ).ConfigureAwait(false);

            if (serverResponse?.Success == true)
            {
                return(serverResponse.HTML);
            }

            return(null);
        }
Ejemplo n.º 2
0
 /// <summary>
 ///     Check if the account has a phone number associated with it
 /// </summary>
 /// <returns>true if the account has a phone number associated; otherwise false</returns>
 public async Task <bool> DoesAccountHasPhoneNumber()
 {
     return((await OperationRetryHelper.Default.RetryOperationAsync(
                 () => SteamWeb.FetchObject <HasPhoneResponse>(
                     new SteamWebAccessRequest(
                         SteamGuardPhoneOperationsUrl,
                         SteamWebAccessRequestMethod.Post,
                         new QueryStringBuilder
     {
         { "op", "has_phone" },
         { "arg", "null" },
         { "sessionid", SteamWeb.Session?.SessionId }
     }
                         )
                     )
                 ).ConfigureAwait(false))?.HasPhone ==
            true);
 }