card-management-sdk
Version:
The Shell Card Management API is REST-based and employs OAUTH 2.0,Basic and ApiKey authentication. The API endpoints accept JSON-encoded request bodies, return JSON-encoded responses and use standard HTTP response codes. All resources are located in the S
156 lines (101 loc) • 6.39 kB
Markdown
The Shell Card Management API provides secure and structured access to the Shell Card Platform, enabling integration with Shell’s internal systems for managing card-related resources.
This REST-based API uses the POST method for all operations—including retrieval, creation, update, and deletion of resources. It supports flexible search capabilities through JSON-encoded request bodies and returns JSON-formatted responses. Standard HTTP status codes are used to indicate the outcome of each request.
Authentication is handled via OAuth 2.0 using the Client Credentials flow. Access tokens must be included in the Authorization header of each request.
All resources are managed within the Shell Card Platform, which abstracts the complexity of backend systems. Some operations may be processed asynchronously, and clients should be prepared to handle delayed responses or polling mechanisms where applicable.
Go to the Shell Developer Portal: [https://developer.shell.com](https://developer.shell.com)
Run the following command from your project directory to install the package from npm:
```bash
npm install card-management-sdk@3.0.3
```
For additional package details, see the [Npm page for the card-management-sdk@3.0.3 npm](https://www.npmjs.com/package/card-management-sdk/v/3.0.3).
To validate the functionality of this SDK, you can execute all tests located in the `test` directory. This SDK utilizes `Jest` as both the testing framework and test runner.
To run the tests, navigate to the root directory of the SDK and execute the following command:
```bash
npm run test
```
Or you can also run tests with coverage report:
```bash
npm run test:coverage
```
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/sdks-io/card-management-js-sdk/tree/3.0.3/doc/client.md)
The following parameters are configurable for the API Client:
| Parameter | Type | Description |
| --- | --- | --- |
| environment | [`Environment`](https://www.github.com/sdks-io/card-management-js-sdk/tree/3.0.3/README.md#environments) | The API environment. <br> **Default: `Environment.SIT`** |
| timeout | `number` | Timeout for API calls.<br>*Default*: `0` |
| httpClientOptions | [`Partial<HttpClientOptions>`](https://www.github.com/sdks-io/card-management-js-sdk/tree/3.0.3/doc/http-client-options.md) | Stable configurable http client options. |
| unstableHttpClientOptions | `any` | Unstable configurable http client options. |
| clientCredentialsAuthCredentials | [`ClientCredentialsAuthCredentials`](https://www.github.com/sdks-io/card-management-js-sdk/tree/3.0.3/doc/auth/oauth-2-client-credentials-grant.md) | The credential object for clientCredentialsAuth |
The API client can be initialized as follows:
```ts
import { Client, Environment } from 'card-management-sdk';
const client = new Client({
clientCredentialsAuthCredentials: {
oAuthClientId: 'OAuthClientId',
oAuthClientSecret: 'OAuthClientSecret'
},
timeout: 0,
environment: Environment.SIT,
});
```
```ts
import * as path from 'path';
import * as fs from 'fs';
import { Client } from 'card-management-sdk';
// Provide absolute path for the configuration file
const absolutePath = path.resolve('./config.json');
// Read the configuration file content
const fileContent = fs.readFileSync(absolutePath, 'utf-8');
// Initialize client from JSON configuration content
const client = Client.fromJsonConfig(fileContent);
```
See the [Configuration-Based Client Initialization](https://www.github.com/sdks-io/card-management-js-sdk/tree/3.0.3/doc/configuration-based-client-initialization.md) section for details.
```ts
import * as dotenv from 'dotenv';
import * as path from 'path';
import * as fs from 'fs';
import { Client } from 'card-management-sdk';
// Optional - Provide absolute path for the .env file
const absolutePath = path.resolve('./.env');
if (fs.existsSync(absolutePath)) {
// Load environment variables from .env file
dotenv.config({ path: absolutePath, override: true });
}
// Initialize client using environment variables
const client = Client.fromEnvironment(process.env);
```
See the [Environment-Based Client Initialization](https://www.github.com/sdks-io/card-management-js-sdk/tree/3.0.3/doc/environment-based-client-initialization.md) section for details.
The SDK can be configured to use a different environment for making API calls. Available environments are:
| Name | Description |
| --- | --- |
| SIT | **Default** |
| Production | - |
This API uses the following authentication schemes.
* [`BearerToken (OAuth 2 Client Credentials Grant)`](https://www.github.com/sdks-io/card-management-js-sdk/tree/3.0.3/doc/auth/oauth-2-client-credentials-grant.md)
* [Customer](https://www.github.com/sdks-io/card-management-js-sdk/tree/3.0.3/doc/controllers/customer.md)
* [Restriction](https://www.github.com/sdks-io/card-management-js-sdk/tree/3.0.3/doc/controllers/restriction.md)
* [Card](https://www.github.com/sdks-io/card-management-js-sdk/tree/3.0.3/doc/controllers/card.md)
* [HttpClientOptions](https://www.github.com/sdks-io/card-management-js-sdk/tree/3.0.3/doc/http-client-options.md)
* [RetryConfiguration](https://www.github.com/sdks-io/card-management-js-sdk/tree/3.0.3/doc/retry-configuration.md)
* [ProxySettings](https://www.github.com/sdks-io/card-management-js-sdk/tree/3.0.3/doc/proxy-settings.md)
* [Configuration-Based Client Initialization](https://www.github.com/sdks-io/card-management-js-sdk/tree/3.0.3/doc/configuration-based-client-initialization.md)
* [Environment-Based Client Initialization](https://www.github.com/sdks-io/card-management-js-sdk/tree/3.0.3/doc/environment-based-client-initialization.md)
* [HttpRequest](https://www.github.com/sdks-io/card-management-js-sdk/tree/3.0.3/doc/http-request.md)
* [ApiResponse](https://www.github.com/sdks-io/card-management-js-sdk/tree/3.0.3/doc/api-response.md)
* [ApiError](https://www.github.com/sdks-io/card-management-js-sdk/tree/3.0.3/doc/api-error.md)