com.sinch.sdk.domains.numbers.api.v1.adapters.WebHooksService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sinch-sdk-java Show documentation
Show all versions of sinch-sdk-java Show documentation
SDK providing a Java API for the Sinch REST APIs.
package com.sinch.sdk.domains.numbers.api.v1.adapters;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.sinch.sdk.core.exceptions.ApiMappingException;
import com.sinch.sdk.core.utils.databind.Mapper;
import com.sinch.sdk.domains.numbers.models.v1.webhooks.NumberEvent;
import java.util.Map;
public class WebHooksService implements com.sinch.sdk.domains.numbers.api.v1.WebHooksService {
private final NumbersWebhooksAuthenticationValidation authenticationChecker;
public WebHooksService(NumbersWebhooksAuthenticationValidation authenticationChecker) {
this.authenticationChecker = authenticationChecker;
}
@Override
public boolean validateAuthenticationHeader(
String secret, Map headers, String jsonPayload) {
return authenticationChecker.validateAuthenticationHeader(secret, headers, jsonPayload);
}
@Override
public NumberEvent parseEvent(String jsonPayload) throws ApiMappingException {
try {
return Mapper.getInstance().readValue(jsonPayload, NumberEvent.class);
} catch (JsonProcessingException e) {
throw new ApiMappingException(jsonPayload, e);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy