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