package com.sjyt.icom.asst.service.httpapi;

import com.github.lianjiatech.retrofit.spring.boot.core.RetrofitClient;
import com.github.lianjiatech.retrofit.spring.boot.degrade.sentinel.SentinelDegrade;
import com.github.lianjiatech.retrofit.spring.boot.retry.Retry;
import com.sjyt.icom.asst.common.model.sdp.AnswerDto;
import com.sjyt.icom.asst.common.model.sdp.OfferDTO;
import com.sjyt.icom.asst.conf.decode.HttpErrorDecoder;
import com.sjyt.icom.asst.conf.fallback.SrsHttpDegradeFallbackFactory;
import retrofit2.http.Body;
import retrofit2.http.POST;

/**
 * @author: Tab
 * @date: 2022-06-12 11:16
 * @since 1.0.0
 */
@RetrofitClient(baseUrl = "${srs.url}",fallbackFactory = SrsHttpDegradeFallbackFactory.class,errorDecoder = HttpErrorDecoder.class)
@SentinelDegrade
@Retry(intervalMs = 300)
public interface SrsHttpApi {
  String PUBLISH ="rtc/v1/publish/";
  String PULL ="rtc/v1/play/";
  /**
   * 推流sdp
   * @param offerDto offer
   * @return r
   */
  @POST(PUBLISH)
  AnswerDto publish(@Body OfferDTO offerDto);

  /**
   * 拉流sdp
   * @param offerDto offer
   * @return r
   */
  @POST(PULL)
  AnswerDto pull(@Body OfferDTO offerDto);
}
