# SDKs and CLI

The SDKs handle request signing. Install directly from GitHub.

Set the API base URL explicitly, as shown below. The pinned Node and Go SDKs default to a non-production URL.

## Node

```sh
npm i github:armadadelivery/armada-node#v0.1.0-beta.0
```

```javascript
import { ArmadaClient } from '@armada/sdk';
const armada = new ArmadaClient({
	baseUrl: 'https://api.armadadelivery.com',
	apiKey: process.env.ARMADA_API_KEY,
	apiSecret: process.env.ARMADA_API_SECRET
});
const { data } = await armada.wallet.get();
console.log(data);
```

The examples use JavaScript. For TypeScript integrations, use the OpenAPI schemas to define branch inputs and delivery and wallet response types, including `test_mode` and snake-case delivery fields.

## PHP

```sh
composer config repositories.armada vcs https://github.com/armadadelivery/armada-php
composer require armada/sdk:dev-main
```

```php
<?php
require 'vendor/autoload.php';

use Armada\SDK\ArmadaClient;

$armada = new ArmadaClient([
    'baseUrl' => 'https://api.armadadelivery.com',
    'apiKey' => getenv('ARMADA_API_KEY'),
    'apiSecret' => getenv('ARMADA_API_SECRET'),
]);
$response = $armada->get('/v2/wallet');
echo $response->getBody();
```

## Go

```sh
go get github.com/armadadelivery/sdk-go@v0.1.0-beta.0
```

```go
package main

import (
    "context"
    "fmt"
    "os"
    armada "github.com/armadadelivery/sdk-go"
)

func main() {
    client := armada.NewClient(armada.Options{
        BaseURL: "https://api.armadadelivery.com",
        APIKey: os.Getenv("ARMADA_API_KEY"),
        APISecret: os.Getenv("ARMADA_API_SECRET"),
    })
    response, err := client.Get(context.Background(), "/v2/wallet", nil)
    if err != nil { panic(err) }
    var wallet struct { Balance float64; Currency string }
    if err := armada.DecodeJSON(response, &wallet); err != nil { panic(err) }
    fmt.Println(wallet.Balance, wallet.Currency)
}
```

## CLI

```sh
npm i -g github:armadadelivery/armada-cli#v0.1.0-beta.0
export ARMADA_API_KEY=main_your_key
export ARMADA_API_SECRET=your_secret
export ARMADA_API_BASE=https://api.armadadelivery.com
armada wallet
```

Use [Authentication](https://docs.armadadelivery.com/v2/authentication.md) when implementing a client without an SDK. SDKs are installed from the versions above; check their repository release notes before upgrading.
