Exemplo n.º 1
0
 /// <summary>
 /// Constructor
 /// </summary>
 public MMS(string endPoint, string accessToken)
 {
     apiService = new APIService(endPoint, accessToken, "/mms/v3/messaging/");
 }
Exemplo n.º 2
0
 /// <summary>
 /// Ads constructor
 /// </summary>
 /// <param name="endPoint">endPoint</param>
 /// <param name="accessToken">accessToken</param>
 public Ads(string endPoint, string accessToken)
 {
     apiService = new APIService(endPoint, accessToken, "/rest/1/");
 }
Exemplo n.º 3
0
 /// <summary>
 /// Constructor
 /// </summary>
 public Speech(string endPoint, string accessToken)
 {
     apiService = new APIService(endPoint, accessToken, "/speech/v3/");
 }
Exemplo n.º 4
0
 /// <summary>
 /// Constructor
 /// </summary>
 public MyMessages(string endPoint, string accessToken)
 {
     apiService = new APIService(endPoint, accessToken, "/myMessages/v2/");
 }
Exemplo n.º 5
0
        /// <summary>
        /// This function gets access token with post request
        /// </summary>
        public bool RevokeToken(TokenTypeHint tokenType, String token)
        {
            TokenTypeHint t = tokenType;

            var query = HttpUtility.ParseQueryString(String.Empty);

            string oauthParameters = String.Empty;

            switch (t)
            {
                case TokenTypeHint.AccessToken:

                    query["client_id"] = apiKey;
                    query["client_secret"] = secretKey;
                    query["token"] = token;
                    query["token_type_hint"] = "access_token";

                    break;

                case TokenTypeHint.RefreshToken:

                    query["client_id"] = apiKey;
                    query["client_secret"] = secretKey;
                    query["token"] = token;
                    query["token_type_hint"] = "refresh_token";

                    break;
            }
            oauthParameters = query.ToString();

            if (!String.IsNullOrEmpty(oauthParameters))
            {
                var revokeService = new APIService(endPoint, "/oauth/v4/");
                var apiRequest = new APIRequest("revoke");

                apiRequest.requireAccessToken = false;
                apiRequest.contentType = "application/x-www-form-urlencoded";
                apiRequest.setBinaryData(oauthParameters);

                if (revokeService.post(apiRequest))
                {
                    return true;
                }
            }

            throw new Exception(apiService.errorResponse);
        }
Exemplo n.º 6
0
 /// <summary>
 /// SMS constructor
 /// </summary>
 public Devices(string endPoint, string accessToken)
 {
     apiService = new APIService(endPoint, accessToken, "/rest/2/Devices/");
 }
Exemplo n.º 7
0
 /// <summary>
 /// Addressbook constructor
 /// </summary>
 public AddressBook(string endPoint, string accessToken)
 {
     apiService = new APIService(endPoint, accessToken, "/addressBook/v1/");
 }