Class DeepSeekRequest<T extends DeepSeekResponse<?>>

java.lang.Object
de.entwicklertraining.api.base.ApiRequest<T>
de.entwicklertraining.deepseek4j.DeepSeekRequest<T>
Direct Known Subclasses:
DeepSeekCompletionRequest, DeepSeekModelsRequest, DeepSeekUserBalanceRequest

public abstract class DeepSeekRequest<T extends DeepSeekResponse<?>> extends de.entwicklertraining.api.base.ApiRequest<T>
A generic request abstraction for DeepSeek calls (chat completions, etc.). Subclasses must provide: - the target URI (e.g. https://api.deepseek.com/chat/completions) - the HTTP method (POST, GET, ...) - the request body (JSON payload or null) - a factory method to create the corresponding response object
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected <Y extends de.entwicklertraining.api.base.ApiRequestBuilderBase<?,?>>
    DeepSeekRequest(Y builder)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    createResponse(byte[] responseBytes)
    If the request expects a binary response, implement this method to produce the DeepSeekResponse from raw bytes.
    abstract T
    createResponse(String responseBody)
     
    abstract String
    Returns the request body as a String (often JSON).
    byte[]
    If there's a binary body, override this.
    By default, we use "application/json".
    abstract String
    Returns the HTTP method (e.g.
    boolean
    If the request expects a binary response, override and return true.

    Methods inherited from class de.entwicklertraining.api.base.ApiRequest

    getAdditionalHeaders, getCaptureOnError, getCaptureOnSuccess, getIsCanceledSupplier, getMaxExecutionTimeInSeconds, getRelativeUrl, hasCaptureOnError, hasCaptureOnSuccess, setHeader

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DeepSeekRequest

      protected <Y extends de.entwicklertraining.api.base.ApiRequestBuilderBase<?,?>> DeepSeekRequest(Y builder)
  • Method Details

    • getHttpMethod

      public abstract String getHttpMethod()
      Returns the HTTP method (e.g. "POST" or "GET").
      Specified by:
      getHttpMethod in class de.entwicklertraining.api.base.ApiRequest<T extends DeepSeekResponse<?>>
    • getBody

      public abstract String getBody()
      Returns the request body as a String (often JSON). May be null if GET.
      Specified by:
      getBody in class de.entwicklertraining.api.base.ApiRequest<T extends DeepSeekResponse<?>>
    • createResponse

      public abstract T createResponse(String responseBody)
      Specified by:
      createResponse in class de.entwicklertraining.api.base.ApiRequest<T extends DeepSeekResponse<?>>
    • isBinaryResponse

      public boolean isBinaryResponse()
      If the request expects a binary response, override and return true. By default, this is false.
      Overrides:
      isBinaryResponse in class de.entwicklertraining.api.base.ApiRequest<T extends DeepSeekResponse<?>>
    • createResponse

      public T createResponse(byte[] responseBytes)
      If the request expects a binary response, implement this method to produce the DeepSeekResponse from raw bytes.
      Overrides:
      createResponse in class de.entwicklertraining.api.base.ApiRequest<T extends DeepSeekResponse<?>>
    • getContentType

      public String getContentType()
      By default, we use "application/json".
      Overrides:
      getContentType in class de.entwicklertraining.api.base.ApiRequest<T extends DeepSeekResponse<?>>
    • getBodyBytes

      public byte[] getBodyBytes()
      If there's a binary body, override this. Here it's unsupported.
      Overrides:
      getBodyBytes in class de.entwicklertraining.api.base.ApiRequest<T extends DeepSeekResponse<?>>