Ejemplo n.º 1
0
        private async Task <HttpStatusCode> DoDescribe(string authToken)
        {
            string   describeAccountPath = "/services/data/" + ApiVersionStrings.VersionNumber + "/sobjects/Account/describe";
            var      headers             = new HttpCallHeaders(authToken, new Dictionary <string, string>());
            HttpCall result =
                await HttpCall.CreateGet(headers, TestCredentials.InstanceServer + describeAccountPath).ExecuteAsync();

            return(result.StatusCode);
        }
        private async Task <HttpStatusCode> DoDescribe(string authToken)
        {
            string   describeAccountPath = "/services/data/v33.0/sobjects/Account/describe";
            var      headers             = new HttpCallHeaders(authToken, new Dictionary <string, string>());
            HttpCall result =
                await HttpCall.CreateGet(headers, TestCredentials.INSTANCE_SERVER + describeAccountPath).Execute();

            return(result.StatusCode);
        }
        private HttpStatusCode DoDescribe(string authToken)
        {
            string describeAccountPath          = "/services/data/v26.0/sobjects/Account/describe";
            Dictionary <string, string> headers = (authToken == null ? null : new Dictionary <string, string> {
                { "Authorization", "Bearer " + authToken }
            });

            return(HttpCall.CreateGet(headers, TestCredentials.INSTANCE_SERVER + describeAccountPath).Execute().Result.StatusCode);
        }
Ejemplo n.º 4
0
        /// <summary>
        ///     Async method to call the identity service (to get the mobile policy among other pieces of information)
        /// </summary>
        /// <param name="idUrl"></param>
        /// <param name="accessToken"></param>
        /// <returns></returns>
        public static async Task <IdentityResponse> CallIdentityServiceAsync(string idUrl, string accessToken)
        {
            LoggingService.Log("Calling identity service", LoggingLevel.Verbose);

            // Auth header
            var headers = new HttpCallHeaders(accessToken, new Dictionary <string, string>());
            // Get
            HttpCall c = HttpCall.CreateGet(headers, idUrl);

            // ExecuteAsync get
            return(await c.ExecuteAndDeserializeAsync <IdentityResponse>());
        }
        /// <summary>
        ///     Async method to call the identity service (to get the mobile policy among other pieces of information)
        /// </summary>
        /// <param name="idUrl"></param>
        /// <param name="accessToken"></param>
        /// <returns></returns>
        public static async Task <IdentityResponse> CallIdentityService(string idUrl, string accessToken)
        {
            PlatformAdapter.SendToCustomLogger("OAuth2.CallIdentityService - calling identity service", LoggingLevel.Verbose);

            // Auth header
            var headers = new HttpCallHeaders(accessToken, new Dictionary <string, string>());
            // Get
            HttpCall c = HttpCall.CreateGet(headers, idUrl);

            // Execute get
            return(await c.ExecuteAndDeserialize <IdentityResponse>());
        }
        /// <summary>
        /// Async method to call the identity service (to get the mobile policy among other pieces of information)
        /// </summary>
        /// <param name="idUrl"></param>
        /// <param name="accessToken"></param>
        /// <returns></returns>
        public static async Task <IdentityResponse> CallIdentityService(string idUrl, string accessToken)
        {
            // Auth header
            Dictionary <string, string> headers = new Dictionary <string, string>()
            {
                { "Authorization", "Bearer " + accessToken }
            };

            // Get
            HttpCall c = HttpCall.CreateGet(headers, idUrl);

            // Execute get
            return(await c.ExecuteAndDeserialize <IdentityResponse>());
        }