Allmine API
Live Stream

For You live streams — mobil ve web

For You feed client entegrasyonu

For You Live Streams - Mobil/Web Endpoint Dokumani

Migration rehberi

Yapılandırma sırası için Migration şablonu. Yeni düzenlemelerde Amaç → Önkoşullar → Endpoint → Request/Response → Hata kodları → Client adımları → İlgili sayfalar bölümlerini tercih edin.

Bu doküman mobil ve web istemcilerinin For You yayin alanlari için kullanacagi endpoint sozlesmesini anlatır. Dokuman UI implementasyonu veya RTK Query kodu anlatmaz; endpointler, query parametreleri, response yapisi ve backend filtre mantigini ozetler.

For You tek bir response değildir. Mobil/web tarafında 3 ayri bolum 3 ayri endpointten beslenir:

  • Live
  • Scheduled
  • Crowdfunding

Genel Backend Mantigi

Backend her istekte JWT token'dan current user'i bulur ve kullanıcının interests alanini okur.

  • Kaynak alan: User.interests
  • Yayin eslesmesi: LiveStream.interest in user.interests
  • Tüm listelerde soft delete edilmis yayinlar haric tutulur: deletedAt: null
  • Duplicate interest degerleri backend tarafında tekillestirilir.
  • Kullanıcı interest listesi bos ise endpoint bos sayfali liste döner.
  • Response içindeki role alani istek atan kullanıcıya gore hesaplanır: host, guest, audience veya null.

Ortak Bilgiler

Base path:

/api/v1/live-stream

Auth:

Authorization: Bearer <JWT>

Bu endpointler public değildir. Kullanıcı token'i zorunludur.

Ortak query parametreleri:

ParametreTipDefaultLimitAciklama
pagenumber1min 1Sayfa numarasi
limitnumber10max 100Sayfa basina yayin sayisi

Backend page <= 0 değerlerini 1, limit <= 0 değerlerini 10, limit > 100 değerlerini 100 olarak normalize eder.

Base Response

Tüm endpointler global response wrapper ile döner:

type BaseResponseDto<T> = {
  isSuccess: boolean;
  statusCode: number;
  data: T;
  errors?: string[];
  timestamp: string;
};

Bu endpointlerde data tipi her zaman:

type PaginatedResponseDto<T> = {
  list: T[];
  pagination: PaginationDto;
};

type PaginationDto = {
  currentPage: number;
  totalPages: number;
  totalItems: number;
  itemsPerPage: number;
  hasNextPage?: boolean;
  hasPrevPage?: boolean;
};

Live Endpoint

Request

GET /api/v1/live-stream/for-you/live?page=1&limit=10
Authorization: Bearer <JWT>

Amac

Kullaniçinin interestlerine uyan aktif yayinlari getirir.

Backend Filtre Mantigi

{
  deletedAt: null,
  status: 'active',
  interest: { $in: currentUser.interests }
}

Siralama:

{ startedAt: -1, createdAt: -1 }

Response

data: PaginatedResponseDto<LiveStreamResponseDto>

Bu listede beklenen yayinlar:

  • status = active
  • interest kullanıcının interest listesinde
  • En yeni baslayan yayinlar once

Scheduled Endpoint

Request

GET /api/v1/live-stream/for-you/scheduled?page=1&limit=10
Authorization: Bearer <JWT>

Amac

Kullaniçinin interestlerine uyan planli veya hazirlanma durumundaki yayinlari getirir.

Backend Filtre Mantigi

{
  deletedAt: null,
  status: { $in: ['scheduled', 'preparing'] },
  interest: { $in: currentUser.interests },
  plannedStartDate: { $ne: null },
  $or: [
    { liveStreamType: { $ne: 'duocrowd' } },
    {
      liveStreamType: 'duocrowd',
      $expr: {
        $gte: [
          { $ifNull: ['$collectedFunding', 0] },
          { $ifNull: ['$fundingGoal', 0] }
        ]
      }
    }
  ]
}

