Skip to content

Discard a sequence draft

client.Sequence.DiscardDraft(ctx, id, body) (*SequenceDiscardDraftResponse, error)
POST/v1/sequences/{id}/draft/discard

Discards the open draft at expectedVersion. A published sequence keeps its published version. A sequence that has never been published is deleted with its draft, and sequenceDeleted is true. Returns 404 draft_not_found when no draft is open, and 409 when expectedVersion is not the open draft’s version; retrieve the draft and retry.

Required scope: sequences:update

Rate limit category: Write

ParametersExpand Collapse
id string

Unique identifier of the sequence.

body SequenceDiscardDraftParams
ExpectedVersion param.Field[string]

The open draft’s version as last read.

ReturnsExpand Collapse
type SequenceDiscardDraftResponse struct{…}
SequenceDeleted bool

True when the sequence had never been published, so discarding its only draft deleted it.

SequenceID string

The sequence whose draft was discarded.

Discard a sequence draft

package main

import (
  "context"
  "fmt"

  "github.com/Lightfld/lightfield-go"
  "github.com/Lightfld/lightfield-go/option"
)

func main() {
  client := githubcomlightfldlightfieldgo.NewClient(
    option.WithAPIKey("My API Key"),
  )
  sequenceDiscardDraftResponse, err := client.Sequence.DiscardDraft(
    context.TODO(),
    "id",
    githubcomlightfldlightfieldgo.SequenceDiscardDraftParams{
      ExpectedVersion: "expectedVersion",
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", sequenceDiscardDraftResponse.SequenceDeleted)
}
{
  "sequenceDeleted": true,
  "sequenceId": "sequenceId"
}
Returns Examples
{
  "sequenceDeleted": true,
  "sequenceId": "sequenceId"
}