SEL_ApiCall
Class · Group: Web Services
global inherited sharing class SEL_ApiCall extends SEL_BaseExtends: SEL_Base
Selector for the ApiCall__c object. Provides query methods for service call management, status tracking, and assertion utilities for test verification.
Example
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
| Method | Description |
|---|---|
| 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
global static List<ApiCall__c> assertServiceAborted(String serviceName)Verifies that API calls for a specific service name have an aborted status.
Parameters
| Parameter | Type | Description |
|---|---|---|
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.
Example
List<ApiCall__c> aborted = SEL_ApiCall.assertServiceAborted('MyExternalService');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
| Parameter | Type | Description |
|---|---|---|
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.
Example
List<ApiCall__c> aborted = SEL_ApiCall.assertServiceAborted('MyExternalService', 'Connection timeout');assertServiceCompleted
global static List<ApiCall__c> assertServiceCompleted(String serviceName)Verifies that API calls for a specific service name have a completed status.
Parameters
| Parameter | Type | Description |
|---|---|---|
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.
Example
List<ApiCall__c> result = SEL_ApiCall.assertServiceCompleted('SEL_ApiCall');assertServiceFailed
global static List<ApiCall__c> assertServiceFailed(String serviceName)Verifies that API calls for a specific service name have a failed status.
Parameters
| Parameter | Type | Description |
|---|---|---|
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.
Example
List<ApiCall__c> result = SEL_ApiCall.assertServiceFailed('SEL_ApiCall');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
| Parameter | Type | Description |
|---|---|---|
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.
Example
List<ApiCall__c> result = SEL_ApiCall.assertServiceFailed('SEL_ApiCall', 'value');findByServiceName
global List<ApiCall__c> findByServiceName(String serviceName)Retrieves ApiCall__c records by a specific service name.
Parameters
| Parameter | Type | Description |
|---|---|---|
serviceName | String | The name of the service to filter on. |
Returns ApiCall__c — List of ApiCall__c records with the specified Service__c value.
Example
List<ApiCall__c> apiCalls = new SEL_ApiCall().findByServiceName('MyExternalService');getFields
global override List<SObjectField> getFields()Returns the default fields for ApiCall__c queries.
Returns SObjectField — List of SObjectField tokens to include in queries.
Example
List<SObjectField> result = instance.getFields();Constructors
| Constructor | Description |
|---|---|
| global SEL_ApiCall() | Constructs a new SEL_ApiCall selector instance. |
SEL_ApiCall()
global SEL_ApiCall()Constructs a new SEL_ApiCall selector instance.
Example
SEL_ApiCall instance = new SEL_ApiCall();