Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.19.0
4.20.0
266 changes: 266 additions & 0 deletions src/Actions/AlertActions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
<?php
namespace Chargebee\Actions;

use Chargebee\Actions\Contracts\AlertActionsInterface;
use Chargebee\Responses\AlertResponse\RetrieveAlertResponse;
use Chargebee\Responses\AlertResponse\ListAlertResponse;
use Chargebee\Responses\AlertResponse\UpdateAlertResponse;
use Chargebee\Responses\AlertResponse\CreateAlertResponse;
use Chargebee\Responses\AlertResponse\ApplicationAlertsForSubscriptionAlertResponse;
use Chargebee\ValueObjects\Encoders\ListParamEncoder;
use Chargebee\Responses\AlertResponse\DeleteAlertResponse;
use Chargebee\ValueObjects\Encoders\URLFormEncoder;
use Chargebee\ValueObjects\Transporters\ChargebeePayload;
use Chargebee\ValueObjects\APIRequester;
use Chargebee\HttpClient\HttpClientFactory;
use Chargebee\Environment;
use Exception;
use Chargebee\Exceptions\PaymentException;
use Chargebee\Exceptions\OperationFailedException;
use Chargebee\Exceptions\APIError;
use Chargebee\Exceptions\InvalidRequestException;

final class AlertActions implements AlertActionsInterface
{
private HttpClientFactory $httpClientFactory;
private Environment $env;
public function __construct(HttpClientFactory $httpClientFactory, Environment $env){
$this->httpClientFactory = $httpClientFactory;
$this->env = $env;
}

/**
* @see https://apidocs.chargebee.com/docs/api/alerts/list-applicable-alerts-for-a-subscription?lang=php-v4
* @param array{
* limit?: int,
* offset?: string,
* status?: array{
* is?: mixed,
* },
* type?: array{
* is?: mixed,
* },
* } $params Description of the parameters
* @param string $id
* @param array<string, string> $headers
* @return ApplicationAlertsForSubscriptionAlertResponse
* @throws PaymentException
* @throws OperationFailedException
* @throws APIError
* @throws InvalidRequestException
* @throws Exception
*/
public function applicationAlertsForSubscription(string $id, array $params = [], array $headers = []): ApplicationAlertsForSubscriptionAlertResponse
{
$jsonKeys = [
];
$payload = ChargebeePayload::builder()
->withEnvironment($this->env)
->withHttpMethod("get")
->withUriPaths(["subscriptions",$id,"applicable_alerts"])
->withParamEncoder(new ListParamEncoder())
->withSubDomain(null)
->withJsonKeys($jsonKeys)
->withHeaders($headers)
->withParams($params)
->build();
$apiRequester = new APIRequester($this->httpClientFactory, $this->env);
$respObject = $apiRequester->makeRequest($payload);
return ApplicationAlertsForSubscriptionAlertResponse::from($respObject->data, $respObject->headers);
}

/**
* @see https://apidocs.chargebee.com/docs/api/alerts/retrieve-an-alert?lang=php-v4
*
* @param string $id
* @param array<string, string> $headers
* @return RetrieveAlertResponse
* @throws PaymentException
* @throws OperationFailedException
* @throws APIError
* @throws InvalidRequestException
* @throws Exception
*/
public function retrieve(string $id, array $headers = []): RetrieveAlertResponse
{
$jsonKeys = [
];
$payload = ChargebeePayload::builder()
->withEnvironment($this->env)
->withHttpMethod("get")
->withUriPaths(["alerts",$id])
->withParamEncoder( new URLFormEncoder())
->withSubDomain(null)
->withJsonKeys($jsonKeys)
->withHeaders($headers)
->build();
$apiRequester = new APIRequester($this->httpClientFactory, $this->env);
$respObject = $apiRequester->makeRequest($payload);
return RetrieveAlertResponse::from($respObject->data, $respObject->headers);
}

/**
* @see https://apidocs.chargebee.com/docs/api/alerts/update-an-alert?lang=php-v4
* @param array{
* threshold?: array{
* mode?: string,
* value?: float,
* },
* status?: string,
* } $params Description of the parameters
* @param string $id
* @param array<string, string> $headers
* @return UpdateAlertResponse
* @throws PaymentException
* @throws OperationFailedException
* @throws APIError
* @throws InvalidRequestException
* @throws Exception
*/
public function update(string $id, array $params = [], array $headers = []): UpdateAlertResponse
{
$jsonKeys = [
];
$payload = ChargebeePayload::builder()
->withEnvironment($this->env)
->withHttpMethod("post")
->withUriPaths(["alerts",$id])
->withParamEncoder( new URLFormEncoder())
->withSubDomain(null)
->withJsonKeys($jsonKeys)
->withHeaders($headers)
->withParams($params)
->withIdempotent(true)
->build();
$apiRequester = new APIRequester($this->httpClientFactory, $this->env);
$respObject = $apiRequester->makeRequest($payload);
return UpdateAlertResponse::from($respObject->data, $respObject->headers);
}

/**
* @see https://apidocs.chargebee.com/docs/api/alerts/delete-an-alert?lang=php-v4
*
* @param string $id
* @param array<string, string> $headers
* @return DeleteAlertResponse
* @throws PaymentException
* @throws OperationFailedException
* @throws APIError
* @throws InvalidRequestException
* @throws Exception
*/
public function delete(string $id, array $headers = []): DeleteAlertResponse
{
$jsonKeys = [
];
$payload = ChargebeePayload::builder()
->withEnvironment($this->env)
->withHttpMethod("post")
->withUriPaths(["alerts",$id,"delete"])
->withParamEncoder( new URLFormEncoder())
->withSubDomain(null)
->withJsonKeys($jsonKeys)
->withHeaders($headers)
->withIdempotent(true)
->build();
$apiRequester = new APIRequester($this->httpClientFactory, $this->env);
$respObject = $apiRequester->makeRequest($payload);
return DeleteAlertResponse::from($respObject->data, $respObject->headers);
}

/**
* @see https://apidocs.chargebee.com/docs/api/alerts/list-alerts?lang=php-v4
* @param array{
* limit?: int,
* offset?: string,
* id?: array{
* in?: mixed,
* },
* type?: array{
* is?: mixed,
* },
* subscription_id?: array{
* is?: mixed,
* },
* status?: array{
* is?: mixed,
* },
* } $params Description of the parameters
*
* @param array<string, string> $headers
* @return ListAlertResponse
* @throws PaymentException
* @throws OperationFailedException
* @throws APIError
* @throws InvalidRequestException
* @throws Exception
*/
public function all(array $params = [], array $headers = []): ListAlertResponse
{
$jsonKeys = [
];
$payload = ChargebeePayload::builder()
->withEnvironment($this->env)
->withHttpMethod("get")
->withUriPaths(["alerts"])
->withParamEncoder(new ListParamEncoder())
->withSubDomain(null)
->withJsonKeys($jsonKeys)
->withHeaders($headers)
->withParams($params)
->build();
$apiRequester = new APIRequester($this->httpClientFactory, $this->env);
$respObject = $apiRequester->makeRequest($payload);
return ListAlertResponse::from($respObject->data, $respObject->headers);
}

/**
* @see https://apidocs.chargebee.com/docs/api/alerts/create-an-alert?lang=php-v4
* @param array{
* threshold?: array{
* mode?: string,
* value?: float,
* },
* filter_conditions?: array<array{
* field?: string,
* operator?: string,
* value?: string,
* }>,
* type?: string,
* name?: string,
* description?: string,
* metered_feature_id?: string,
* subscription_id?: string,
* meta?: string,
* } $params Description of the parameters
*
* @param array<string, string> $headers
* @return CreateAlertResponse
* @throws PaymentException
* @throws OperationFailedException
* @throws APIError
* @throws InvalidRequestException
* @throws Exception
*/
public function create(array $params, array $headers = []): CreateAlertResponse
{
$jsonKeys = [
];
$payload = ChargebeePayload::builder()
->withEnvironment($this->env)
->withHttpMethod("post")
->withUriPaths(["alerts"])
->withParamEncoder( new URLFormEncoder())
->withSubDomain(null)
->withJsonKeys($jsonKeys)
->withHeaders($headers)
->withParams($params)
->withIdempotent(true)
->build();
$apiRequester = new APIRequester($this->httpClientFactory, $this->env);
$respObject = $apiRequester->makeRequest($payload);
return CreateAlertResponse::from($respObject->data, $respObject->headers);
}

}
?>
106 changes: 106 additions & 0 deletions src/Actions/AlertStatusActions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?php
namespace Chargebee\Actions;

