# Update Integration Meta API - TypeScript Examples

This document provides TypeScript usage examples for the Update Integration Meta API API using the Repzo SDK.

## Installation

```bash
npm install repzo
```

## Basic Setup

```typescript
import { Service } from "repzo";

// Initialize with your API key
const apiKey = "your-api-key";
const baseURL = "https://api.repzo.me/v1";
```

## API Usage Examples

### Get all integration meta update records

Retrieve a list of all integration metadata update records with optional filtering and pagination

```typescript
// GET /update-integration-meta

const params = {
  limit: 1, // Maximum number of records to return

  offset: 1, // Number of records to skip for pagination

  sort: "example-value", // Field to sort by

  order: "example-value", // Sort order (asc or desc)

  filter: "example-value", // Filter conditions in JSON format

  search: "example-value", // Search term for text fields
};

const result = await fetch(
  `${baseURL}/update-integration-meta?${new URLSearchParams(params)}`,
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${apiKey}`,
      "Content-Type": "application/json",
    },
  },
);

const data = await result.json();
console.log(data);
```

**Expected Response:**

```json
{
  "success": true,
  "data": {
    // Response data structure based on API specification
  }
}
```

---

### Create a new integration meta update

Create a new integration metadata update with the provided data

```typescript
// POST /update-integration-meta

const requestBody = {
  // Add your request body properties here
  // Based on the API schema
};

const result = await fetch(`${baseURL}/update-integration-meta`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(requestBody),
});

const data = await result.json();
console.log(data);
```

---

### Get integration meta update by ID

Retrieve a specific integration metadata update by its ID

```typescript
// GET /update-integration-meta/{id}

const params = {
  id: "example-value", // Integration meta update ID
};

const result = await fetch(
  `${baseURL}/update-integration-meta/{id}?${new URLSearchParams(params)}`,
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${apiKey}`,
      "Content-Type": "application/json",
    },
  },
);

const data = await result.json();
console.log(data);
```

**Expected Response:**

```json
{
  "success": true,
  "data": {
    // Response data structure based on API specification
  }
}
```

---

### Update integration meta update

Update an existing integration metadata update with new data

```typescript

```

**Expected Response:**

```json
{
  "success": true,
  "data": {
    // Response data structure based on API specification
  }
}
```

---

### Delete integration meta update

Delete an existing integration metadata update

```typescript
// DELETE /update-integration-meta/{id}

const id = "your-resource-id";
const deletePath = "/update-integration-meta/{id}".replace("{id}", id);

const result = await fetch(`${baseURL}${deletePath}`, {
  method: "DELETE",
  headers: {
    Authorization: `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
});

const data = await result.json();
console.log(data);
```

**Expected Response:**

```json
{
  "success": true,
  "data": {
    // Response data structure based on API specification
  }
}
```

---

### Apply integration meta update

Apply a specific integration metadata update

```typescript
// POST /update-integration-meta/apply/{id}
```

**Expected Response:**

```json
{
  "success": true,
  "data": {
    // Response data structure based on API specification
  }
}
```

---

## Using with Repzo SDK Service Types

The Repzo SDK provides TypeScript interfaces for type safety:

```typescript
import { Service } from "repzo";

// Example using SDK types

async function example() {
  // Use the Service.Updateintegrationmeta types for better type safety
  // This provides intellisense and compile-time type checking
}
```

## Error Handling

```typescript
try {
  const result = await fetch(`${baseURL}/endpoint`, {
    method: "GET",
    headers: {
      Authorization: `Bearer ${apiKey}`,
      "Content-Type": "application/json",
    },
  });

  if (!result.ok) {
    throw new Error(`HTTP error! status: ${result.status}`);
  }

  const data = await result.json();

  if (!data.success) {
    throw new Error(data.error || "API request failed");
  }

  return data.data;
} catch (error) {
  console.error("API request failed:", error);
  throw error;
}
```

## Pagination

Many API endpoints support pagination:

```typescript
const params = {
  page: 1,
  per_page: 25,
  // other filters...
};

const result = await fetch(
  `${baseURL}/endpoint?${new URLSearchParams(params)}`,
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${apiKey}`,
      "Content-Type": "application/json",
    },
  },
);

const data = await result.json();

// Access pagination info
console.log("Total items:", data.paging.total);
console.log("Current page:", data.paging.page);
console.log("Total pages:", data.paging.pages);
```
