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.

Since: 1.0

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 assertServiceAborted(String serviceName)Verifies that API calls for a specific service name have an aborted status.
global static List 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 assertServiceCompleted(String serviceName)Verifies that API calls for a specific service name have a completed status.
global static List assertServiceFailed(String serviceName)Verifies that API calls for a specific service name have a failed status.
global static List 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 findByServiceName(String serviceName)Retrieves ApiCall__c records by a specific service name.
global override List getFields()Returns the default fields for ApiCall__c queries.
global SEL_ApiCall()Constructs a new SEL_ApiCall selector instance.

Method Details

SEL_ApiCall

apex
global SEL_ApiCall()

Constructs a new SEL_ApiCall selector instance.

Since: 1.0

Example:

apex
SEL_ApiCall instance = new SEL_ApiCall();

assertServiceAborted

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

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

Parameters:

  • serviceName (String) - The name of the API class to check.

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

Since: 1.0

Example:

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

assertServiceAborted

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:

  • serviceName (String) - The name of the API class to check.
  • errorPhrase (String) - Optional phrase to look for in the Errors__c field (null to ignore).

Returns: ApiCall__c - List of matching aborted ApiCall__c records.

Since: 1.0

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:

  • serviceName (String) - The name of the API class to check.

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

Since: 1.0

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:

  • serviceName (String) - The name of the API class to check.

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

Since: 1.0

Example:

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

assertServiceFailed

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:

  • serviceName (String) - The name of the API class to check.
  • errorPhrase (String) - Optional phrase to look for in the Errors__c field (null to ignore).

Returns: ApiCall__c - List of matching failed ApiCall__c records.

Since: 1.0

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:

  • serviceName (String) - The name of the service to filter on.

Returns: ApiCall__c - List of ApiCall__c records with the specified Service__c value.

Since: 1.0

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.

Since: 1.0

Example:

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