Class KeyRecord

java.lang.Object
ai.shipeasy.admin.model.KeyRecord

@Generated(value="org.openapitools.codegen.languages.JavaClientCodegen", comments="Generator version: 7.23.0") public class KeyRecord extends Object
A single API key as returned by the list endpoint. Response fields are snake_case. The raw token is never returned here — only its `last4` tail. `last4` and the typed `scopes` may be `null` for keys minted before those columns existed.
  • Field Details

  • Constructor Details

    • KeyRecord

      public KeyRecord()
  • Method Details

    • id

      public KeyRecord id(@Nonnull String id)
    • getId

      @Nonnull public String getId()
      Stable opaque key id (UUID). Use it to revoke the key.
      Returns:
      id
    • setId

      public void setId(@Nonnull String id)
    • type

      public KeyRecord type(@Nonnull KeyRecord.TypeEnum type)
    • getType

      @Nonnull public KeyRecord.TypeEnum getType()
      Key kind. `server` (back-end, full SDK auth), `client` (public, browser-embeddable), `admin` (CLI/devtools auth token), `ops` (restricted unattended-trigger credential).
      Returns:
      type
    • setType

      public void setType(@Nonnull KeyRecord.TypeEnum type)
    • env

      public KeyRecord env(@Nonnull KeyRecord.EnvEnum env)
    • getEnv

      @Nonnull public KeyRecord.EnvEnum getEnv()
      Environment the key is bound to. The worker derives the read env from the key, so this is the isolation boundary. `admin`/`ops` keys are env-agnostic and pinned to `prod`.
      Returns:
      env
    • setEnv

      public void setEnv(@Nonnull KeyRecord.EnvEnum env)
    • createdAt

      public KeyRecord createdAt(@Nonnull String createdAt)
    • getCreatedAt

      @Nonnull public String getCreatedAt()
      ISO-8601 timestamp the key was minted.
      Returns:
      createdAt
    • setCreatedAt

      public void setCreatedAt(@Nonnull String createdAt)
    • revokedAt

      public KeyRecord revokedAt(@Nullable String revokedAt)
    • getRevokedAt

      @Nullable public String getRevokedAt()
      ISO-8601 timestamp the key was revoked, or `null` while the key is active.
      Returns:
      revokedAt
    • setRevokedAt

      public void setRevokedAt(@Nullable String revokedAt)
    • expiresAt

      public KeyRecord expiresAt(@Nullable String expiresAt)
    • getExpiresAt

      @Nullable public String getExpiresAt()
      ISO-8601 expiry, or `null` for a key that never expires. `admin` keys are fixed at 90 days; `ops` keys use a short sliding window.
      Returns:
      expiresAt
    • setExpiresAt

      public void setExpiresAt(@Nullable String expiresAt)
    • createdByEmail

      public KeyRecord createdByEmail(@Nullable String createdByEmail)
    • getCreatedByEmail

      @Nullable public String getCreatedByEmail()
      Email of the human or actor that minted the key, or `null` when not attributable (e.g. CLI device-flow).
      Returns:
      createdByEmail
    • setCreatedByEmail

      public void setCreatedByEmail(@Nullable String createdByEmail)
    • name

      public KeyRecord name(@Nullable String name)
    • getName

      @Nullable public String getName()
      Human label for the key. `null` for unnamed dashboard mints; programmatic mints auto-name themselves.
      Returns:
      name
    • setName

      public void setName(@Nullable String name)
    • scopes

      public KeyRecord scopes(@Nullable List<String> scopes)
    • addScopesItem

      public KeyRecord addScopesItem(String scopesItem)
    • getScopes

      @Nullable public List<String> getScopes()
      Permission strings recorded on the key for audit/display, or `null` when none were set.
      Returns:
      scopes
    • setScopes

      public void setScopes(@Nullable List<String> scopes)
    • last4

      public KeyRecord last4(@Nullable String last4)
    • getLast4

      @Nullable public String getLast4()
      Last 4 characters of the raw token, so the dashboard mask is matchable against the held key. `null` for keys minted before this column.
      Returns:
      last4
    • setLast4

      public void setLast4(@Nullable String last4)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • validateJsonElement

      public static void validateJsonElement(com.google.gson.JsonElement jsonElement) throws IOException
      Validates the JSON Element and throws an exception if issues found
      Parameters:
      jsonElement - JSON Element
      Throws:
      IOException - if the JSON Element is invalid with respect to KeyRecord
    • fromJson

      public static KeyRecord fromJson(String jsonString) throws IOException
      Create an instance of KeyRecord given an JSON string
      Parameters:
      jsonString - JSON string
      Returns:
      An instance of KeyRecord
      Throws:
      IOException - if the JSON string is invalid with respect to KeyRecord
    • toJson

      public String toJson()
      Convert an instance of KeyRecord to an JSON string
      Returns:
      JSON string