kwork-api/docs/api-reference.md
2026-03-23 03:26:21 +00:00

488 lines
6.4 KiB
Markdown

# API Reference
Auto-generated API documentation.
Last updated: kwork-api
---
## KworkClient
Kwork.ru API client.
Usage:
# Login with credentials
client = await KworkClient.login("username", "password")
# Or restore from token
client = KworkClient(token="your_web_auth_token")
# Make requests
catalog = await client.catalog.get_list(page=1)
### Methods
#### `catalog()`
Catalog API.
#### `projects()`
Projects API.
#### `user()`
User API.
#### `reference()`
Reference data API.
#### `notifications()`
Notifications API.
#### `other()`
Other endpoints.
---
## CatalogAPI
Catalog/Kworks API endpoints.
---
## ProjectsAPI
Projects (freelance orders) API endpoints.
---
## UserAPI
User API endpoints.
---
## ReferenceAPI
Reference data (cities, countries, etc.) endpoints.
---
## NotificationsAPI
Notifications and messages endpoints.
---
## OtherAPI
Other API endpoints.
---
# Models
Pydantic models used in API responses.
## KworkUser
User information.
### Fields
| Field | Type | Description |
|-------|------|-------------|
| `id` | - | - |
| `username` | - | - |
| `avatar_url` | - | - |
| `is_online` | - | - |
| `rating` | - | - |
---
## KworkCategory
Category information.
### Fields
| Field | Type | Description |
|-------|------|-------------|
| `id` | - | - |
| `name` | - | - |
| `slug` | - | - |
| `parent_id` | - | - |
---
## Kwork
Kwork (service) information.
### Fields
| Field | Type | Description |
|-------|------|-------------|
| `id` | - | - |
| `title` | - | - |
| `description` | - | - |
| `price` | - | - |
| `currency` | - | - |
| `category_id` | - | - |
| `seller` | - | - |
| `images` | - | - |
| `rating` | - | - |
| `reviews_count` | - | - |
| `created_at` | - | - |
| `updated_at` | - | - |
---
## KworkDetails
Extended kwork details.
### Fields
| Field | Type | Description |
|-------|------|-------------|
| `full_description` | - | - |
| `requirements` | - | - |
| `delivery_time` | - | - |
| `revisions` | - | - |
| `features` | - | - |
| `faq` | - | - |
---
## PaginationInfo
Pagination metadata.
### Fields
| Field | Type | Description |
|-------|------|-------------|
| `current_page` | - | - |
| `total_pages` | - | - |
| `total_items` | - | - |
| `items_per_page` | - | - |
| `has_next` | - | - |
| `has_prev` | - | - |
---
## CatalogResponse
Catalog response with kworks and pagination.
### Fields
| Field | Type | Description |
|-------|------|-------------|
| `kworks` | - | - |
| `pagination` | - | - |
| `filters` | - | - |
| `sort_options` | - | - |
---
## Project
Project (freelance order) information.
### Fields
| Field | Type | Description |
|-------|------|-------------|
| `id` | - | - |
| `title` | - | - |
| `description` | - | - |
| `budget` | - | - |
| `budget_type` | - | - |
| `category_id` | - | - |
| `customer` | - | - |
| `status` | - | - |
| `created_at` | - | - |
| `updated_at` | - | - |
| `bids_count` | - | - |
| `skills` | - | - |
---
## ProjectsResponse
Projects list response.
### Fields
| Field | Type | Description |
|-------|------|-------------|
| `projects` | - | - |
| `pagination` | - | - |
---
## Review
Review information.
### Fields
| Field | Type | Description |
|-------|------|-------------|
| `id` | - | - |
| `rating` | - | - |
| `comment` | - | - |
| `author` | - | - |
| `kwork_id` | - | - |
| `created_at` | - | - |
---
## ReviewsResponse
Reviews list response.
### Fields
| Field | Type | Description |
|-------|------|-------------|
| `reviews` | - | - |
| `pagination` | - | - |
| `average_rating` | - | - |
---
## Notification
Notification information.
### Fields
| Field | Type | Description |
|-------|------|-------------|
| `id` | - | - |
| `type` | - | - |
| `title` | - | - |
| `message` | - | - |
| `is_read` | - | - |
| `created_at` | - | - |
| `link` | - | - |
---
## NotificationsResponse
Notifications list response.
### Fields
| Field | Type | Description |
|-------|------|-------------|
| `notifications` | - | - |
| `unread_count` | - | - |
---
## Dialog
Dialog (chat) information.
### Fields
| Field | Type | Description |
|-------|------|-------------|
| `id` | - | - |
| `participant` | - | - |
| `last_message` | - | - |
| `unread_count` | - | - |
| `updated_at` | - | - |
---
## AuthResponse
Authentication response.
### Fields
| Field | Type | Description |
|-------|------|-------------|
| `success` | - | - |
| `user_id` | - | - |
| `username` | - | - |
| `web_auth_token` | - | - |
| `message` | - | - |
---
## ErrorDetail
Error detail from API.
### Fields
| Field | Type | Description |
|-------|------|-------------|
| `code` | - | - |
| `message` | - | - |
| `field` | - | - |
---
## APIErrorResponse
Standard API error response.
### Fields
| Field | Type | Description |
|-------|------|-------------|
| `success` | - | - |
| `errors` | - | - |
| `message` | - | - |
---
## City
City information.
### Fields
| Field | Type | Description |
|-------|------|-------------|
| `id` | - | - |
| `name` | - | - |
| `country_id` | - | - |
---
## Country
Country information.
### Fields
| Field | Type | Description |
|-------|------|-------------|
| `id` | - | - |
| `name` | - | - |
| `code` | - | - |
| `cities` | - | - |
---
## TimeZone
Timezone information.
### Fields
| Field | Type | Description |
|-------|------|-------------|
| `id` | - | - |
| `name` | - | - |
| `offset` | - | - |
---
## Feature
Feature/addon information.
### Fields
| Field | Type | Description |
|-------|------|-------------|
| `id` | - | - |
| `name` | - | - |
| `description` | - | - |
| `price` | - | - |
| `type` | - | - |
---
## Badge
User badge information.
### Fields
| Field | Type | Description |
|-------|------|-------------|
| `id` | - | - |
| `name` | - | - |
| `description` | - | - |
| `icon_url` | - | - |
---
## DataResponse
Generic data response wrapper.
### Fields
| Field | Type | Description |
|-------|------|-------------|
| `success` | - | - |
| `data` | - | - |
| `message` | - | - |
---
# Errors
Exception classes for error handling.
## KworkError
Base exception for all Kwork API errors.
---
## KworkAuthError
Authentication/authorization error.
---
## KworkApiError
API request error (4xx, 5xx).
---
## KworkNotFoundError
Resource not found (404).
---
## KworkRateLimitError
Rate limit exceeded (429).
---
## KworkValidationError
Validation error (400).
---
## KworkNetworkError
Network/connection error.
---