Auto-generated APIs

Based on the name of the schema, GraphQL APIs are automatically generated. Each query has fields defined in the schema. See fields section for details. The following generated queries and mutations are available for use:

Queries

  • <type_name>: return a single resource based on the provided resource ID.
  • <type_name>By: return a single resource based on the unique field value.
    To enable this query, you need to set unique and index as true in the field settings. See Supporting fields for more details.
  • <type_name>s: return multiple resources based on a search query (query), pagination parameters (from/size), and a sorting parameter (order).
  • <type_name>Permission: return permissions set in the resource based on the provided resource ID.

Mutations

Create, Update and Delete

  • create<type_name>: create the resource based on the values provided for each field.
  • update<type_name>: update the resource based on the provided resource ID and the values provided for each field.
  • delete<type_name>: delete the resource based on the provided resource ID.

Change Permission

  • change<type_name>: change the permission of the resource based on the provided resource ID and PermissionItemInput values for read, update, and delete actions. PermissionItemInput has a PermitEnum field that can be either allow or deny. See Permission for more details.

Example

As the example, if you specify this Report schema, the following queries and mutations API will be automatically generated based on the schema.

<span><span style="color: var(--shiki-color-text)">Report: tailordb.#Type </span><span style="color: var(--shiki-token-keyword)">&amp;</span><span style="color: var(--shiki-color-text)"> {</span></span>
<span><span style="color: var(--shiki-color-text)">  Fields: {</span></span>
<span><span style="color: var(--shiki-color-text)">    reportNo: {</span></span>
<span><span style="color: var(--shiki-color-text)">      Type:        tailordb.#TypeInt</span></span>
<span><span style="color: var(--shiki-color-text)">      Description: </span><span style="color: var(--shiki-color-text)">&quot;</span><span style="color: var(--shiki-token-string-expression)">Report number</span><span style="color: var(--shiki-color-text)">&quot;</span></span>
<span><span style="color: var(--shiki-color-text)">      Index:       </span><span style="color: var(--shiki-token-constant)">true</span></span>
<span><span style="color: var(--shiki-color-text)">      Unique:      </span><span style="color: var(--shiki-token-constant)">true</span></span>
<span><span style="color: var(--shiki-color-text)">    }</span></span>
<span><span style="color: var(--shiki-color-text)">    ...</span></span>
<span><span style="color: var(--shiki-color-text)">	}</span></span>
<span><span style="color: var(--shiki-color-text)">  ...</span></span>
<span><span style="color: var(--shiki-color-text)">}</span></span>
<span></span>

Queries

report
- Type
  - Report
- Arguments
  - id: ID!
reportBy
- Type
  - Report
- Arguments
  - id: ID
  - reportNo: Int
reports
- Type
  - ReportResult
- Arguments
  - from: Int
  - size: Int
  - query: ReportQueryInput
  - order: [ReportOrderInput]

Mutations

createReport
- Type
  - Report
- Arguments
  - id: ID
  - input: ReportCreateInput
deleteReport
- Type
  - Boolean
- Arguments
  - id: ID!
updateReport
- Type
  - Report
- Arguments
  - id: ID!
  - input: ReportUpdateInput
changeReport
- Type
  - Boolean
- Arguments
  - id: ID!
  - read: [PermissionItemInput]
  - update: [PermissionItemInput]
  - delete: [PermissionItemInput]

Besides basic CRUD operations, Aggregation, Bulk upsert and more available as Advanced APIs.