npm package: @kyuzan/mountain-public-api-client
Description: Auto-generated TypeScript client for MOUNTAIN Public API
Author: Kyuzan Inc.
Latest version: 1.0.0

# @kyuzan/mountain-public-api-client

TypeScript client library for MOUNTAIN Public API.

## Installation

```bash
npm install @kyuzan/mountain-public-api-client
# or
yarn add @kyuzan/mountain-public-api-client
# or
pnpm add @kyuzan/mountain-public-api-client
```

## Quick Start

```typescript
import { Configuration, ProjectApi } from '@kyuzan/mountain-public-api-client';

// Configure the client
const config = new Configuration({
  basePath: 'https://api.mountain-dev.xyz',
  apiKey: 'your-api-key', // For API Key authentication
  // or
  accessToken: 'your-access-token', // For Access Token authentication
});

// Create API instances
const projectApi = new ProjectApi(config);

// Use the API
const projects = await projectApi.getProjects();
console.log(projects.data);
```

## Authentication

MOUNTAIN Public API supports two authentication methods:

### 1. API Key Authentication

```typescript
const config = new Configuration({
  basePath: 'https://api.mountain-dev.xyz',
  apiKey: 'your-api-key',
});
```

### 2. Access Token Authentication

```typescript
const config = new Configuration({
  basePath: 'https://api.mountain-dev.xyz',
  accessToken: 'your-access-token',
});
```

## Available APIs

### ProjectApi

- `getProjects()` - Get list of projects
- `getProjectDetail(projectId)` - Get project details

### ContractApi

- `importContract(projectId, request)` - Import a smart contract
- `activateContractFunction(projectId, contractId, functionName, request)` - Activate a contract function
- `deactivateContractFunction(projectId, contractId, functionName, request)` - Deactivate a contract function
- `getContractActivatedFunctions(projectId, contractId, request)` - Get activated functions

### TransactionApi

- `executeTransaction(projectId, request)` - Execute a transaction
- `getTransaction(projectId, transactionId)` - Get transaction details
- `getTransactions(projectId)` - Get list of transactions

### EventNotifierApi

- `createEventNotifierSubscription(projectId, request)` - Create webhook subscription
- `getEventNotifierSubscriptions(projectId)` - Get webhook subscriptions
- `updateEventNotifierSubscriptionWebhook(projectId, subscriptionId, request)` - Update webhook URL
- `getEventNotifierRecords(projectId, request)` - Get event records
- `resendFailedWebhook(projectId, recordId, request)` - Resend failed webhook

## Examples

### Execute a Transaction

```typescript
import { Configuration, TransactionApi } from '@kyuzan/mountain-public-api-client';

const config = new Configuration({
  basePath: 'https://api.mountain-dev.xyz',
  accessToken: 'your-access-token',
});

const transactionApi = new TransactionApi(config);

const result = await transactionApi.executeTransaction('project-id', {
  chain: 'ethereum',
  functionName: 'transfer',
  contractAddress: '0x...',
  args: ['0xrecipient...', '1000000000000000000'],
  abi: [...], // Contract ABI
});

console.log('Transaction ID:', result.data.transactionId);
```

### Subscribe to Events

```typescript
import { Configuration, EventNotifierApi } from '@kyuzan/mountain-public-api-client';

const config = new Configuration({
  basePath: 'https://api.mountain-dev.xyz',
  apiKey: 'your-api-key',
});

const eventApi = new EventNotifierApi(config);

const subscription = await eventApi.createEventNotifierSubscription('project-id', {
  chain: 'ethereum',
  contractAddress: '0x...',
  eventName: 'Transfer',
  webhookUrl: 'https://your-webhook-endpoint.com/webhook',
});

console.log('Subscription ID:', subscription.data.subscriptionId);
```

## Error Handling

```typescript
import { AxiosError } from 'axios';

try {
  const result = await projectApi.getProjects();
} catch (error) {
  if (error instanceof AxiosError) {
    console.error('API Error:', error.response?.data);
    console.error('Status:', error.response?.status);
  } else {
    console.error('Unknown error:', error);
  }
}
```

## TypeScript Support

This package is written in TypeScript and provides full type definitions for all API requests and responses.

## API Reference

For detailed API documentation, please visit [MOUNTAIN Public API Reference](https://mountain-public-docs.netlify.app/api-reference/).

## License

MIT

## Support

For support and questions, please visit [MOUNTAIN Documentation](https://mountain-public-docs.netlify.app/).