Skip to content

SEL_ApiCall

Class · Group: Web Services

apex
global inherited sharing class SEL_ApiCall extends SEL_Base

Extends: SEL_Base

Selector for the ApiCall__c object. Provides query methods for service call management, status tracking, and assertion utilities for test verification.

Example

apex
List<ApiCall__c> calls = new SEL_ApiCall().findByServiceName('API_SendEmail');
ApiCall__c call = (ApiCall__c)new SEL_ApiCall().findById(callId);
ApiCall__c existing = new SEL_ApiCall().findByIdempotencyKey('550e8400-e29b-41d4-a716-446655440000');

See Also: SEL_Base


Methods

MethodDescription
global static List<ApiCall__c> assertServiceAborted(String serviceName)Verifies that API calls for a specific service name have an aborted status.
global static List<ApiCall__c> assertServiceAborted(String serviceName, String errorPhrase)Verifies that API calls for a specific service name have an aborted status and optionally checks for a specific error phrase.
global static List<ApiCall__c> assertServiceCompleted(String serviceName)Verifies that API calls for a specific service name have a completed status.
global static List<ApiCall__c> assertServiceFailed(String serviceName)Verifies that API calls for a specific service name have a failed status.
global static List<ApiCall__c> assertServiceFailed(String serviceName, String errorPhrase)Verifies that API calls for a specific service name have a failed status and optionally checks for a specific error phrase.
global List<ApiCall__c> findByServiceName(String serviceName)Retrieves ApiCall__c records by a specific service name.
global override List<SObjectField> getFields()Returns the default fields for ApiCall__c queries.

assertServiceAborted

apex
global static List<ApiCall__c> assertServiceAborted(String serviceName)

Verifies that API calls for a specific service name have an aborted status.

Parameters

ParameterTypeDescription
serviceNameStringThe name of the API class to check.

Returns ApiCall__c — List of ApiCall__c records with "Aborted" status for the specified service.

Example

apex
List<ApiCall__c> aborted = SEL_ApiCall.assertServiceAborted('MyExternalService');
apex
global static List<ApiCall__c> assertServiceAborted(String serviceName, String errorPhrase)

Verifies that API calls for a specific service name have an aborted status and optionally checks for a specific error phrase.

Parameters

ParameterTypeDescription
serviceNameStringThe name of the API class to check.
errorPhraseStringOptional phrase to look for in the Errors__c field (null to ignore).

Returns ApiCall__c — List of matching aborted ApiCall__c records.

Example

apex
List<ApiCall__c> aborted = SEL_ApiCall.assertServiceAborted('MyExternalService', 'Connection timeout');

assertServiceCompleted

apex
global static List<ApiCall__c> assertServiceCompleted(String serviceName)

Verifies that API calls for a specific service name have a completed status.

Parameters

ParameterTypeDescription
serviceNameStringThe name of the API class to check.

Returns ApiCall__c — List of ApiCall__c records with "Completed" status for the specified service.

Example

apex
List<ApiCall__c> result = SEL_ApiCall.assertServiceCompleted('SEL_ApiCall');

assertServiceFailed

apex
global static List<ApiCall__c> assertServiceFailed(String serviceName)

Verifies that API calls for a specific service name have a failed status.

Parameters

ParameterTypeDescription
serviceNameStringThe name of the API class to check.

Returns ApiCall__c — List of ApiCall__c records with "Failed" status for the specified service.

Example

apex
List<ApiCall__c> result = SEL_ApiCall.assertServiceFailed('SEL_ApiCall');
apex
global static List<ApiCall__c> assertServiceFailed(String serviceName, String errorPhrase)

Verifies that API calls for a specific service name have a failed status and optionally checks for a specific error phrase.

Parameters

ParameterTypeDescription
serviceNameStringThe name of the API class to check.
errorPhraseStringOptional phrase to look for in the Errors__c field (null to ignore).

Returns ApiCall__c — List of matching failed ApiCall__c records.

Example

apex
List<ApiCall__c> result = SEL_ApiCall.assertServiceFailed('SEL_ApiCall', 'value');

findByServiceName

apex
global List<ApiCall__c> findByServiceName(String serviceName)

Retrieves ApiCall__c records by a specific service name.

Parameters

ParameterTypeDescription
serviceNameStringThe name of the service to filter on.

Returns ApiCall__c — List of ApiCall__c records with the specified Service__c value.

Example

apex
List<ApiCall__c> apiCalls = new SEL_ApiCall().findByServiceName('MyExternalService');

getFields

apex
global override List<SObjectField> getFields()

Returns the default fields for ApiCall__c queries.

Returns SObjectField — List of SObjectField tokens to include in queries.

Example

apex
List<SObjectField> result = instance.getFields();

Constructors

ConstructorDescription
global SEL_ApiCall()Constructs a new SEL_ApiCall selector instance.

SEL_ApiCall()

apex
global SEL_ApiCall()

Constructs a new SEL_ApiCall selector instance.

Example

apex
SEL_ApiCall instance = new SEL_ApiCall();