Siralama:

{ plannedStartDate: 1, createdAt: -1 }

Response

data: PaginatedResponseDto<LiveStreamResponseDto>

Bu listede beklenen yayinlar:

  • status = scheduled veya status = preparing
  • liveStreamType = solo yayinlar
  • liveStreamType = duoself yayinlar
  • liveStreamType = duocrowd ve funding hedefi tamamlanmis yayinlar

Bu listede beklenmeyen yayinlar:

  • Hedefe ulasmamis duocrowd yayinlar. Bunlar crowdfunding endpointinde döner.

Crowdfunding Endpoint

Request

GET /api/v1/live-stream/for-you/crowdfunding?page=1&limit=10
Authorization: Bearer <JWT>

Amac

Kullaniçinin interestlerine uyan, funding hedefine henuz ulasmamis DuoCrowd yayinlari getirir.

Backend Filtre Mantigi

{
  deletedAt: null,
  status: 'scheduled',
  liveStreamType: 'duocrowd',
  interest: { $in: currentUser.interests },
  plannedStartDate: { $ne: null },
  $expr: {
    $lt: [
      { $ifNull: ['$collectedFunding', 0] },
      { $ifNull: ['$fundingGoal', 0] }
    ]
  }
}

Siralama:

{ plannedStartDate: 1, createdAt: -1 }

Response

data: PaginatedResponseDto<LiveStreamResponseDto>

Bu listede beklenen yayinlar:

  • status = scheduled
  • liveStreamType = duocrowd
  • collectedFunding < fundingGoal
  • interest kullanıcının interest listesinde

LiveStreamResponseDto

Endpointlerin list alanindaki item yapisi:

type LiveStreamResponseDto = {
  id: string;
  title: string;
  liveStreamType: 'solo' | 'duocrowd' | 'duoself';
  channelName: string;

  broadcasters: Array<{
    user: string;
    role: 'host' | 'guest';
    uid?: number | null;
    hasJoined: boolean;
  }>;

  guests: UserSummaryDto[];
  creator?: UserSummaryDto | null;

  thumbnailUrl?: string | null;
  recording: boolean;
  recordingUrl?: string | null;

  status:
    | 'active'
    | 'scheduled'
    | 'preparing'
    | 'ended'
    | 'expired'
    | 'cancelled_by_host'
    | 'cancelled_by_guest';

  accessType: 'free' | 'paid';
  price?: number;
  interest: string;

  durationGoal?: number | null;
  motivation?: string | null;

  startedAt?: string | null;
  plannedStartDate?: string | null;
  endedAt?: string | null;
  plannedEndDate?: string | null;

  fundingGoal?: number | null;
  collectedFunding?: number | null;
  fundingPercentage?: number | null;

  role: 'host' | 'guest' | 'audience' | null;
  miniCrowdFundings: MiniCrowdFundingResponseDto[];

  createdAt: string;
  updatedAt: string;
};

UserSummaryDto:

type UserSummaryDto = {
  _id: string;
  username?: string;
  name?: string | null;
  surname?: string | null;
  availabilityStatus?: string;
  profilePhoto?: {
    _id: string;
    url?: string;
    type?: string;
    variants?: Record<string, string>;
  } | null;
};

MiniCrowdFundingResponseDto:

type MiniCrowdFundingResponseDto = {
  status: string;
  duration: number | null;
  targetAmount: number;
  collectedAmount: number;
  startTime?: string | null;
  requestedBy?: string | null;
};

Ornek Response

