Tarkibga o'tish

Streamlar va Postlar API

Barcha endpointlar Authorization: Bearer <token> talab qiladi.


Umumiy ko'rinish

GET /api/v1/webnote/overview
Authorization: Bearer <token>

Javob:

{
  "ok": true,
  "my_streams": [...],
  "followed_streams": [...],
  "trending_streams": [...]
}


Streamlar

Stream yaratish

POST /api/v1/webnote/stream
Authorization: Bearer <token>
Content-Type: application/json
{
  "title": "Texnologiya yangiliklari",
  "description": "IT yangiliklari haqida kanal",
  "privacy": "public",
  "slug": "tech-news"
}
Maydon Turi Tavsif
title string Majburiy, maks. 100 belgi
description string Ixtiyoriy
privacy public / private Standart: public
slug string URL uchun noyob nom (harflar, raqamlar, tire)

Javob (201):

{
  "ok": true,
  "stream": {
    "id": 5,
    "title": "Texnologiya yangiliklari",
    "slug": "tech-news",
    "privacy": "public",
    "followers_count": 0
  }
}

Stream yangilash

PUT /api/v1/webnote/stream/<stream_id>
Authorization: Bearer <token>
Content-Type: application/json
{
  "title": "Yangi nom",
  "description": "Yangi tavsif",
  "privacy": "private"
}

Stream o'chirish

DELETE /api/v1/webnote/stream/<stream_id>
Authorization: Bearer <token>

Stream ma'lumotlari (slug bo'yicha)

GET /api/v1/webnote/stream/<slug>
Authorization: Bearer <token>

Stream kuzatuvchilari

GET /api/v1/webnote/stream/<slug>/followers
Authorization: Bearer <token>

O'z streamlari

GET /api/v1/webnote/streams
Authorization: Bearer <token>

Kuzatilayotgan streamlar

GET /api/v1/webnote/followed-streams
Authorization: Bearer <token>

Trend streamlar

GET /api/v1/webnote/trending-streams
Authorization: Bearer <token>

Stream kuzatish

Kuzatish / kuzatishni bekor qilish

POST /api/v1/webnote/follow
Authorization: Bearer <token>
Content-Type: application/json
{ "stream_id": 5 }

Agar foydalanuvchi allaqachon kuzatsa — kuzatishni bekor qiladi. Yopiq streamda — so'rov yuboradi.

Javob (public stream):

{ "ok": true, "following": true }

Javob (private stream):

{ "ok": true, "request_sent": true }

Kuzatish so'rovlari (stream egasi uchun)

GET /api/v1/webnote/follow-requests
Authorization: Bearer <token>

So'rovni qabul qilish

POST /api/v1/webnote/follow-requests/<request_id>/approve
Authorization: Bearer <token>

So'rovni rad etish

POST /api/v1/webnote/follow-requests/<request_id>/reject
Authorization: Bearer <token>

Postlar

Post yaratish

POST /api/v1/webnote/post
Authorization: Bearer <token>
Content-Type: application/json
{
  "stream_id": 5,
  "title": "Python 3.13 yangiliklari",
  "content": "<p>Python 3.13 da...</p>",
  "status": "published",
  "hashtags": ["python", "dasturlash"]
}
Maydon Turi Tavsif
stream_id integer Majburiy — post qaysi streamga tegishli
title string Majburiy, maks. 200 belgi
content string HTML matn, maks. 50 000 belgi
status published / draft Standart: draft
hashtags array Ixtiyoriy, maks. 10 ta

Javob (201):

{
  "ok": true,
  "post": {
    "id": 100,
    "title": "Python 3.13 yangiliklari",
    "status": "published",
    "stream": { "id": 5, "slug": "tech-news" },
    "created_at": "2026-06-11T10:00:00Z"
  }
}

Post yangilash

PUT /api/v1/webnote/post/<post_id>
Authorization: Bearer <token>
Content-Type: application/json

Post o'chirish

DELETE /api/v1/webnote/post/<post_id>
Authorization: Bearer <token>

Post ma'lumotlari

GET /api/v1/webnote/post/<post_id>
Authorization: Bearer <token>

Javob:

{
  "ok": true,
  "post": {
    "id": 100,
    "title": "Python 3.13 yangiliklari",
    "content": "<p>...</p>",
    "status": "published",
    "views": 1234,
    "likes_count": 56,
    "comments_count": 12,
    "is_liked": false,
    "author": { "id": 42, "username": "ali1234" },
    "stream": { "id": 5, "slug": "tech-news", "title": "Texnologiya" },
    "hashtags": ["python"],
    "created_at": "2026-06-11T10:00:00Z"
  }
}

Qoralamalar

GET /api/v1/webnote/drafts
Authorization: Bearer <token>

O'z chop etilgan postlari

GET /api/v1/webnote/my-posts
Authorization: Bearer <token>

Post layklari

POST /api/v1/webnote/post/<post_id>/like
Authorization: Bearer <token>

Agar layk allaqachon bo'lsa — o'chiriladi (toggle).

Javob:

{ "ok": true, "liked": true, "likes_count": 57 }


Post shikoyati

POST /api/v1/webnote/post/<post_id>/report
Authorization: Bearer <token>
Content-Type: application/json
{
  "reason": "spam",
  "comment": "Reklama xabari"
}
reason qiymatlari
spam
harassment
adult_content
misinformation
other

Sharhlar

Sharh yaratish

POST /api/v1/webnote/comment
Authorization: Bearer <token>
Content-Type: application/json
{
  "post_id": 100,
  "body": "Ajoyib maqola!",
  "parent_comment_id": null
}

parent_comment_id belgilansa — o'sha sharh ostiga reply bo'ladi.

Sharh o'chirish

DELETE /api/v1/webnote/comment/<comment_id>
Authorization: Bearer <token>

Sharhga layk

POST /api/v1/webnote/comment/<comment_id>/toggle-like
Authorization: Bearer <token>

Sharhga shikoyat

POST /api/v1/webnote/comment/<comment_id>/report
Authorization: Bearer <token>
Content-Type: application/json
{ "reason": "harassment" }

Qidiruv

GET /api/v1/search?q=<so'rov>&type=<tur>
Authorization: Bearer <token>
Parametr Tavsif
q Qidiruv so'rovi (majburiy)
type posts, streams, users — ko'rsatilmasa hammasi

Javob:

{
  "ok": true,
  "posts": [...],
  "streams": [...],
  "users": [...]
}


Asosiy lenta

GET /api/v1/home
Authorization: Bearer <token>

Kuzatilayotgan streamlar va personalizatsiya qilingan tavsiyalar asosida lenta qaytariladi.


Xato kodlari

Kod Sabab
stream_not_found Stream topilmadi
post_not_found Post topilmadi
not_stream_owner Siz bu streamning egasi emassiz
not_post_author Siz bu postning muallifi emassiz
stream_private Bu yopiq stream — kuzatish so'rovi kerak
already_following Allaqachon kuzatyapsiz
post_hidden Post moderatsiya tomonidan yashirilgan
duplicate_like Allaqachon layk qo'yilgan