### Install Pachca Go SDK Source: https://dev.pachca.com/api/overview Add the Pachca Go SDK to your project using go get. ```bash go get github.com/pachca/openapi/sdk/go/generated ``` -------------------------------- ### CLI Quick Start Source: https://dev.pachca.com/llms.txt This section provides instructions on how to install and use the Pachca CLI for interacting with the API. It includes commands for authentication and basic operations like sending messages. ```APIDOC ## CLI Quick Start ```bash # Zero-install (npx) npx -y @pachca/cli --token # For regular use npm install -g @pachca/cli pachca auth login pachca messages create --entity-id= --content="Hello" pachca guide "отправить сообщение" # CLI guide for humans ``` ``` -------------------------------- ### Example Workflows: Custom Profile Fields Source: https://dev.pachca.com/guides/cli/workflows This example demonstrates how to find and execute a workflow for retrieving custom profile fields. It involves listing custom properties and then getting the profile details. ```bash pachca guide "custom profile fields" # Workflow: Get custom profile fields (pachca-profile) # # 1. $ pachca custom-properties list # entity_type=User # 2. $ pachca profile get # custom_properties contains field values ``` -------------------------------- ### Make First Request: Get Profile Source: https://dev.pachca.com/guides/sdk/go Example of making the first API request using the Go SDK to retrieve the user's profile. The response includes detailed user information. ```go import pachca "github.com/pachca/openapi/sdk/go/generated" // Получение профиля response, err := client.Profile.GetProfile(ctx) // → User{ID: int32, FirstName: string, LastName: *string, Nickname: string, Email: *string, PhoneNumber: *string, Department: *string, Title: *string, Role: UserRole, Suspended: bool, InviteStatus: InviteStatus, InviterID: *int32, ListTags: []string, CustomProperties: []CustomProperty{ID: int32, Name: string, DataType: CustomPropertyDataType, Value: string}, UserStatus: *UserStatus{Emoji: string, Title: string, ExpiresAt: *string, IsAway: bool, AwayMessage: *UserStatusAwayMessage{Text: string}}, Bot: bool, Sso: bool, CreatedAt: string, LastActivityAt: *string, TimeZone: *string, ImageURL: *string} ``` -------------------------------- ### Install SDK Source: https://dev.pachca.com/guides/sdk/typescript Install the @pachca/sdk package using npm. ```APIDOC ## Install SDK ### Description Install the @pachca/sdk package using npm. ### Command ```bash npm install @pachca/sdk ``` ``` -------------------------------- ### Make a Profile Get Request Source: https://dev.pachca.com/guides/sdk/kotlin Example of fetching the user profile using the created client. All SDK methods are suspend functions and should be called from coroutines. ```kotlin // Получение профиля val response = client.profile.getProfile() // → User(id: Int, firstName: String, lastName: String?, nickname: String, email: String?, phoneNumber: String?, department: String?, title: String?, role: UserRole, suspended: Boolean, inviteStatus: InviteStatus, inviterId: Int?, listTags: List, customProperties: List, userStatus: UserStatus(emoji: String, title: String, expiresAt: OffsetDateTime?, isAway: Boolean, awayMessage: UserStatusAwayMessage(text: String)?)?, bot: Boolean, sso: Boolean, createdAt: OffsetDateTime, lastActivityAt: OffsetDateTime?, timeZone: String?, imageUrl: String?) ``` -------------------------------- ### Describe API Method and Path in CLI Source: https://dev.pachca.com/updates/season/spring-2026 Use this command to get detailed information about API request and response fields, including example values. This is useful for understanding API structure and for AI agents interacting with the API. ```bash pachca api <МЕТОД> <путь> --describe ``` -------------------------------- ### Setup Shell Autocompletion Source: https://dev.pachca.com/guides/cli/installation Enable command autocompletion for your shell by running the appropriate command. The CLI will output instructions for installing it in your current shell. ```bash pachca autocomplete zsh ``` ```bash pachca autocomplete bash ``` ```bash pachca autocomplete powershell ``` -------------------------------- ### Example Workflows: Create Reminder Source: https://dev.pachca.com/guides/cli/workflows This example shows how to find and execute a workflow for creating a reminder. It includes the command to search for the workflow and the sequence of commands to create the reminder. ```bash pachca guide "create a reminder" # Workflow: Create a reminder (pachca-tasks) # # 1. $ pachca tasks create --kind=reminder --content="Call client" --due-at= --chat-id= ``` -------------------------------- ### Full File Upload Cycle with Python SDK Source: https://dev.pachca.com/api/file-uploads This example shows the complete file upload process using the Pachca Python SDK. It covers getting upload parameters, uploading the file to S3, and sending a message containing the file. ```python from pachca.client import PachcaClient from pachca.models import FileUploadRequest, MessageCreateRequest, MessageCreateRequestMessage, MessageCreateRequestFile, FileType import os client = PachcaClient("YOUR_TOKEN") file_path = "report.pdf" file_name = os.path.basename(file_path) # Шаг 1: Получить параметры загрузки params = await client.files.get_upload_params() # Шаг 2: Загрузить файл на S3 (direct_url — внешний presigned URL) with open(file_path, "rb") as f: await client.files.upload_file( direct_url=params.direct_url, request=FileUploadRequest( content_disposition=params.content_disposition, acl=params.acl, policy=params.policy, x_amz_credential=params.x_amz_credential, x_amz_algorithm=params.x_amz_algorithm, x_amz_date=params.x_amz_date, x_amz_signature=params.x_amz_signature, key=params.key, file=f.read() ) ) # Шаг 3: Отправить сообщение с файлом file_key = params.key.replace("${filename}", file_name) await client.messages.create_message(MessageCreateRequest( message=MessageCreateRequestMessage( entity_type="discussion", entity_id=12345, content="Отчёт прикреплён", files=[MessageCreateRequestFile(key=file_key, name=file_name, file_type=FileType.FILE, size=os.path.getsize(file_path))] ) )) ``` -------------------------------- ### Create User Request Example (cURL) Source: https://dev.pachca.com/api/requests-responses This example demonstrates how to create a new user using a cURL request, including necessary headers and a JSON payload. ```bash curl "https://api.pachca.com/api/shared/v1/users" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "user": { "first_name": "Олег", "last_name": "Петров", "email": "olegp@example.com", "phone_number": "+79001234567", "nickname": "olegpetrov", "department": "Продукт", "title": "CIO", "role": "user", "list_tags": [ "Product", "Design" ], "chat_ids": [ 12345 ], "custom_properties": [ { "id": 1678, "value": "Санкт-Петербург" } ] } }' ``` -------------------------------- ### Install and Use Pachca CLI Source: https://dev.pachca.com/llms.txt Install the Pachca CLI globally using npm for regular use, or use npx for zero-install. Log in with `pachca auth login` to authenticate. ```bash # Zero-install (npx) npx -y @pachca/cli --token # For regular use npm install -g @pachca/cli pachca auth login pachca messages create --entity-id= --content="Hello" pachca guide "отправить сообщение" # CLI guide for humans ``` -------------------------------- ### Install Pachca CLI Source: https://dev.pachca.com/api/overview Install the Pachca Command Line Interface globally using npm. ```bash npm install -g @pachca/cli ``` -------------------------------- ### Example Request: Create User Source: https://dev.pachca.com/api/requests-responses An example of a cURL request to create a new user, demonstrating the required headers and JSON body structure. ```APIDOC ### Example Request **Create User** ```bash curl "https://api.pachca.com/api/shared/v1/users" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "user": { "first_name": "Олег", "last_name": "Петров", "email": "olegp@example.com", "phone_number": "+79001234567", "nickname": "olegpetrov", "department": "Продукт", "title": "CIO", "role": "user", "list_tags": [ "Product", "Design" ], "chat_ids": [ 12345 ], "custom_properties": [ { "id": 1678, "value": "Санкт-Петербург" } ] } }' ``` ``` -------------------------------- ### Install Pachca Python SDK Source: https://dev.pachca.com/api/overview Install the Pachca SDK for Python projects using pip. ```bash pip install pachca-sdk ``` -------------------------------- ### Install Pachca TypeScript SDK Source: https://dev.pachca.com/api/overview Install the Pachca SDK for TypeScript projects using npm. ```bash npm install @pachca/sdk ``` -------------------------------- ### Pachca SDK Usage Examples Source: https://dev.pachca.com/llms.txt Examples of how to use the Pachca SDKs in different programming languages. ```APIDOC ## Pachca SDK Provides typed clients for multiple languages, all following the pattern `PachcaClient(token)` → `client.service.method(request)`. ### TypeScript ```typescript import { PachcaClient } from "@pachca/sdk"; const client = new PachcaClient("TOKEN"); const message = await client.messages.createMessage({ // request body }); ``` ### Python ```python from pachca_sdk import PachcaClient client = PachcaClient("TOKEN") message = await client.messages.create_message( # request body ) ``` ### Go ```go import "github.com/pachca/openapi/sdk/go/generated" client := generated.NewPachcaClient("TOKEN") message, err := client.Messages.CreateMessage(ctx, ( // request body )) ``` ### Kotlin ```kotlin import com.pachca.sdk.PachcaClient val client = PachcaClient("TOKEN") val message = client.messages.createMessage( // request body ) ``` ### Swift ```swift import PachcaSDK let client = PachcaClient(token: "TOKEN") let message = try await client.messages.createMessage( // request body ) ``` ### C# ```csharp using Pachca.Sdk; var client = new PachcaClient("TOKEN"); var message = await client.Messages.CreateMessageAsync( // request body ); ``` **Conventions:** - **Input**: Path parameters and body fields (if ≤2) are expanded into method arguments. Otherwise, a single request object is used. - **Output**: If the API response contains a single field `data`, the SDK returns its content directly. - Service, method, and field names correspond to `operationId` and parameters from OpenAPI. ``` -------------------------------- ### CLI Command Pattern Examples Source: https://dev.pachca.com/guides/cli/commands Examples demonstrating how API endpoints map to Pachca CLI commands. The command structure follows the pattern `pachca [section] [action]`. ```text dev.pachca.com/api/messages/create → pachca messages create ``` ```text dev.pachca.com/api/chats/list → pachca chats list ``` ```text dev.pachca.com/api/members/add → pachca members add ``` -------------------------------- ### Example Workflows: Active Chats Source: https://dev.pachca.com/guides/cli/workflows This example shows how to find and execute a workflow for finding active chats within a specified period. It involves listing chats with a filter for the last message timestamp. ```bash pachca guide "active chats" # Workflow: Find active chats for a period (pachca-chats) # # 1. $ pachca chats list --last-message-at-after= --all ``` -------------------------------- ### Make a Profile GET Request Source: https://dev.pachca.com/guides/sdk/typescript Use the client to fetch the user's profile information. This example demonstrates calling the `getProfile` method. ```typescript // Получение профиля const response = client.profile.getProfile() // → User({ id: number, firstName: string, lastName: string | null, nickname: string, email: string | null, phoneNumber: string | null, department: string | null, title: string | null, role: UserRole, suspended: boolean, inviteStatus: InviteStatus, inviterId: number | null, listTags: string[], customProperties: CustomProperty({ id: number, name: string, dataType: CustomPropertyDataType, value: string })[], userStatus: UserStatus({ emoji: string, title: string, expiresAt: string | null, isAway: boolean, awayMessage: UserStatusAwayMessage({ text: string }) | null }) | null, bot: boolean, sso: boolean, createdAt: string, lastActivityAt: string | null, timeZone: string | null, imageUrl: string | null }) ``` -------------------------------- ### List Users with Go SDK Source: https://dev.pachca.com/guides/sdk/go Shows how to list users with optional query, limit, and cursor parameters. Requires initializing the Pachca client. ```go import pachca "github.com/pachca/openapi/sdk/go/generated" params := &ListUsersParams{ Query: Ptr("Олег"), Limit: Ptr(int32(1)), Cursor: Ptr("eyJpZCI6MTAsImRpciI6ImFzYyJ9"), } response, err := client.Users.ListUsers(ctx, params) // → ListUsersResponse{Data: []User, Meta: PaginationMeta} ``` -------------------------------- ### Create a Task using Go SDK Source: https://dev.pachca.com/guides/sdk/go Demonstrates creating a task with details like kind, content, due date, priority, performer IDs, and custom properties. Requires initializing the Pachca client. ```go import pachca "github.com/pachca/openapi/sdk/go/generated" request := TaskCreateRequest{ Task: TaskCreateRequestTask{ Kind: TaskKindReminder, Content: Ptr("Забрать со склада 21 заказ"), DueAt: Ptr("2020-06-05T12:00:00.000+03:00"), Priority: Ptr(int32(2)), PerformerIDs: []int32{int32(123)}, ChatID: Ptr(int32(456)), AllDay: Ptr(false), CustomProperties: []TaskCreateRequestCustomProperty{TaskCreateRequestCustomProperty{ ID: int32(78), Value: "Синий склад", }}, }, } response, err := client.Tasks.CreateTask(ctx, request) // → Task{ID: int32, Kind: TaskKind, Content: string, DueAt: *string, Priority: int32, UserID: int32, ChatID: *int32, Status: TaskStatus, CreatedAt: string, PerformerIDs: []int32, AllDay: bool, CustomProperties: []CustomProperty{ID: int32, Name: string, DataType: CustomPropertyDataType, Value: string}} ``` -------------------------------- ### SDK Initialization Source: https://dev.pachca.com/guides/sdk/typescript Demonstrates how to initialize the PachcaClient with a token, and optionally with a custom base URL for the API. ```APIDOC ## Инициализация ```typescript import { PachcaClient } from "@pachca/sdk" // Стандартное подключение const client = new PachcaClient("YOUR_TOKEN") // С кастомным базовым URL const client = new PachcaClient("YOUR_TOKEN", "https://custom-api.example.com/api/shared/v1") ``` | Параметр | Тип | По умолчанию | Описание | |----------|-----|-------------|----------| | `token` | `string` | — | Bearer-токен для авторизации | | `baseUrl` | `string` | `https://api.pachca.com/api/shared/v1` | Базовый URL API | Клиент не требует явного закрытия — все запросы используют глобальный `fetch`. ``` -------------------------------- ### Search Pachca CLI Workflows Source: https://dev.pachca.com/guides/cli/workflows Use the `pachca guide` command with keywords to find relevant workflows. For example, search for workflows related to sending files or creating and managing chats. ```bash # Search for workflows by keywords pachca guide "send file" pachca guide "create a chat and add participants" ``` ```bash # List all workflows pachca guide ``` -------------------------------- ### Make a First Request Source: https://dev.pachca.com/guides/cli/overview Execute a basic command like `pachca users list` to fetch user data. The output is typically tabular, showing ID, Name, Email, and Role. ```bash pachca users list # ID Имя Email Роль # 1234 Иван Иванов ivan@company.ru admin # 5678 Мария Петрова maria@company.ru user ``` -------------------------------- ### Get API Method Description, Spec, Docs in CLI Source: https://dev.pachca.com/updates/season/spring-2026 Retrieve detailed information about a specific API method, including parameters, body, schema, and examples. This command leverages the OpenAPI specification for accuracy. ```bash pachca api <МЕТОД> <путь> --describe ``` ```bash pachca api <МЕТОД> <путь> --spec ``` ```bash pachca api <МЕТОД> <путь> --docs ``` -------------------------------- ### List Chats Request Example Source: https://dev.pachca.com/api/chats/list Use this cURL command to list chats. You can filter by date range, membership, and sort the results. Remember to replace YOUR_ACCESS_TOKEN with your actual token. The `cursor` from `meta.paginate.next_page` should be used for subsequent requests to get the next page of results. ```bash # Для получения следующей страницы используйте cursor из meta.paginate.next_page curl "https://api.pachca.com/api/shared/v1/chats?sort=id&order=desc&availability=is_member&last_message_at_after=2025-01-01T00:00:00.000Z&last_message_at_before=2025-02-01T00:00:00.000Z&personal=false&limit=1" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` -------------------------------- ### Search Users API Request Source: https://dev.pachca.com/api/search/list-users Use this example to perform a full-text search for users. It demonstrates how to specify search query, limit results, sort, filter by creation date, and filter by company roles. Remember to replace YOUR_ACCESS_TOKEN with your actual token. ```bash # Для получения следующей страницы используйте cursor из meta.paginate.next_page curl "https://api.pachca.com/api/shared/v1/search/users?query=Олег&limit=10&sort=by_score&order=desc&created_from=2025-01-01T00:00:00.000Z&created_to=2025-02-01T00:00:00.000Z&company_roles[]=admin&company_roles[]=user" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` -------------------------------- ### Incoming JSON Example Source: https://dev.pachca.com/guides/incoming-webhooks This is an example of the JSON structure that can be sent to the webhook. ```json { "client": "Иван Петров", "amount": 15000, "status": "оплачен", "project": { "name": "Pachca" } } ``` -------------------------------- ### Create a Task using Pachca SDK Source: https://dev.pachca.com/guides/sdk/python Example of creating a task with details like kind, content, due date, priority, performer IDs, and custom properties. Ensure the PachcaClient is initialized. ```python from pachca.client import PachcaClient from pachca.models import Button, FileType, ListUsersParams, MessageCreateRequest, MessageCreateRequestFile, MessageCreateRequestMessage, MessageEntityType, TaskCreateRequest, TaskCreateRequestCustomProperty, TaskCreateRequestTask, TaskKind client = PachcaClient("YOUR_TOKEN") # Создание задачи request = TaskCreateRequest( task=TaskCreateRequestTask( kind=TaskKind.REMINDER, content="Забрать со склада 21 заказ", due_at=datetime.fromisoformat("2020-06-05T12:00:00.000+03:00"), priority=2, performer_ids=[123], chat_id=456, all_day=False, custom_properties=[TaskCreateRequestCustomProperty(id=78, value="Синий склад")] ) ) response = await client.tasks.create_task(request=request) # → Task(id: int, kind: TaskKind, content: str, due_at: datetime | None, priority: int, user_id: int, chat_id: int | None, status: TaskStatus, created_at: datetime, performer_ids: list[int], all_day: bool, custom_properties: list[CustomProperty(id: int, name: str, data_type: CustomPropertyDataType, value: str)]) ``` -------------------------------- ### Send a Message using Go SDK Source: https://dev.pachca.com/guides/sdk/go Demonstrates how to send a message with various options including content, files, buttons, and parent message ID. Requires initializing the Pachca client. ```go import pachca "github.com/pachca/openapi/sdk/go/generated" client := pachca.NewPachcaClient("YOUR_TOKEN") // Отправка сообщения request := MessageCreateRequest{ Message: MessageCreateRequestMessage{ EntityType: Ptr(MessageEntityTypeDiscussion), EntityID: int32(334), Content: "Вчера мы продали 756 футболок (что на 10% больше, чем в прошлое воскресенье)", Files: []MessageCreateRequestFile{MessageCreateRequestFile{ Key: "attaches/files/93746/e354fd79-4f3e-4b5a-9c8d-1a2b3c4d5e6f/logo.png", Name: "logo.png", FileType: FileTypeImage, Size: int32(12345), Width: Ptr(int32(800)), Height: Ptr(int32(600)), DurationMs: Ptr(int32(5400)), Waveform: Ptr("4,8,12,20,16,10,6,3"), }}, Buttons: [][]Button{[]Button{Button{ Text: "Подробнее", URL: Ptr("https://example.com/details"), Data: Ptr("awesome"), }}}, ParentMessageID: Ptr(int32(194270)), DisplayAvatarURL: Ptr("https://example.com/avatar.png"), DisplayName: Ptr("Бот Поддержки"), SkipInviteMentions: Ptr(false), }, LinkPreview: Ptr(false), } response, err := client.Messages.CreateMessage(ctx, request) // → Message{ID: int32, EntityType: MessageEntityType, EntityID: int32, ChatID: int32, RootChatID: int32, Content: string, UserID: int32, CreatedAt: string, URL: string, Files: []File{ID: int32, Key: string, Name: string, FileType: FileType, URL: string, Width: *int32, Height: *int32}, VoiceContent: *VoiceContent{DurationMs: int32, Waveform: string, Transcript: *string}, Buttons: *[][]Button{Text: string, URL: *string, Data: *string}, Thread: *MessageThread{ID: int64, ChatID: int64}, Forwarding: *Forwarding{OriginalMessageID: int32, OriginalChatID: int32, AuthorID: int32, OriginalCreatedAt: string, OriginalThreadID: *int32, OriginalThreadMessageID: *int32, OriginalThreadParentChatID: *int32}, ParentMessageID: *int32, DisplayAvatarURL: *string, DisplayName: *string, ChangedAt: *string, DeletedAt: *string} ``` -------------------------------- ### Get Profile Source: https://dev.pachca.com/guides/sdk/typescript Make a request to get the user's profile information. ```APIDOC ## Get Profile ### Description Retrieve the current user's profile information using the `getProfile` method. ### Method ```typescript client.profile.getProfile() ``` ### Response Type ```typescript User({ id: number, firstName: string, lastName: string | null, nickname: string, email: string | null, phoneNumber: string | null, department: string | null, title: string | null, role: UserRole, suspended: boolean, inviteStatus: InviteStatus, inviterId: number | null, listTags: string[], customProperties: CustomProperty({ id: number, name: string, dataType: CustomPropertyDataType, value: string })[], userStatus: UserStatus({ emoji: string, title: string, expiresAt: string | null, isAway: boolean, awayMessage: UserStatusAwayMessage({ text: string }) | null }) | null, bot: boolean, sso: boolean, createdAt: string, lastActivityAt: string | null, timeZone: string | null, imageUrl: string | null }) ``` ``` -------------------------------- ### Initialize Pachca Client and Create Message (Go) Source: https://dev.pachca.com/llms.txt Illustrates initializing the Pachca client with a token and calling the `CreateMessage` method for the Messages service in Go. Requires a context object for the call. ```go NewPachcaClient("TOKEN") → client.Messages.CreateMessage(ctx, ...) ``` -------------------------------- ### Creating a Task with Pachca SDK Source: https://dev.pachca.com/guides/sdk/typescript Example of creating a task, specifying its kind, content, due date, priority, performer IDs, and custom properties. Ensure the PachcaClient is initialized. ```typescript // Создание задачи const request: TaskCreateRequest = { task: { kind: TaskKind.Reminder, content: "Забрать со склада 21 заказ", dueAt: "2020-06-05T12:00:00.000+03:00", priority: 2, performerIds: [123], chatId: 456, allDay: false, customProperties: [{ id: 78, value: "Синий склад" }] } } const response = client.tasks.createTask(request) // → Task({ id: number, kind: TaskKind, content: string, dueAt: string | null, priority: number, userId: number, chatId: number | null, status: TaskStatus, createdAt: string, performerIds: number[], allDay: boolean, customProperties: CustomProperty({ id: number, name: string, dataType: CustomPropertyDataType, value: string })[] }) ``` -------------------------------- ### Initialize Pachca Client and Create Message (C#) Source: https://dev.pachca.com/llms.txt Shows how to initialize the Pachca client with a token and call the `CreateMessageAsync` method for the Messages service in C#. This example uses asynchronous programming patterns. ```csharp new PachcaClient("TOKEN") → await client.Messages.CreateMessageAsync(...) ``` -------------------------------- ### Initialize PachcaClient in C# Source: https://dev.pachca.com/guides/sdk/csharp Create an instance of the PachcaClient by providing your API token. Ensure you obtain your API token from Pachca's settings. ```csharp using Pachca.Sdk; using var client = new PachcaClient("YOUR_TOKEN"); ``` -------------------------------- ### Get Own Status Source: https://dev.pachca.com/pachca.postman_collection.json Retrieves the current user's status information using a GET request. ```http GET {{baseUrl}}/profile/status ``` -------------------------------- ### Get Own Profile Source: https://dev.pachca.com/pachca.postman_collection.json Retrieves the current user's profile information using a GET request. ```http GET {{baseUrl}}/profile ``` -------------------------------- ### Initialize Pachca Client and Create Message (Python) Source: https://dev.pachca.com/llms.txt Shows how to initialize the Pachca client with a token and use the `create_message` method for the messages service in Python. This example uses asynchronous calls. ```python PachcaClient("TOKEN") → await client.messages.create_message(...) ``` -------------------------------- ### List Method Response Example Source: https://dev.pachca.com/api/pagination Example of a response from a list method including the pagination meta object. ```APIDOC ```json title="Пример ответа списочного метода" { "data": [{ "id": 1, "...": "..." }, { "id": 2, "...": "..." }], "meta": { "paginate": { "next_page": "eyJpZCI6MTAsIl9rZCI6Im4ifQ", "prev_page": "eyJpZCI6MSwgIl9rZCI6InAifQ", "has_next": true, "has_prev": false } } } ``` ``` -------------------------------- ### Manual Pagination Example Source: https://dev.pachca.com/guides/sdk/typescript Demonstrates how to manually paginate through results, typically used for fetching large datasets in chunks. ```APIDOC ## Manual Pagination ### Description This example shows how to manually iterate through paginated results using cursors. It's useful when you need fine-grained control over fetching data page by page. ### Usage ```typescript let cursor: string | undefined let hasNext = true while (hasNext) { const response = await client.users.listUsers({ limit: 50, cursor }) for (const user of response.data) { console.log(user.firstName, user.lastName) } cursor = response.meta.paginate.nextPage hasNext = response.meta.paginate.hasNext } ``` ### Notes - The `cursor` is used to fetch the next set of results. - The loop continues as long as `hasNext` is true, indicating more pages are available. - The `meta.paginate` object contains `nextPage` and `hasNext` properties for controlling the pagination flow. ``` -------------------------------- ### Get Chat by ID Source: https://dev.pachca.com/guides/sdk/typescript Use this method to retrieve a specific chat by its unique identifier. This is a simple GET request. ```typescript // Получение чата const response = client.chats.getChat(334) // → Chat({ id: number, name: string, createdAt: string, ownerId: number, memberIds: number[], groupTagIds: number[], channel: boolean, personal: boolean, public: boolean, lastMessageAt: string, meetRoomUrl: string }) ``` -------------------------------- ### Approval Buttons Example Source: https://dev.pachca.com/guides/n8n/workflows Example JSON structure for creating buttons with text and associated data for user interaction in messages. ```json [ [ { "text": "Согласовать", "data": "approve" }, { "text": "Отклонить", "data": "reject" } ] ] ``` -------------------------------- ### n8n Node - Bot Create and Get Operations Source: https://dev.pachca.com/updates/season/summer-2026 New operations for creating and getting bot information in the n8n Node. ```APIDOC ## Bot: Create and Get Operations (n8n Node) ### Description New operations for creating bots and retrieving bot information. ### Operations - **Create Bot** - **Get Bot** ``` -------------------------------- ### Create User with Chat IDs and Role (CLI) Source: https://dev.pachca.com/updates/season/spring-2026 Create a new user and assign them to specific chats upon creation. The 'guest' role requires a single active chat ID. ```bash pachca users create --chat-ids --role guest ``` -------------------------------- ### Add Agent Skills Source: https://dev.pachca.com/guides/ai-agents/overview Use this command to automatically detect and connect agent skills compatible with your installed agents. Ensure you have the Skills CLI installed. ```bash npx skills add pachca/openapi ``` -------------------------------- ### SDK Initialization Source: https://dev.pachca.com/guides/sdk/kotlin Initialize the PachcaClient with your API token. You can also specify a custom base URL if needed. Remember to close the client after use. ```APIDOC ## Initialization ```kotlin import com.pachca.sdk.PachcaClient // Standard connection val client = PachcaClient("YOUR_TOKEN") // With a custom base URL val client = PachcaClient("YOUR_TOKEN", "https://custom-api.example.com/api/shared/v1") ``` | Parameter | Type | Default | Description | |---|---|---|---| | `token` | `String` | — | Bearer token for authorization | | `baseUrl` | `String` | `https://api.pachca.com/api/shared/v1` | Base URL of the API | The client implements `Closeable` – close it after use: ```kotlin client.use { c -> val profile = c.profile.getProfile() println(profile.firstName) } // Or manually client.close() ``` ```