/// <inheritdoc/> public IPusherRestRequest Build(PusherMethod requestType, string resource, object requestParameters = null, object requestBody = null) { SortedDictionary<string, string> queryParams = GetQueryString(requestParameters, requestBody); string queryString = string.Empty; foreach (KeyValuePair<string, string> parameter in queryParams) { queryString += parameter.Key + "=" + parameter.Value + "&"; } queryString = queryString.TrimEnd('&'); string path = $"/apps/{_appId}/{resource.TrimStart('/')}"; string authToSign = String.Format( Enum.GetName(requestType.GetType(), requestType) + "\n{0}\n{1}", path, queryString); string authSignature = CryptoHelper.GetHmac256(_appSecret, authToSign); string requestUrl = $"{path}?auth_signature={authSignature}&{queryString}"; IPusherRestRequest request = new PusherRestRequest(requestUrl); request.Method = requestType; request.Body = requestBody; return request; }
/// <inheritdoc/> public IPusherRestRequest Build(PusherMethod requestType, string resource, object requestParameters = null, object requestBody = null) { SortedDictionary <string, string> queryParams = GetQueryString(requestParameters, requestBody); string queryString = string.Empty; foreach (KeyValuePair <string, string> parameter in queryParams) { queryString += parameter.Key + "=" + parameter.Value + "&"; } queryString = queryString.TrimEnd('&'); string path = $"/apps/{_appId}/{resource.TrimStart('/')}"; string authToSign = String.Format( Enum.GetName(requestType.GetType(), requestType) + "\n{0}\n{1}", path, queryString); string authSignature = CryptoHelper.GetHmac256(_appSecret, authToSign); string requestUrl = $"{path}?auth_signature={authSignature}&{queryString}"; IPusherRestRequest request = new PusherRestRequest(requestUrl); request.Method = requestType; request.Body = requestBody; return(request); }