@univ-lehavre/atlas-redcap-client ​
Description ​
REDCap API client for @univ-lehavre/crf.
Example ​
typescript
import { Effect } from 'effect';
import {
createRedcapClient,
RedcapUrl,
RedcapToken
} from '@univ-lehavre/crf/redcap';
const client = createRedcapClient({
url: RedcapUrl('https://redcap.example.com/api/'),
token: RedcapToken('AABBCCDD11223344AABBCCDD11223344'),
});
const version = await Effect.runPromise(client.getVersion());Classes ​
| Class | Description |
|---|---|
| RedcapApiError | API error response from REDCap |
| RedcapClientService | Effect Context Tag for the REDCap Client Service. |
| RedcapHttpError | HTTP error response from REDCap. |
| RedcapNetworkError | Network/transport error |
| UnsupportedVersionError | Error when REDCap version is not supported |
| VersionParseError | Error parsing a version string |
Interfaces ​
| Interface | Description |
|---|---|
| components | - |
| ExportRecordsOptions | Options for exporting records from REDCap. |
| ImportRecordsOptions | Options for importing records into REDCap. |
| operations | - |
| paths | This file was auto-generated by openapi-typescript. Do not make direct changes to the file. |
| RedcapAdapter | Interface for adapting REDCap API requests/responses based on server version. |
| RedcapClient | REDCap API client interface. |
| RedcapConfig | Configuration for REDCap API client. |
| RedcapFeatures | Feature flags indicating what's available in a REDCap version. |
| Version | Parsed version object |
Type Aliases ​
| Type Alias | Description |
|---|---|
| BooleanFlag | Binary flag (0 or 1) |
| Email address | |
| ErrorResponse | - |
| ExportFieldName | - |
| Field | - |
| ImportResult | - |
| Instrument | - |
| InstrumentName | REDCap instrument (form) name |
| IsoTimestamp | ISO 8601 timestamp |
| NonEmptyString | Non-empty string |
| PositiveInt | Positive integer (>= 1) |
| ProjectInfo | - |
| RecordId | REDCap record identifier |
| RedcapClientError | All possible errors from the REDCap client. |
| RedcapError | Union of all REDCap errors |
| RedcapToken | REDCap API token (32 uppercase hex characters). |
| RedcapUrl | Branded type for REDCap API URL. Alias for SafeApiUrl from @univ-lehavre/atlas-net. |
| SupportedVersionString | Type alias for version strings in SUPPORTED_VERSIONS. Since SUPPORTED_VERSIONS is typed as readonly string[], this is effectively string. |
| TransformedParams | Parameters for REDCap API requests after transformation. |
| UserId | REDCap user ID (username) |
Variables ​
| Variable | Description |
|---|---|
| compareVersions | Compare two versions |
| Validate and brand a string as Email | |
| formatVersion | Format a Version object as a string |
| fromBooleanFlag | Convert BooleanFlag to boolean |
| getMajorVersion | Get the major version number |
| InstrumentName | Validate and brand a string as InstrumentName |
| IsoTimestamp | Validate and brand a string as IsoTimestamp |
| isVersionAtLeast | Check if current version is at least the minimum version |
| isVersionInRange | Check if current version is within the specified range [min, max) |
| isVersionLessThan | Check if current version is less than the maximum version |
| NonEmptyString | Validate and brand a string as NonEmptyString |
| parseVersion | Parse a version string into a Version object using Effect. |
| PositiveInt | Validate and brand a number as PositiveInt |
| RecordId | Validate and brand a string as RecordId |
| RedcapToken | Validate and brand a string as RedcapToken. |
| RedcapUrl | - |
| SUPPORTED_VERSIONS | Known supported REDCap versions |
| toBooleanFlag | Convert boolean to BooleanFlag |
| UserId | Validate and brand a string as UserId |
Functions ​
| Function | Description |
|---|---|
| createRedcapClient | Creates a new REDCap API client instance. |
| escapeFilterLogicValue | Escapes special characters in a value to be used in REDCap filterLogic. Prevents injection attacks by escaping double quotes and backslashes. |
| getAdapter | Get the adapter for a specific REDCap version. Prefer using getAdapterEffect for better error handling. |
| getAdapterEffect | Get the adapter for a specific REDCap version as an Effect. |
| getLatestAdapter | Get the latest adapter (for the newest supported version). |
| getMinSupportedVersion | Get the minimum supported version. |
| getSupportedVersionRanges | Get all supported version ranges. |
| isVersionSupported | Check if a version is supported. |
| makeRedcapClientLayer | Creates an Effect Layer providing the RedcapClientService. |
References ​
BooleanFlagType ​
Renames and re-exports BooleanFlag
EmailType ​
Renames and re-exports Email
InstrumentNameType ​
Renames and re-exports InstrumentName
IsoTimestampType ​
Renames and re-exports IsoTimestamp
NonEmptyStringType ​
Renames and re-exports NonEmptyString
PositiveIntType ​
Renames and re-exports PositiveInt
RecordIdType ​
Renames and re-exports RecordId
RedcapTokenType ​
Renames and re-exports RedcapToken
RedcapUrlType ​
Renames and re-exports RedcapUrl
UserIdType ​
Renames and re-exports UserId