Example #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 public MMS(string endPoint, string accessToken)
 {
     apiService = new APIService(endPoint, accessToken, "/mms/v3/messaging/");
 }
Example #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/");
 }
Example #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 public Speech(string endPoint, string accessToken)
 {
     apiService = new APIService(endPoint, accessToken, "/speech/v3/");
 }
Example #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 public MyMessages(string endPoint, string accessToken)
 {
     apiService = new APIService(endPoint, accessToken, "/myMessages/v2/");
 }
Example #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);
        }
Example #6
0
 /// <summary>
 /// SMS constructor
 /// </summary>
 public Devices(string endPoint, string accessToken)
 {
     apiService = new APIService(endPoint, accessToken, "/rest/2/Devices/");
 }
Example #7
0
 /// <summary>
 /// Addressbook constructor
 /// </summary>
 public AddressBook(string endPoint, string accessToken)
 {
     apiService = new APIService(endPoint, accessToken, "/addressBook/v1/");
 }