use Chargebee\Responses\AlertStatusResponse\AlertStatusesForAlertAlertStatusResponse;
use Chargebee\Responses\AlertStatusResponse\AlertStatusesForSubscriptionAlertStatusResponse;
use Chargebee\ValueObjects\Encoders\ListParamEncoder;
use Chargebee\Actions\Contracts\AlertStatusActionsInterface;
use Chargebee\ValueObjects\Encoders\URLFormEncoder;
use Chargebee\ValueObjects\Transporters\ChargebeePayload;
use Chargebee\ValueObjects\APIRequester;
use Chargebee\HttpClient\HttpClientFactory;
use Chargebee\Environment;
use Exception;
use Chargebee\Exceptions\PaymentException;
use Chargebee\Exceptions\OperationFailedException;
use Chargebee\Exceptions\APIError;
use Chargebee\Exceptions\InvalidRequestException;

final class AlertStatusActions implements AlertStatusActionsInterface
{
private HttpClientFactory $httpClientFactory;
private Environment $env;
public function __construct(HttpClientFactory $httpClientFactory, Environment $env){
$this->httpClientFactory = $httpClientFactory;
$this->env = $env;
}

/**
* @see https://apidocs.chargebee.com/docs/api/alert_statuses/list-alert-statuses-for-a-subscription?lang=php-v4
* @param array{
* limit?: int,
* offset?: string,
* alarm_status?: array{
* is?: mixed,
* },
* alert_id?: array{
* in?: mixed,
* },
* } $params Description of the parameters
* @param string $id
* @param array<string, string> $headers
* @return AlertStatusesForSubscriptionAlertStatusResponse
* @throws PaymentException
* @throws OperationFailedException
* @throws APIError
* @throws InvalidRequestException
* @throws Exception
*/
public function alertStatusesForSubscription(string $id, array $params = [], array $headers = []): AlertStatusesForSubscriptionAlertStatusResponse
{
$jsonKeys = [
];
$payload = ChargebeePayload::builder()
->withEnvironment($this->env)
->withHttpMethod("get")
->withUriPaths(["subscriptions",$id,"alert_statuses"])
->withParamEncoder(new ListParamEncoder())
->withSubDomain(null)
->withJsonKeys($jsonKeys)
->withHeaders($headers)
->withParams($params)
->build();
$apiRequester = new APIRequester($this->httpClientFactory, $this->env);
$respObject = $apiRequester->makeRequest($payload);
return AlertStatusesForSubscriptionAlertStatusResponse::from($respObject->data, $respObject->headers);
}

/**
* @see https://apidocs.chargebee.com/docs/api/alert_statuses/list-alert-statuses-for-an-alert?lang=php-v4
* @param array{
* limit?: int,
* offset?: string,
* alarm_status?: array{
* is?: mixed,
* },
* } $params Description of the parameters
* @param string $id
* @param array<string, string> $headers
* @return AlertStatusesForAlertAlertStatusResponse
* @throws PaymentException
* @throws OperationFailedException
* @throws APIError
* @throws InvalidRequestException
* @throws Exception
*/
public function alertStatusesForAlert(string $id, array $params = [], array $headers = []): AlertStatusesForAlertAlertStatusResponse
{
$jsonKeys = [
];
$payload = ChargebeePayload::builder()
->withEnvironment($this->env)
->withHttpMethod("get")
->withUriPaths(["alerts",$id,"alert_statuses"])
->withParamEncoder(new ListParamEncoder())
->withSubDomain(null)
->withJsonKeys($jsonKeys)
->withHeaders($headers)
->withParams($params)
->build();
$apiRequester = new APIRequester($this->httpClientFactory, $this->env);
$respObject = $apiRequester->makeRequest($payload);
return AlertStatusesForAlertAlertStatusResponse::from($respObject->data, $respObject->headers);
}

}
?>
Loading
Loading