- Добавлен pydoc-markdown.yml для конфигурации генерации - Обновлён mkdocs.yml (убран mkdocstrings, упрощена конфигурация) - Добавлен скрипт scripts/gen_docs.py для автоматической генерации - Обновлены зависимости в pyproject.toml (dependency-groups вместо dev-dependencies) - Сгенерирована новая документация в docs/api_reference.md
1 line
10 KiB
JSON
1 line
10 KiB
JSON
{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"],"fields":{"title":{"boost":1000.0},"text":{"boost":1.0},"tags":{"boost":1000000.0}}},"docs":[{"location":"","title":"Kwork API Documentation","text":"<p>Unofficial Python client for Kwork.ru API.</p>"},{"location":"#quick-start","title":"Quick Start","text":""},{"location":"#installation","title":"Installation","text":"<pre><code>pip install kwork-api\n</code></pre>"},{"location":"#authentication","title":"Authentication","text":"<pre><code>from kwork_api import KworkClient\n\n# Login with credentials\nclient = await KworkClient.login(\"username\", \"password\")\n\n# Or restore from token\nclient = KworkClient(token=\"your_web_auth_token\")\n</code></pre>"},{"location":"#basic-usage","title":"Basic Usage","text":"<pre><code>async with KworkClient(token=\"token\") as client:\n # Get catalog\n catalog = await client.catalog.get_list(page=1)\n\n # Get kwork details\n details = await client.catalog.get_details(kwork_id=123)\n\n # Get projects\n projects = await client.projects.get_list()\n</code></pre>"},{"location":"#documentation-sections","title":"Documentation Sections","text":"<ul> <li>API Reference \u2014 All endpoints and methods</li> <li>Models \u2014 Pydantic models</li> <li>Errors \u2014 Exception classes</li> <li>Examples \u2014 Usage examples</li> </ul>"},{"location":"#features","title":"Features","text":"<ul> <li>\u2705 Full API coverage (45 endpoints)</li> <li>\u2705 Async/await support</li> <li>\u2705 Pydantic models for type safety</li> <li>\u2705 Clear error handling</li> <li>\u2705 Session management</li> </ul>"},{"location":"#rate-limiting","title":"Rate Limiting","text":"<p>Rate limiting is not implemented in the library. Handle it in your code:</p> <pre><code>import asyncio\n\nfor page in range(1, 10):\n catalog = await client.catalog.get_list(page=page)\n await asyncio.sleep(1) # 1 second delay\n</code></pre>"},{"location":"#error-handling","title":"Error Handling","text":"<pre><code>from kwork_api import KworkAuthError, KworkApiError\n\ntry:\n catalog = await client.catalog.get_list()\nexcept KworkAuthError as e:\n print(f\"Auth failed: {e}\")\nexcept KworkApiError as e:\n print(f\"API error [{e.status_code}]: {e.message}\")\n</code></pre> <p>Documentation auto-generated from source code.</p>"},{"location":"api-reference/","title":"API Reference","text":"<p>Auto-generated API documentation using mkdocstrings.</p>"},{"location":"api-reference/#client","title":"Client","text":"<p>::: kwork_api.client.KworkClient</p>"},{"location":"api-reference/#models","title":"Models","text":"<p>::: kwork_api.models.Kwork</p> <p>::: kwork_api.models.KworkDetails</p> <p>::: kwork_api.models.Project</p> <p>::: kwork_api.models.CatalogResponse</p>"},{"location":"api-reference/#errors","title":"Errors","text":"<p>::: kwork_api.errors.KworkError</p> <p>::: kwork_api.errors.KworkAuthError</p> <p>::: kwork_api.errors.KworkApiError</p>"},{"location":"examples/","title":"Usage Examples","text":""},{"location":"examples/#catalog","title":"Catalog","text":""},{"location":"examples/#get-catalog-list","title":"Get Catalog List","text":"<pre><code>from kwork_api import KworkClient\n\nasync with KworkClient(token=\"token\") as client:\n catalog = await client.catalog.get_list(page=1, category_id=5)\n\n for kwork in catalog.kworks:\n print(f\"{kwork.title}: {kwork.price} RUB\")\n\n # Pagination\n if catalog.pagination:\n print(f\"Page {catalog.pagination.current_page} of {catalog.pagination.total_pages}\")\n</code></pre>"},{"location":"examples/#get-kwork-details","title":"Get Kwork Details","text":"<pre><code>details = await client.catalog.get_details(kwork_id=123)\n\nprint(f\"Title: {details.title}\")\nprint(f\"Price: {details.price}\")\nprint(f\"Description: {details.full_description}\")\nprint(f\"Delivery: {details.delivery_time} days\")\n</code></pre>"},{"location":"examples/#projects","title":"Projects","text":""},{"location":"examples/#get-projects-list","title":"Get Projects List","text":"<pre><code>projects = await client.projects.get_list(page=1)\n\nfor project in projects.projects:\n print(f\"{project.title} - {project.budget} RUB\")\n</code></pre>"},{"location":"examples/#get-customer-orders","title":"Get Customer Orders","text":"<pre><code>orders = await client.projects.get_payer_orders()\n\nfor order in orders:\n print(f\"Order #{order.id}: {order.status}\")\n</code></pre>"},{"location":"examples/#get-performer-orders","title":"Get Performer Orders","text":"<pre><code>orders = await client.projects.get_worker_orders()\n\nfor order in orders:\n print(f\"Work #{order.id}: {order.status}\")\n</code></pre>"},{"location":"examples/#user","title":"User","text":""},{"location":"examples/#get-user-info","title":"Get User Info","text":"<pre><code>user_info = await client.user.get_info()\nprint(f\"Username: {user_info.get('username')}\")\n</code></pre>"},{"location":"examples/#get-reviews","title":"Get Reviews","text":"<pre><code>reviews = await client.user.get_reviews(page=1)\n\nfor review in reviews.reviews:\n print(f\"Rating: {review.rating}/5 - {review.comment}\")\n</code></pre>"},{"location":"examples/#get-favorite-kworks","title":"Get Favorite Kworks","text":"<pre><code>favorites = await client.user.get_favorite_kworks()\n\nfor kwork in favorites:\n print(f\"Favorite: {kwork.title}\")\n</code></pre>"},{"location":"examples/#reference-data","title":"Reference Data","text":""},{"location":"examples/#get-cities","title":"Get Cities","text":"<pre><code>cities = await client.reference.get_cities()\n\nfor city in cities:\n print(f\"{city.id}: {city.name}\")\n</code></pre>"},{"location":"examples/#get-countries","title":"Get Countries","text":"<pre><code>countries = await client.reference.get_countries()\n\nfor country in countries:\n print(f\"{country.id}: {country.name}\")\n</code></pre>"},{"location":"examples/#get-timezones","title":"Get Timezones","text":"<pre><code>timezones = await client.reference.get_timezones()\n\nfor tz in timezones:\n print(f\"{tz.id}: {tz.name} ({tz.offset})\")\n</code></pre>"},{"location":"examples/#notifications","title":"Notifications","text":""},{"location":"examples/#get-notifications","title":"Get Notifications","text":"<pre><code>notifications = await client.notifications.get_list()\n\nfor notif in notifications.notifications:\n print(f\"{notif.title}: {notif.message}\")\n\nprint(f\"Unread: {notifications.unread_count}\")\n</code></pre>"},{"location":"examples/#fetch-new-notifications","title":"Fetch New Notifications","text":"<pre><code>new_notifications = await client.notifications.fetch()\nprint(f\"New: {len(new_notifications.notifications)}\")\n</code></pre>"},{"location":"examples/#get-dialogs","title":"Get Dialogs","text":"<pre><code>dialogs = await client.notifications.get_dialogs()\n\nfor dialog in dialogs:\n print(f\"Dialog with {dialog.participant.username}: {dialog.last_message}\")\n</code></pre>"},{"location":"examples/#error-handling","title":"Error Handling","text":"<pre><code>from kwork_api import KworkAuthError, KworkApiError, KworkNotFoundError\n\ntry:\n catalog = await client.catalog.get_list()\nexcept KworkAuthError as e:\n print(f\"Authentication failed: {e}\")\nexcept KworkNotFoundError as e:\n print(f\"Resource not found: {e}\")\nexcept KworkApiError as e:\n print(f\"API error [{e.status_code}]: {e.message}\")\nexcept Exception as e:\n print(f\"Unexpected error: {e}\")\n</code></pre>"},{"location":"examples/#rate-limiting","title":"Rate Limiting","text":"<pre><code>import asyncio\n\nasync def fetch_all_pages():\n all_kworks = []\n\n for page in range(1, 10):\n try:\n catalog = await client.catalog.get_list(page=page)\n all_kworks.extend(catalog.kworks)\n\n if not catalog.pagination or not catalog.pagination.has_next:\n break\n\n # Delay to avoid rate limiting\n await asyncio.sleep(1)\n\n except KworkRateLimitError:\n print(\"Rate limited, waiting...\")\n await asyncio.sleep(5)\n\n return all_kworks\n</code></pre>"},{"location":"examples/#pagination-helper","title":"Pagination Helper","text":"<pre><code>async def fetch_all_catalog():\n \"\"\"Fetch all kworks from catalog with pagination.\"\"\"\n all_kworks = []\n page = 1\n\n while True:\n catalog = await client.catalog.get_list(page=page)\n all_kworks.extend(catalog.kworks)\n\n if not catalog.pagination or not catalog.pagination.has_next:\n break\n\n page += 1\n await asyncio.sleep(0.5) # Rate limiting\n\n return all_kworks\n</code></pre> <p>More examples in the API Reference.</p>"},{"location":"api/client/","title":"Client API","text":"<p>::: kwork_api.client.KworkClient options: show_root_heading: true show_source: true merge_init_into_class: true</p>"},{"location":"api/errors/","title":"Errors","text":"<p>Exception classes for error handling.</p>"},{"location":"api/errors/#kworkerror","title":"KworkError","text":"<p>::: kwork_api.errors.KworkError</p>"},{"location":"api/errors/#kworkautherror","title":"KworkAuthError","text":"<p>::: kwork_api.errors.KworkAuthError</p>"},{"location":"api/errors/#kworkapierror","title":"KworkApiError","text":"<p>::: kwork_api.errors.KworkApiError</p>"},{"location":"api/errors/#kworknotfounderror","title":"KworkNotFoundError","text":"<p>::: kwork_api.errors.KworkNotFoundError</p>"},{"location":"api/errors/#kworkratelimiterror","title":"KworkRateLimitError","text":"<p>::: kwork_api.errors.KworkRateLimitError</p>"},{"location":"api/models/","title":"Models","text":"<p>Pydantic models used in API responses.</p>"},{"location":"api/models/#kwork","title":"Kwork","text":"<p>::: kwork_api.models.Kwork</p>"},{"location":"api/models/#kworkdetails","title":"KworkDetails","text":"<p>::: kwork_api.models.KworkDetails</p>"},{"location":"api/models/#project","title":"Project","text":"<p>::: kwork_api.models.Project</p>"},{"location":"api/models/#catalogresponse","title":"CatalogResponse","text":"<p>::: kwork_api.models.CatalogResponse</p>"},{"location":"api/models/#paginationinfo","title":"PaginationInfo","text":"<p>::: kwork_api.models.PaginationInfo</p>"}]} |