{
  "isSuccess": true,
  "statusCode": 200,
  "data": {
    "list": [
      {
        "id": "664f0d9e2e6c8f4d5a123456",
        "title": "Muzik sohbeti",
        "liveStreamType": "solo",
        "channelName": "muzik-sohbeti-abc123",
        "broadcasters": [],
        "guests": [],
        "creator": {
          "_id": "664f0d9e2e6c8f4d5a999999",
          "username": "creator",
          "name": "Creator",
          "surname": null,
          "availabilityStatus": "available",
          "profilePhoto": null
        },
        "thumbnailUrl": "https://s.allminelive.com/interest-covers/interest-example-1.png",
        "recording": false,
        "recordingUrl": null,
        "status": "active",
        "accessType": "free",
        "price": 0,
        "interest": "music",
        "durationGoal": null,
        "motivation": null,
        "startedAt": "2026-05-11T10:00:00.000Z",
        "plannedStartDate": null,
        "endedAt": null,
        "plannedEndDate": null,
        "fundingGoal": null,
        "collectedFunding": null,
        "fundingPercentage": null,
        "role": "audience",
        "miniCrowdFundings": [],
        "createdAt": "2026-05-11T09:58:00.000Z",
        "updatedAt": "2026-05-11T10:00:00.000Z"
      }
    ],
    "pagination": {
      "currentPage": 1,
      "totalPages": 1,
      "totalItems": 1,
      "itemsPerPage": 10,
      "hasNextPage": false,
      "hasPrevPage": false
    }
  },
  "errors": [],
  "timestamp": "2026-05-11T10:01:00.000Z"
}

Bos Liste Response

Kullaniçinin interestlerine uygun yayin yoksa veya kullanıcının interest listesi bos ise:

{
  "isSuccess": true,
  "statusCode": 200,
  "data": {
    "list": [],
    "pagination": {
      "currentPage": 1,
      "totalPages": 0,
      "totalItems": 0,
      "itemsPerPage": 10,
      "hasNextPage": false,
      "hasPrevPage": false
    }
  },
  "errors": [],
  "timestamp": "2026-05-11T10:01:00.000Z"
}

Hata Response'lari

401 Unauthorized

Token yoksa, gecersizse veya suresi dolmussa:

{
  "isSuccess": false,
  "statusCode": 401,
  "data": null,
  "errors": ["auth.errors.authentication-required"],
  "timestamp": "2026-05-11T10:01:00.000Z"
}

403 Forbidden

Kullanıcı role guard'dan gecemezse:

{
  "isSuccess": false,
  "statusCode": 403,
  "data": null,
  "errors": ["Insufficient permissions"],
  "timestamp": "2026-05-11T10:01:00.000Z"
}

404 Not Found

JWT'deki kullanıcı ID'si ile kullanıcı bulunamazsa:

{
  "isSuccess": false,
  "statusCode": 404,
  "data": null,
  "errors": ["Kullanıcı bulunamadi"],
  "timestamp": "2026-05-11T10:01:00.000Z"
}

Mobil/Web Tuketim Notlari

  • 3 endpoint paralel cagrilabilir.
  • Her endpoint kendi pagination state'ine sahip olmalidir.
  • Live bolumunde startedAt ana zaman alanidir.
  • Scheduled ve Crowdfunding bolumlerinde plannedStartDate ana zaman alanidir.
  • Crowdfunding kartlarinda fundingGoal, collectedFunding, fundingPercentage alanlari kullanılmalıdır.
  • Bos liste gelirse ilgili bolum gizlenebilir.
  • Token yoksa endpointleri çağırmak yerine login/session akisi tetiklenmelidir.

Kabul Kontrolu

Mobil/web entegrasyonunda asagidaki davranislar dogrulanmalidir:

  1. for-you/live sadece active yayinlari listeler.
  2. for-you/scheduled hedefe ulasmis DuoCrowd yayinlari scheduled alaninda gösterir.
  3. for-you/scheduled hedefe ulasmamis DuoCrowd yayinlari göstermez.
  4. for-you/crowdfunding sadece hedefe ulasmamis scheduled DuoCrowd yayinlari listeler.
  5. Tüm listelerde yayin interest'i current user interestlerinden biridir.
  6. Pagination hasNextPage true ise sonraki sayfa ayni endpointten çekilir.

On this page