# Episodes_BatchSampleEpisodeSeries

`GET /v1/accounts/{account}/datasets/{dataset}/episodes:batchSampleSeries`

Several episodes' series at once, each as SampleEpisodeSeries samples it: what a dataset's trajectories read. The takes are read
together, so the artifacts they share are opened once and their reads
overlap; each take still answers on its own, so one that cannot be read
fails alone. Up to 50 takes, each an episode of the parent, and 20000
samples (the takes times max_points).

- Base URL: `https://junction-api.qualiastudios.dev`
- Authentication: an API key in the `X-API-Key` header

## Parameters

- `account` (path, string, required): The account id.
- `dataset` (path, string, required): The dataset id.
- `names` (query, array of string): The takes, 1 to 50, each an episode of the parent:
  accounts/{account}/datasets/{dataset}/episodes/{episode}. Answered in
  this order.
- `maxPoints` (query, integer (int32)): As SampleEpisodeSeriesRequest.max_points, for every take. The takes
  times max_points (400 when unset) are at most 20000: 50 takes at 400, or
  10 at 2000.
- `streams` (query, array of string (enum)): As SampleEpisodeSeriesRequest.streams, for every take.

  ```yaml
  type: array
  items:
    enum:
      - STREAM_UNSPECIFIED
      - STATE
      - ACTION
      - TCP
    type: string
    format: enum
  ```
- `version` (query, string): As SampleEpisodeSeriesRequest.version, for every take.

## Responses

- `200` OK: `application/json` `qualia.v1.BatchSampleEpisodeSeriesResponse`
- `default` Default error response: `application/json` `google.rpc.Status`

## Schemas

```yaml
qualia.v1.BatchSampleEpisodeSeriesResponse:
  type: object
  properties:
    results:
      type: array
      items:
        $ref: "#/components/schemas/qualia.v1.BatchSampleEpisodeSeriesResponse_Result"
      description: One per take asked, in the order asked.
  description: Response for Episodes.BatchSampleEpisodeSeries.
qualia.v1.BatchSampleEpisodeSeriesResponse_Result:
  type: object
  properties:
    name:
      type: string
      description: accounts/{account}/datasets/{dataset}/episodes/{episode}
    series:
      allOf:
        - $ref: "#/components/schemas/qualia.v1.SampleEpisodeSeriesResponse"
      description: Its series, as SampleEpisodeSeries answers; unset where it failed.
    errorCode:
      type: integer
      description: |-
        Where it failed, the gRPC status code SampleEpisodeSeries would have
        answered for this take, as google.rpc.Code numbers it (5 NOT_FOUND,
        9 FAILED_PRECONDITION, ...); 0 where it was read.
      format: int32
    errorMessage:
      type: string
      description: Where it failed, why; empty otherwise.
  description: One take's answer.
qualia.v1.SampleEpisodeSeriesResponse:
  type: object
  properties:
    timeSeconds:
      type: array
      items:
        type: number
        format: double
      description: |-
        Seconds from the first frame sampled, one per sample: a sample's second
        of the episode's recording is this plus window_start_seconds.
    channels:
      type: array
      items:
        $ref: "#/components/schemas/qualia.v1.SampleEpisodeSeriesResponse_Channel"
      description: Every channel the recording carries, on time_seconds.
    fps:
      type: number
      description: The recording's frames per second.
      format: double
    frameCount:
      type: string
      description: "Frames sampled: the take's, or what its applied trim keeps."
    unpublished:
      type: boolean
      description: |-
        True when the take is in no published version yet (a split child
        before its publish): it has no channels to sample.
    windowStartSeconds:
      type: number
      description: |-
        Where the first frame sampled sits in the episode's recording, in
        seconds of the recording (the clock its trim, subtasks and markers are
        in), on that frame: 0 until a trim is applied, the trim's start once one
        is; a split's piece is a recording of its own, so 0. Unset with
        unpublished.
      format: double
    windowEndSeconds:
      type: number
      description: |-
        Where the frames sampled end in the recording, in the same seconds: the
        end of the last one (window_start_seconds plus frame_count / fps).
        Unset with unpublished.
      format: double
  description: Response for Episodes.SampleEpisodeSeries.
qualia.v1.SampleEpisodeSeriesResponse_Channel:
  type: object
  properties:
    stream:
      enum:
        - STREAM_UNSPECIFIED
        - STATE
        - ACTION
        - TCP
      type: string
      description: Which vector.
      format: enum
    key:
      type: string
      description: |-
        Its positional key, "state[3]" or "action[3]"; the dataset's robot
        interface names the positions. A TCP channel is named, "left.tcp.x".
    values:
      type: array
      items:
        type: number
        format: double
      description: One value per sample; 0 where valid is false.
    valid:
      type: array
      items:
        type: boolean
      description: "Per sample: false where the recording holds no finite value."
  description: "One channel: one component of the state or the action vector."
google.rpc.Status:
  oneOf:
    - $ref: "#/components/schemas/ApiError"
    - $ref: "#/components/schemas/GatewayError"
  description: "The body of a failed call: one of the two shapes below."
ApiError:
  title: API error
  type: object
  required:
    - code
    - message
    - retryable
    - details
  properties:
    code:
      type: string
      description: The gRPC code name in upper case, e.g. `NOT_FOUND`.
    message:
      type: string
    retryable:
      type: boolean
      description: Whether the same call may succeed if retried.
    details:
      type: array
      items:
        type: object
      description: "Empty, except when a dataset copy or move is refused: then one `google.rpc.ErrorInfo` with the refusal's `reason` code, its `domain` and, in `metadata`, the datasets it names."
  description: A refusal from the API itself.
GatewayError:
  title: Gateway error
  type: object
  required:
    - detail
  properties:
    detail:
      type: string
      description: What went wrong.
  description: A refusal from the gateway before the call reaches the API, for example `401` bad or missing API key, `403` key lacks the scope or environment closed, `413` body too large.
```
