kintone

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 22 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

kintone-go

pkg.go.dev

A Go client for the kintone REST API.

This is an unofficial client. The official SDK for kintone is kintone/js-sdk, which provides the REST API client for JavaScript as @kintone/rest-api-client.

Installation

go get github.com/itchyny/kintone-go

Usage

package main

import (
	"context"
	"fmt"
	"log"
	"os"

	"github.com/itchyny/kintone-go"
)

func main() {
	client, err := kintone.NewClient(
		"https://example.cybozu.com",
		kintone.WithAPIToken(os.Getenv("KINTONE_API_TOKEN")),
	)
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()

	app, err := client.GetApp(ctx, 1)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(app.Name)

	record, err := client.GetRecord(ctx, app.AppID, 1)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(record["title"].Value)
}
Authentication
Option Description
WithAPIToken(tokens...) API tokens. Specify multiple tokens to access multiple apps, such as on lookup fields.
WithPassword(username, password) Login name and password.
WithOAuthToken(token) OAuth access token.
WithBasicAuth(username, password) Basic authentication, required when the domain enables it.
Other options
Option Description
WithGuestSpace(id) Access apps in the guest space.
WithHTTPClient(httpClient) Use the HTTP client for requests.
WithUserAgent(userAgent) Set the User-Agent header.
WithAcceptLanguage(language) Set the Accept-Language header.
Records

A record is a map from the field code to the field. When reading records, the field value is decoded into the Go type of the field type, such as string, []string, kintone.Entity, []kintone.Entity, []kintone.FileInfo and []kintone.SubtableRow.

Example
record, err := client.GetRecord(ctx, app, id)
if err != nil {
	return err
}
title := record["title"].Value.(string)

res, err := client.GetRecords(ctx, kintone.GetRecordsRequest{
	App:    app,
	Fields: []string{"$id", "title"},
	Query:  `status in ("Open") order by $id asc limit 100`,
})
if err != nil {
	return err
}
for _, record := range res.Records {
	fmt.Println(record["$id"].Value, record["title"].Value)
}

kintone.Quote quotes a string value in a query, escaping double quotes and backslashes.

Example
res, err := client.GetRecords(ctx, kintone.GetRecordsRequest{
	App:   app,
	Query: "customer = " + kintone.Quote(customer),
})

When writing records, the field type can be omitted.

Example
added, err := client.AddRecord(ctx, app, kintone.Record{
	"title": {Value: "Hello"},
	"users": {Value: []kintone.Entity{{Code: "alice"}}},
})
if err != nil {
	return err
}

revision, err := client.UpdateRecord(ctx, app, kintone.RecordUpdate{
	ID:       added.ID,
	Record:   kintone.Record{"title": {Value: "Hello, world"}},
	Revision: added.Revision,
})
if err != nil {
	return err
}

err = client.DeleteRecords(ctx, app, []int64{added.ID}, []int64{revision})

AddRecords, UpdateRecords and UpsertRecords process multiple records in a request. UpdateRecord, UpdateRecords and UpsertRecords can also specify a record by the value of a field with UpdateKey instead of ID.

AllComments iterates over the comments on a record.

Example
if _, err := client.AddComment(ctx, app, id, "Hello"); err != nil {
	return err
}
for comment, err := range client.AllComments(ctx, kintone.GetCommentsRequest{App: app, Record: id}) {
	if err != nil {
		return err
	}
	fmt.Println(comment.Creator.Code, comment.Text)
}

UpdateStatus runs an action of the process management on a record, and UpdateAssignees changes the assignees.

Example
revision, err := client.UpdateStatus(ctx, app, kintone.StatusUpdate{
	ID:       id,
	Action:   "Submit",
	Assignee: "alice",
})
if err != nil {
	return err
}
_, err = client.UpdateAssignees(ctx, app, kintone.AssigneesUpdate{
	ID:        id,
	Assignees: []string{"bob"},
	Revision:  revision,
})
Cursor

AllRecords iterates over all the records matching the query using a cursor. The cursor is deleted when the iteration stops early.

Example
for record, err := range client.AllRecords(ctx, kintone.CreateCursorRequest{
	App:   app,
	Query: `status in ("Open") order by $id asc`,
}) {
	if err != nil {
		return err
	}
	fmt.Println(record["$id"].Value)
}

When kintone returns a warning in the X-Cybozu-Warning response header, AllRecords yields a *kintone.WarningError after all the records. GetRecords and CreateCursor return the warning in Warning of the response.

CreateCursor, GetRecordsByCursor and DeleteCursor are also available to use the cursor directly.

AllRecordsByID iterates over all the records in ascending order of the record ID without a cursor, using the condition on $id to get the next records.

Example
for record, err := range client.AllRecordsByID(ctx, kintone.AllRecordsByIDRequest{
	App:       app,
	Condition: `status in ("Open")`,
}) {
	if err != nil {
		return err
	}
	fmt.Println(record["$id"].Value)
}
Bulk request

NewBulkRequest sends multiple record operations in one request. The results are available from the values returned by the methods after Send. If a request in the bulk request fails, Send returns a *kintone.BulkError with the index of the request. Other errors are returned as is, and kintone.IsErrorCode works for both.

Example
bulk := client.NewBulkRequest()
added := bulk.AddRecord(app, kintone.Record{"title": {Value: "Hello"}})
bulk.UpdateStatus(app, kintone.StatusUpdate{ID: id, Action: "Submit"})
if err := bulk.Send(ctx); err != nil {
	return err
}
fmt.Println(added.Value().ID)

AddAllRecords, UpdateAllRecords, UpsertAllRecords and DeleteAllRecords process any number of records by splitting them into bulk requests, which are sent one after another. If a bulk request fails, they return a *kintone.AllRecordsError with the number of the records processed before it, and the methods other than DeleteAllRecords also return the results of those records.

Example
added, err := client.AddAllRecords(ctx, app, records)
if err != nil {
	var e *kintone.AllRecordsError
	if errors.As(err, &e) {
		fmt.Printf("%d records added before the error\n", e.Processed)
	}
	return err
}
fmt.Println(len(added))
Apps

App settings are changed in the preview environment, and deployed to the production environment by DeployApps. The getters of the settings get the production settings, or the preview settings with Preview: true.

Example
added, err := client.AddApp(ctx, kintone.AddAppRequest{Name: "Deals"})
if err != nil {
	return err
}
_, err = client.AddFormFields(ctx, added.App, map[string]kintone.FieldProperty{
	"title": {Type: kintone.FieldTypeSingleLineText, Code: "title", Label: "Title", Required: new(true)},
}, 0)
if err != nil {
	return err
}

settings, err := client.GetGeneralSettings(ctx, kintone.GetAppSettingsRequest{App: added.App, Preview: true})
if err != nil {
	return err
}
_, err = client.UpdateGeneralSettings(ctx, added.App, kintone.GeneralSettings{
	Description:    new("Deals and activities."),
	EnableComments: new(false),
}, settings.Revision)
if err != nil {
	return err
}

if err := client.DeployApps(ctx, []kintone.AppDeployment{{App: added.App}}); err != nil {
	return err
}
err = client.WaitForDeploy(ctx, []int64{added.App})

The other settings are got and updated in the same way: form fields and layout, views, graphs, admin notes, process management, JavaScript and CSS customization, plugins, notifications, permissions, actions and categories.

Example
views, err := client.GetViews(ctx, kintone.GetAppSettingsRequest{App: app, Preview: true})
if err != nil {
	return err
}
views.Views["Open deals"] = kintone.View{
	Type:       kintone.ViewTypeList,
	Name:       "Open deals",
	Index:      len(views.Views),
	Fields:     []string{"title", "status"},
	FilterCond: new(`status in ("Open")`),
}
_, err = client.UpdateViews(ctx, app, views.Views, views.Revision)

AllApps iterates over the apps.

Example
for app, err := range client.AllApps(ctx, kintone.GetAppsRequest{Name: "Deals"}) {
	if err != nil {
		return err
	}
	fmt.Println(app.AppID, app.Name)
}
Spaces

AddSpaceFromTemplate adds a space from a space template, and AddSpace adds a public single thread space by the name.

Example
space, err := client.GetSpace(ctx, spaceID)
if err != nil {
	return err
}

thread, err := client.AddThread(ctx, space.ID, "Weekly report")
if err != nil {
	return err
}
_, err = client.AddThreadComment(ctx, space.ID, thread, kintone.ThreadComment{
	Text:     "Please check the report.",
	Mentions: []kintone.Mention{{Code: "alice", Type: kintone.EntityTypeUser}},
})
if err != nil {
	return err
}

members, err := client.GetSpaceMembers(ctx, space.ID)
if err != nil {
	return err
}
members = slices.DeleteFunc(members, func(m kintone.SpaceMember) bool {
	return m.IsImplicit
})
members = append(members, kintone.SpaceMember{
	Entity: kintone.FieldEntity{Type: kintone.EntityTypeUser, Code: "bob"},
})
err = client.UpdateSpaceMembers(ctx, space.ID, members)

AddGuests adds guest users, and UpdateGuestMembers updates the guest members of a guest space.

Example
err := client.AddGuests(ctx, []kintone.Guest{{
	Code:     "guest@example.com",
	Password: password,
	Timezone: "Asia/Tokyo",
	Name:     "Guest",
}})
if err != nil {
	return err
}
err = client.UpdateGuestMembers(ctx, guestSpaceID, []string{"guest@example.com"})

To access the apps and the spaces in a guest space, create the client with kintone.WithGuestSpace.

Plugins
Example
f, err := os.Open("plugin.zip")
if err != nil {
	return err
}
defer f.Close()
fileKey, err := client.UploadFile(ctx, "plugin.zip", f)
if err != nil {
	return err
}
plugin, err := client.InstallPlugin(ctx, fileKey)
if err != nil {
	return err
}
if _, err := client.AddAppPlugins(ctx, app, []string{plugin.ID}, 0); err != nil {
	return err
}
err = client.DeployApps(ctx, []kintone.AppDeployment{{App: app}})
Files

UploadFile uploads a file and returns the file key, which can be set to an attachment field. DownloadFile downloads the file of the file key in an attachment field.

Example
f, err := os.Open("report.pdf")
if err != nil {
	return err
}
defer f.Close()
fileKey, err := client.UploadFile(ctx, "report.pdf", f)
if err != nil {
	return err
}
_, err = client.AddRecord(ctx, app, kintone.Record{
	"attachments": {Value: []kintone.FileInfo{{FileKey: fileKey}}},
})
if err != nil {
	return err
}

record, err := client.GetRecord(ctx, app, id)
if err != nil {
	return err
}
file := record["attachments"].Value.([]kintone.FileInfo)[0]
body, _, err := client.DownloadFile(ctx, file.FileKey)
if err != nil {
	return err
}
defer body.Close()
out, err := os.Create(file.Name)
if err != nil {
	return err
}
defer out.Close()
_, err = io.Copy(out, body)
API info

GetAPIs and GetAPISchema get the list of the kintone REST APIs and their JSON Schemas.

Example
apis, err := client.GetAPIs(ctx)
if err != nil {
	return err
}
for id := range apis.APIs {
	schema, err := client.GetAPISchema(ctx, id)
	if err != nil {
		return err
	}
	fmt.Println(id, schema.HTTPMethod, schema.Path)
}
Errors

Error responses from kintone are returned as *kintone.Error, which has the HTTP status code, the error code, the error ID, the message and the response header.

if kintone.IsErrorCode(err, "GAIA_RE01") {
	// the record is not found
}

Bug Tracker

Report bugs at Issues - itchyny/kintone-go - GitHub.

Author

itchyny (https://github.com/itchyny)

License

This software is released under the MIT License, see LICENSE.

Documentation

Overview

Package kintone provides a client for the kintone REST API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsErrorCode

func IsErrorCode(err error, code string) bool

IsErrorCode reports whether err is an *Error with the code.

func Quote

func Quote(s string) string

Quote returns a double-quoted string for a value in a query, escaping double quotes, backslashes and control characters.

Types

type APILink struct {
	Link string `json:"link"`
}

APILink is the link to get the schema of an API.

type APISchema

type APISchema struct {
	ID         string                    `json:"id"`
	BaseURL    string                    `json:"baseUrl"`
	Path       string                    `json:"path"`
	HTTPMethod string                    `json:"httpMethod"`
	Request    jsontext.Value            `json:"request"`
	Response   jsontext.Value            `json:"response"`
	Schemas    map[string]jsontext.Value `json:"schemas"`
}

APISchema is the schema of an API. Request, Response and Schemas are JSON Schemas.

type APIs

type APIs struct {
	BaseURL string             `json:"baseUrl"`
	APIs    map[string]APILink `json:"apis"`
}

APIs is the list of the kintone REST APIs, keyed by the API ID.

type Accessibility

type Accessibility string

Accessibility is the access to a field.

const (
	AccessibilityRead  Accessibility = "READ"
	AccessibilityWrite Accessibility = "WRITE"
	AccessibilityNone  Accessibility = "NONE"
)

Accessibilities.

type ActionMapping

type ActionMapping struct {
	SrcType   MappingSourceType `json:"srcType"`
	SrcField  string            `json:"srcField,omitzero"`
	DestField string            `json:"destField"`
}

ActionMapping is a mapping from the source to the field of the destination app. SrcField is set if SrcType is FIELD.

type AddAppRequest

type AddAppRequest struct {
	Name   string `json:"name"`
	Space  int64  `json:"space,omitzero"`
	Thread int64  `json:"thread,omitzero"`
}

AddAppRequest is the request of Client.AddApp.

type AddSpaceFromTemplateRequest

type AddSpaceFromTemplateRequest struct {
	ID          int64
	Name        string
	Members     []SpaceMember
	IsPrivate   bool
	IsGuest     bool
	FixedMember bool
}

AddSpaceFromTemplateRequest is the request of Client.AddSpaceFromTemplate. ID is the ID of the space template.

type AdminNotes

type AdminNotes struct {
	Content                        string `json:"content"`
	IncludeInTemplateAndDuplicates *bool  `json:"includeInTemplateAndDuplicates,omitzero"`
	Revision                       int64  `json:"revision,string,omitzero"`
}

AdminNotes is the notes for the app administrators.

type AggregationType

type AggregationType string

AggregationType is the type of an aggregation.

const (
	AggregationTypeCount   AggregationType = "COUNT"
	AggregationTypeSum     AggregationType = "SUM"
	AggregationTypeAverage AggregationType = "AVERAGE"
	AggregationTypeMax     AggregationType = "MAX"
	AggregationTypeMin     AggregationType = "MIN"
)

Aggregation types.

type Alignment

type Alignment string

Alignment is the alignment of the options of radio button and check box fields.

const (
	AlignmentHorizontal Alignment = "HORIZONTAL"
	AlignmentVertical   Alignment = "VERTICAL"
)

Alignments.

type AllRecordsByIDRequest

type AllRecordsByIDRequest struct {
	App       int64
	Fields    []string
	Condition string
}

AllRecordsByIDRequest is the request of Client.AllRecordsByID. Condition is the query condition, without order by, limit and offset. Use Quote to quote string values in Condition.

type AllRecordsError

type AllRecordsError struct {
	Processed int
	Err       error
}

AllRecordsError is an error of the methods to process all records, such as Client.AddAllRecords. Processed is the number of the records processed before the error, and Err is the error of the bulk request.

func (*AllRecordsError) Error

func (e *AllRecordsError) Error() string

func (*AllRecordsError) Unwrap

func (e *AllRecordsError) Unwrap() error

Unwrap returns the error of the bulk request.

type App

type App struct {
	AppID       int64     `json:"appId,string"`
	Code        string    `json:"code"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	SpaceID     int64     `json:"spaceId,string"`
	ThreadID    int64     `json:"threadId,string"`
	CreatedAt   time.Time `json:"createdAt"`
	Creator     Entity    `json:"creator"`
	ModifiedAt  time.Time `json:"modifiedAt"`
	Modifier    Entity    `json:"modifier"`
}

App is the information of an app. SpaceID and ThreadID are zero if the app does not belong to a space.

type AppAction

type AppAction struct {
	ID         int64           `json:"id,string,omitzero"`
	Name       string          `json:"name,omitzero"`
	Index      int             `json:"index,string"`
	DestApp    *RelatedApp     `json:"destApp,omitzero"`
	Mappings   []ActionMapping `json:"mappings,omitzero"`
	Entities   []FieldEntity   `json:"entities,omitzero"`
	FilterCond *string         `json:"filterCond,omitzero"`
}

AppAction is the setting of an action of an app, which copies a record to DestApp.

type AppActions

type AppActions struct {
	Actions  map[string]AppAction `json:"actions"`
	Revision int64                `json:"revision,string"`
}

AppActions is the actions of an app, keyed by the action name.

type AppDeployStatus

type AppDeployStatus struct {
	App    int64        `json:"app,string"`
	Status DeployStatus `json:"status"`
}

AppDeployStatus is the deploy status of an app.

type AppDeployment

type AppDeployment struct {
	App      int64 `json:"app"`
	Revision int64 `json:"revision,omitzero"`
}

AppDeployment is an app to deploy or revert. The revision is not checked if Revision is zero.

type AppIcon

type AppIcon struct {
	Type AppIconType `json:"type"`
	Key  string      `json:"key,omitzero"`
	File *FileInfo   `json:"file,omitzero"`
}

AppIcon is the icon of an app. Key is set for preset icons, and File is set for uploaded images.

type AppIconType

type AppIconType string

AppIconType is the type of an app icon.

const (
	AppIconTypePreset AppIconType = "PRESET"
	AppIconTypeFile   AppIconType = "FILE"
)

App icon types.

type AppPermissions

type AppPermissions struct {
	Rights   []AppRight `json:"rights"`
	Revision int64      `json:"revision,string,omitzero"`
}

AppPermissions is the app permissions of an app, in order of priority.

type AppPlugin

type AppPlugin struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Enabled bool   `json:"enabled"`
}

AppPlugin is a plugin added to an app.

type AppPluginConfig

type AppPluginConfig struct {
	Config   map[string]string `json:"config"`
	Revision int64             `json:"revision,string"`
}

AppPluginConfig is the config of a plugin added to an app.

type AppPlugins

type AppPlugins struct {
	Plugins  []AppPlugin `json:"plugins"`
	Revision int64       `json:"revision,string"`
}

AppPlugins is the plugins added to an app.

type AppRevision

type AppRevision struct {
	App      int64 `json:"app,string"`
	Revision int64 `json:"revision,string"`
}

AppRevision is the ID and the revision of an app.

type AppRight

type AppRight struct {
	Entity           FieldEntity `json:"entity"`
	IncludeSubs      bool        `json:"includeSubs,omitzero"`
	AppEditable      bool        `json:"appEditable,omitzero"`
	RecordViewable   bool        `json:"recordViewable,omitzero"`
	RecordAddable    bool        `json:"recordAddable,omitzero"`
	RecordEditable   bool        `json:"recordEditable,omitzero"`
	RecordDeletable  bool        `json:"recordDeletable,omitzero"`
	RecordImportable bool        `json:"recordImportable,omitzero"`
	RecordExportable bool        `json:"recordExportable,omitzero"`
}

AppRight is an app permission of an entity.

type AppSpace

type AppSpace struct {
	ID   int64  `json:"id,string"`
	Name string `json:"name"`
}

AppSpace is the space of an app.

type AppStatistics

type AppStatistics struct {
	ID                int64     `json:"id,string"`
	Name              string    `json:"name"`
	Space             *AppSpace `json:"space"`
	AppGroup          string    `json:"appGroup"`
	Status            AppStatus `json:"status"`
	RecordUpdatedAt   time.Time `json:"recordUpdatedAt"`
	RecordCount       int64     `json:"recordCount,string"`
	FieldCount        int64     `json:"fieldCount,string"`
	DailyRequestCount int64     `json:"dailyRequestCount,string"`
	APITokenCount     int64     `json:"apiTokenCount,string"`
	WebhookCount      int64     `json:"webhookCount,string"`
	StorageUsage      int64     `json:"storageUsage,string"`
	Customized        bool      `json:"customized"`
	Creator           Entity    `json:"creator"`
	CreatedAt         time.Time `json:"createdAt"`
	Modifier          Entity    `json:"modifier"`
	ModifiedAt        time.Time `json:"modifiedAt"`
}

AppStatistics is the usage of an app. Space is nil if the app does not belong to a space.

type AppStatus

type AppStatus string

AppStatus is the status of an app in the statistics. NOT_ACTIVATED means that the app has never been deployed, and CHANGED means that the app has settings not deployed yet.

const (
	AppStatusActivated    AppStatus = "ACTIVATED"
	AppStatusNotActivated AppStatus = "NOT_ACTIVATED"
	AppStatusChanged      AppStatus = "CHANGED"
)

App statuses.

type AssigneesUpdate

type AssigneesUpdate struct {
	ID        int64    `json:"id"`
	Assignees []string `json:"assignees"`
	Revision  int64    `json:"revision,omitzero"`
}

AssigneesUpdate is an update of the assignees of a record. Assignees are the login names of the users. The revision is not checked if Revision is zero.

type BulkError

type BulkError struct {
	Index int
	Err   *Error
}

BulkError is an error of a bulk request. Index is the index of the request that failed, and Err is its error.

func (*BulkError) Error

func (e *BulkError) Error() string

func (*BulkError) Unwrap

func (e *BulkError) Unwrap() error

Unwrap returns the error of the request that failed.

type BulkRequest

type BulkRequest struct {
	// contains filtered or unexported fields
}

BulkRequest is a bulk request, which sends the requests at once. Use the methods to add requests, and BulkRequest.Send to send them. The results of the requests are available after sending the bulk request.

func (*BulkRequest) AddRecord

func (b *BulkRequest) AddRecord(app int64, record Record) *BulkResult[RecordRevision]

AddRecord adds a request to add a record. See Client.AddRecord.

func (*BulkRequest) AddRecords

func (b *BulkRequest) AddRecords(app int64, records []Record) *BulkResult[[]RecordRevision]

AddRecords adds a request to add records. See Client.AddRecords.

func (*BulkRequest) DeleteRecords

func (b *BulkRequest) DeleteRecords(app int64, ids, revisions []int64) *BulkResult[struct{}]

DeleteRecords adds a request to delete records. See Client.DeleteRecords.

func (*BulkRequest) Send

func (b *BulkRequest) Send(ctx context.Context) error

Send sends the bulk request. If a request in the bulk request fails, it returns a *BulkError with the index of the request. Other errors are returned as is.

func (*BulkRequest) UpdateAssignees

func (b *BulkRequest) UpdateAssignees(app int64, update AssigneesUpdate) *BulkResult[int64]

UpdateAssignees adds a request to update the assignees of a record. See Client.UpdateAssignees.

func (*BulkRequest) UpdateRecord

func (b *BulkRequest) UpdateRecord(app int64, update RecordUpdate) *BulkResult[int64]

UpdateRecord adds a request to update a record. See Client.UpdateRecord.

func (*BulkRequest) UpdateRecords

func (b *BulkRequest) UpdateRecords(app int64, updates []RecordUpdate) *BulkResult[[]UpdatedRecord]

UpdateRecords adds a request to update records. See Client.UpdateRecords.

func (*BulkRequest) UpdateStatus

func (b *BulkRequest) UpdateStatus(app int64, update StatusUpdate) *BulkResult[int64]

UpdateStatus adds a request to update the status of a record. See Client.UpdateStatus.

func (*BulkRequest) UpdateStatuses

func (b *BulkRequest) UpdateStatuses(app int64, updates []StatusUpdate) *BulkResult[[]RecordRevision]

UpdateStatuses adds a request to update the statuses of records. See Client.UpdateStatuses.

func (*BulkRequest) UpsertRecords

func (b *BulkRequest) UpsertRecords(app int64, updates []RecordUpdate) *BulkResult[[]UpdatedRecord]

UpsertRecords adds a request to upsert records. See Client.UpsertRecords.

type BulkResult

type BulkResult[T any] struct {
	// contains filtered or unexported fields
}

BulkResult is the result of a request in a bulk request.

func (*BulkResult[T]) Value

func (r *BulkResult[T]) Value() T

Value returns the result of the request. It returns the zero value before the bulk request is sent successfully.

type CalcFormat

type CalcFormat string

CalcFormat is the display format of a calculated field.

const (
	CalcFormatNumber        CalcFormat = "NUMBER"
	CalcFormatNumberDigit   CalcFormat = "NUMBER_DIGIT"
	CalcFormatDateTime      CalcFormat = "DATETIME"
	CalcFormatDate          CalcFormat = "DATE"
	CalcFormatTime          CalcFormat = "TIME"
	CalcFormatHourMinute    CalcFormat = "HOUR_MINUTE"
	CalcFormatDayHourMinute CalcFormat = "DAY_HOUR_MINUTE"
)

Calculation formats.

type Categories

type Categories struct {
	Enabled    *bool               `json:"enabled,omitzero"`
	Categories map[string]Category `json:"categories,omitzero"`
	Revision   int64               `json:"revision,string,omitzero"`
}

Categories is the category settings of an app, keyed by the category name.

type Category

type Category struct {
	Name     string              `json:"name"`
	Index    int                 `json:"index,string"`
	Children map[string]Category `json:"children"`
}

Category is a category with the child categories keyed by the name.

type ChartMode

type ChartMode string

ChartMode is the display mode of a graph.

const (
	ChartModeNormal     ChartMode = "NORMAL"
	ChartModeStacked    ChartMode = "STACKED"
	ChartModePercentage ChartMode = "PERCENTAGE"
)

Chart modes.

type ChartType

type ChartType string

ChartType is the type of a graph.

const (
	ChartTypeBar        ChartType = "BAR"
	ChartTypeColumn     ChartType = "COLUMN"
	ChartTypePie        ChartType = "PIE"
	ChartTypeLine       ChartType = "LINE"
	ChartTypePivotTable ChartType = "PIVOT_TABLE"
	ChartTypeTable      ChartType = "TABLE"
	ChartTypeArea       ChartType = "AREA"
	ChartTypeSpline     ChartType = "SPLINE"
	ChartTypeSplineArea ChartType = "SPLINE_AREA"
)

Chart types.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a kintone REST API client.

func NewClient

func NewClient(baseURL string, opts ...Option) (*Client, error)

NewClient creates a client for the kintone environment at baseURL.

func (*Client) AddAllRecords

func (c *Client) AddAllRecords(ctx context.Context, app int64, records []Record) ([]RecordRevision, error)

AddAllRecords adds records by splitting them into bulk requests. If a bulk request fails, it returns the records added by the earlier bulk requests and an *AllRecordsError.

func (*Client) AddApp

func (c *Client) AddApp(ctx context.Context, req AddAppRequest) (AppRevision, error)

AddApp adds an app to the preview environment.

func (*Client) AddAppPlugins

func (c *Client) AddAppPlugins(ctx context.Context, app int64, ids []string, revision int64) (int64, error)

AddAppPlugins adds plugins to an app in the preview environment and returns the new revision. The revision is not checked if revision is zero.

func (*Client) AddComment

func (c *Client) AddComment(ctx context.Context, app, record int64, text string, mentions ...Mention) (int64, error)

AddComment adds a comment on a record and returns the comment ID.

func (*Client) AddFormFields

func (c *Client) AddFormFields(ctx context.Context, app int64, properties map[string]FieldProperty, revision int64) (int64, error)

AddFormFields adds fields to an app in the preview environment and returns the new revision. The revision is not checked if revision is zero.

func (*Client) AddGuests

func (c *Client) AddGuests(ctx context.Context, guests []Guest) error

AddGuests adds guest users. The guest space of the client is not used.

func (*Client) AddRecord

func (c *Client) AddRecord(ctx context.Context, app int64, record Record) (RecordRevision, error)

AddRecord adds a record.

func (*Client) AddRecords

func (c *Client) AddRecords(ctx context.Context, app int64, records []Record) ([]RecordRevision, error)

AddRecords adds records.

func (*Client) AddSpace

func (c *Client) AddSpace(ctx context.Context, name string) (int64, error)

AddSpace adds a public single thread space and returns the space ID. This uses an API in the API lab of kintone. The guest space of the client is not used.

func (*Client) AddSpaceFromTemplate

func (c *Client) AddSpaceFromTemplate(ctx context.Context, req AddSpaceFromTemplateRequest) (int64, error)

AddSpaceFromTemplate adds a space from a space template and returns the space ID. The guest space of the client is not used.

func (*Client) AddThread

func (c *Client) AddThread(ctx context.Context, space int64, name string) (int64, error)

AddThread adds a thread to a space and returns the thread ID.

func (*Client) AddThreadComment

func (c *Client) AddThreadComment(ctx context.Context, space, thread int64, comment ThreadComment) (int64, error)

AddThreadComment adds a comment on a thread and returns the comment ID.

func (*Client) AllApps

func (c *Client) AllApps(ctx context.Context, req GetAppsRequest) iter.Seq2[App, error]

AllApps iterates over the apps, using Client.GetApps. Offset of the request is the number of apps to skip, and Limit is the number of apps to get in each request.

func (*Client) AllComments

func (c *Client) AllComments(ctx context.Context, req GetCommentsRequest) iter.Seq2[Comment, error]

AllComments iterates over the comments on a record in the order of the request, using Client.GetComments. Offset of the request is the number of comments to skip, and Limit is the number of comments to get in each request.

func (*Client) AllRecords

func (c *Client) AllRecords(ctx context.Context, req CreateCursorRequest) iter.Seq2[Record, error]

AllRecords iterates over the records using a cursor. If Size of the request is zero, 500 is used. The cursor is deleted when the iteration stops before getting all the records. If the cursor has a warning, a *WarningError is yielded after all the records.

for record, err := range client.AllRecords(ctx, kintone.CreateCursorRequest{App: app}) {
	if err != nil {
		return err
	}
	fmt.Println(record["$id"].Value)
}

func (*Client) AllRecordsByID

func (c *Client) AllRecordsByID(ctx context.Context, req AllRecordsByIDRequest) iter.Seq2[Record, error]

AllRecordsByID iterates over the records in ascending order of the record ID, using Client.GetRecords with the condition on the record ID instead of a cursor. If Fields of the request does not contain $id, it is added. If any of the responses has a warning, a *WarningError is yielded after all the records.

func (*Client) CreateCursor

func (c *Client) CreateCursor(ctx context.Context, req CreateCursorRequest) (*Cursor, error)

CreateCursor creates a cursor.

func (*Client) DeleteAllRecords

func (c *Client) DeleteAllRecords(ctx context.Context, app int64, ids, revisions []int64) error

DeleteAllRecords deletes records by splitting them into bulk requests. The revisions are not checked if revisions is nil. If a bulk request fails, it returns an *AllRecordsError.

func (*Client) DeleteComment

func (c *Client) DeleteComment(ctx context.Context, app, record, comment int64) error

DeleteComment deletes a comment on a record.

func (*Client) DeleteCursor

func (c *Client) DeleteCursor(ctx context.Context, id string) error

DeleteCursor deletes the cursor.

func (*Client) DeleteFormFields

func (c *Client) DeleteFormFields(ctx context.Context, app int64, fields []string, revision int64) (int64, error)

DeleteFormFields deletes fields of an app in the preview environment and returns the new revision. The revision is not checked if revision is zero.

func (*Client) DeleteGuests

func (c *Client) DeleteGuests(ctx context.Context, codes []string) error

DeleteGuests deletes the guest users of the email addresses. The guest space of the client is not used.

func (*Client) DeleteRecords

func (c *Client) DeleteRecords(ctx context.Context, app int64, ids, revisions []int64) error

DeleteRecords deletes records. The revisions are not checked if revisions is nil.

func (*Client) DeleteSpace

func (c *Client) DeleteSpace(ctx context.Context, id int64) error

DeleteSpace deletes a space.

func (*Client) DeployApps

func (c *Client) DeployApps(ctx context.Context, apps []AppDeployment) error

DeployApps deploys the settings of the apps in the preview environment to the production environment. Use Client.GetDeployStatus to check whether the deployment is finished.

func (*Client) DownloadFile

func (c *Client) DownloadFile(ctx context.Context, fileKey string) (io.ReadCloser, string, error)

DownloadFile downloads the file of the file key and returns the content and the content type. The caller must close the content.

func (*Client) EvaluateRecordPermissions

func (c *Client) EvaluateRecordPermissions(ctx context.Context, app int64, ids []int64) ([]RecordAccess, error)

EvaluateRecordPermissions gets the permissions of the user on the records.

func (*Client) GetAPISchema

func (c *Client) GetAPISchema(ctx context.Context, id string) (*APISchema, error)

GetAPISchema gets the schema of the API of the ID, for example "records/get". The guest space of the client is not used.

func (*Client) GetAPIs

func (c *Client) GetAPIs(ctx context.Context) (*APIs, error)

GetAPIs gets the list of the kintone REST APIs. The guest space of the client is not used.

func (*Client) GetAdminNotes

func (c *Client) GetAdminNotes(ctx context.Context, req GetAppSettingsRequest) (*AdminNotes, error)

GetAdminNotes gets the notes for the administrators of an app. Lang of the request is not used.

func (*Client) GetApp

func (c *Client) GetApp(ctx context.Context, id int64) (*App, error)

GetApp gets the information of an app.

func (*Client) GetAppActions

func (c *Client) GetAppActions(ctx context.Context, req GetAppSettingsRequest) (*AppActions, error)

GetAppActions gets the actions of an app.

func (*Client) GetAppPermissions

func (c *Client) GetAppPermissions(ctx context.Context, req GetAppSettingsRequest) (*AppPermissions, error)

GetAppPermissions gets the app permissions of an app. Lang of the request is not used.

func (*Client) GetAppPluginConfig

func (c *Client) GetAppPluginConfig(ctx context.Context, req GetAppPluginConfigRequest) (*AppPluginConfig, error)

GetAppPluginConfig gets the config of a plugin added to an app. This uses an API in the API lab of kintone.

func (*Client) GetAppPlugins

func (c *Client) GetAppPlugins(ctx context.Context, req GetAppSettingsRequest) (*AppPlugins, error)

GetAppPlugins gets the plugins added to an app.

func (*Client) GetApps

func (c *Client) GetApps(ctx context.Context, req GetAppsRequest) ([]App, error)

GetApps gets the information of apps.

func (*Client) GetAppsStatistics

func (c *Client) GetAppsStatistics(ctx context.Context, req GetAppsStatisticsRequest) ([]AppStatistics, error)

GetAppsStatistics gets the usage of apps. The guest space of the client is not used.

func (*Client) GetCategories

func (c *Client) GetCategories(ctx context.Context, req GetAppSettingsRequest) (*Categories, error)

GetCategories gets the category settings of an app. This uses an API in the API lab of kintone.

func (*Client) GetComments

func (c *Client) GetComments(ctx context.Context, req GetCommentsRequest) (*GetCommentsResponse, error)

GetComments gets comments on a record.

func (*Client) GetCustomization

func (c *Client) GetCustomization(ctx context.Context, req GetAppSettingsRequest) (*Customization, error)

GetCustomization gets the JavaScript and CSS customization of an app. Lang of the request is not used.

func (*Client) GetDeployStatus

func (c *Client) GetDeployStatus(ctx context.Context, apps []int64) ([]AppDeployStatus, error)

GetDeployStatus gets the deploy statuses of the apps.

func (*Client) GetFieldPermissions

func (c *Client) GetFieldPermissions(ctx context.Context, req GetAppSettingsRequest) (*FieldPermissions, error)

GetFieldPermissions gets the field permissions of an app. Lang of the request is not used.

func (*Client) GetFormFields

func (c *Client) GetFormFields(ctx context.Context, req GetAppSettingsRequest) (*FormFields, error)

GetFormFields gets the fields of an app, keyed by the field code.

func (*Client) GetFormLayout

func (c *Client) GetFormLayout(ctx context.Context, req GetAppSettingsRequest) (*FormLayout, error)

GetFormLayout gets the layout of the form of an app. Lang of the request is not used.

func (*Client) GetGeneralNotifications

func (c *Client) GetGeneralNotifications(ctx context.Context, req GetAppSettingsRequest) (*GeneralNotifications, error)

GetGeneralNotifications gets the general notification settings of an app. Lang of the request is not used.

func (*Client) GetGeneralSettings

func (c *Client) GetGeneralSettings(ctx context.Context, req GetAppSettingsRequest) (*GeneralSettings, error)

GetGeneralSettings gets the general settings of an app.

func (*Client) GetPerRecordNotifications

func (c *Client) GetPerRecordNotifications(ctx context.Context, req GetAppSettingsRequest) (*PerRecordNotifications, error)

GetPerRecordNotifications gets the per record notification settings of an app.

func (*Client) GetPluginApps

func (c *Client) GetPluginApps(ctx context.Context, req GetPluginAppsRequest) ([]PluginApp, error)

GetPluginApps gets the apps which the plugin is added to. The guest space of the client is not used.

func (*Client) GetPlugins

func (c *Client) GetPlugins(ctx context.Context, req GetPluginsRequest) ([]Plugin, error)

GetPlugins gets the installed plugins. The guest space of the client is not used.

func (*Client) GetProcessManagement

func (c *Client) GetProcessManagement(ctx context.Context, req GetAppSettingsRequest) (*ProcessManagement, error)

GetProcessManagement gets the process management settings of an app.

func (*Client) GetRecord

func (c *Client) GetRecord(ctx context.Context, app, id int64) (Record, error)

GetRecord gets a record.

func (*Client) GetRecordPermissions

func (c *Client) GetRecordPermissions(ctx context.Context, req GetAppSettingsRequest) (*RecordPermissions, error)

GetRecordPermissions gets the record permissions of an app.

func (*Client) GetRecords

func (c *Client) GetRecords(ctx context.Context, req GetRecordsRequest) (*GetRecordsResponse, error)

GetRecords gets records matching the query.

func (*Client) GetRecordsByCursor

func (c *Client) GetRecordsByCursor(ctx context.Context, id string) (records []Record, next bool, err error)

GetRecordsByCursor gets the next records of the cursor. next reports whether there are more records to get.

func (*Client) GetReminderNotifications

func (c *Client) GetReminderNotifications(ctx context.Context, req GetAppSettingsRequest) (*ReminderNotifications, error)

GetReminderNotifications gets the reminder notification settings of an app.

func (*Client) GetReports

func (c *Client) GetReports(ctx context.Context, req GetAppSettingsRequest) (*Reports, error)

GetReports gets the graphs of an app.

func (*Client) GetRequiredPlugins

func (c *Client) GetRequiredPlugins(ctx context.Context, req GetRequiredPluginsRequest) ([]Plugin, error)

GetRequiredPlugins gets the plugins that are required to be installed. The guest space of the client is not used.

func (*Client) GetSpace

func (c *Client) GetSpace(ctx context.Context, id int64) (*Space, error)

GetSpace gets the information of a space.

func (*Client) GetSpaceMembers

func (c *Client) GetSpaceMembers(ctx context.Context, id int64) ([]SpaceMember, error)

GetSpaceMembers gets the members of a space.

func (*Client) GetSpacesStatistics

func (c *Client) GetSpacesStatistics(ctx context.Context, req GetSpacesStatisticsRequest) ([]SpaceStatistics, error)

GetSpacesStatistics gets the usage of spaces. The guest space of the client is not used.

func (*Client) GetViews

func (c *Client) GetViews(ctx context.Context, req GetAppSettingsRequest) (*Views, error)

GetViews gets the views of an app.

func (*Client) InstallPlugin

func (c *Client) InstallPlugin(ctx context.Context, fileKey string) (PluginVersion, error)

InstallPlugin installs the plugin of the file key, which is obtained by Client.UploadFile. The guest space of the client is not used.

func (*Client) MoveApp

func (c *Client) MoveApp(ctx context.Context, app, space int64) error

MoveApp moves an app to the space. If space is zero, the app is moved out of the space. The guest space of the client is not used.

func (*Client) NewBulkRequest

func (c *Client) NewBulkRequest() *BulkRequest

NewBulkRequest creates a bulk request.

func (*Client) RevertApps

func (c *Client) RevertApps(ctx context.Context, apps []AppDeployment) error

RevertApps discards the settings of the apps in the preview environment.

func (*Client) UninstallPlugin

func (c *Client) UninstallPlugin(ctx context.Context, id string) error

UninstallPlugin uninstalls the plugin. The guest space of the client is not used.

func (*Client) UpdateAdminNotes

func (c *Client) UpdateAdminNotes(ctx context.Context, app int64, notes AdminNotes, revision int64) (int64, error)

UpdateAdminNotes updates the notes for the administrators of an app in the preview environment and returns the new revision. Content is always sent, and Revision of the notes is not used. The revision is not checked if revision is zero.

func (*Client) UpdateAllRecords

func (c *Client) UpdateAllRecords(ctx context.Context, app int64, updates []RecordUpdate) ([]UpdatedRecord, error)

UpdateAllRecords updates records by splitting them into bulk requests. If a bulk request fails, it returns the records updated by the earlier bulk requests and an *AllRecordsError.

func (*Client) UpdateAppActions

func (c *Client) UpdateAppActions(ctx context.Context, app int64, actions map[string]AppAction, revision int64) (*UpdatedAppActions, error)

UpdateAppActions updates the actions of an app in the preview environment. The keys of actions are the action names before the update. The revision is not checked if revision is zero.

func (*Client) UpdateAppPermissions

func (c *Client) UpdateAppPermissions(ctx context.Context, app int64, rights []AppRight, revision int64) (int64, error)

UpdateAppPermissions updates the app permissions of an app in the preview environment and returns the new revision. The revision is not checked if revision is zero.

func (*Client) UpdateAppPluginConfig

func (c *Client) UpdateAppPluginConfig(ctx context.Context, app int64, id string, config map[string]string) (int64, error)

UpdateAppPluginConfig updates the config of a plugin added to an app in the preview environment and returns the new revision. This uses an API in the API lab of kintone.

func (*Client) UpdateAssignees

func (c *Client) UpdateAssignees(ctx context.Context, app int64, update AssigneesUpdate) (int64, error)

UpdateAssignees updates the assignees of a record and returns the new revision.

func (*Client) UpdateCategories

func (c *Client) UpdateCategories(ctx context.Context, app int64, settings Categories, revision int64) (int64, error)

UpdateCategories updates the category settings of an app in the preview environment and returns the new revision. The keys of the categories are the category names before the update. Revision of the settings is not used. The revision is not checked if revision is zero. This uses an API in the API lab of kintone.

func (*Client) UpdateCustomization

func (c *Client) UpdateCustomization(ctx context.Context, app int64, customization Customization, revision int64) (int64, error)

UpdateCustomization updates the JavaScript and CSS customization of an app in the preview environment and returns the new revision. Revision of the customization is not used. The revision is not checked if revision is zero.

func (*Client) UpdateFieldPermissions

func (c *Client) UpdateFieldPermissions(ctx context.Context, app int64, rights []FieldRight, revision int64) (int64, error)

UpdateFieldPermissions updates the field permissions of an app in the preview environment and returns the new revision. The revision is not checked if revision is zero.

func (*Client) UpdateFormFields

func (c *Client) UpdateFormFields(ctx context.Context, app int64, properties map[string]FieldProperty, revision int64) (int64, error)

UpdateFormFields updates fields of an app in the preview environment and returns the new revision. The keys of properties are the field codes before the update. The revision is not checked if revision is zero.

func (*Client) UpdateFormLayout

func (c *Client) UpdateFormLayout(ctx context.Context, app int64, layout []LayoutRow, revision int64) (int64, error)

UpdateFormLayout updates the layout of the form of an app in the preview environment and returns the new revision. The revision is not checked if revision is zero.

func (*Client) UpdateGeneralNotifications

func (c *Client) UpdateGeneralNotifications(ctx context.Context, app int64, settings GeneralNotifications, revision int64) (int64, error)

UpdateGeneralNotifications updates the general notification settings of an app in the preview environment and returns the new revision. Revision of the settings is not used. The revision is not checked if revision is zero.

func (*Client) UpdateGeneralSettings

func (c *Client) UpdateGeneralSettings(ctx context.Context, app int64, settings GeneralSettings, revision int64) (int64, error)

UpdateGeneralSettings updates the general settings of an app in the preview environment and returns the new revision. Revision of the settings is not used. The revision is not checked if revision is zero.

func (*Client) UpdateGuestMembers

func (c *Client) UpdateGuestMembers(ctx context.Context, id int64, codes []string) error

UpdateGuestMembers updates the guest members of the guest space with the email addresses of the guest users. The guest space of the client is not used, and id is used instead.

func (*Client) UpdatePerRecordNotifications

func (c *Client) UpdatePerRecordNotifications(ctx context.Context, app int64, notifications []PerRecordNotification, revision int64) (int64, error)

UpdatePerRecordNotifications updates the per record notification settings of an app in the preview environment and returns the new revision. The revision is not checked if revision is zero.

func (*Client) UpdatePlugin

func (c *Client) UpdatePlugin(ctx context.Context, id, fileKey string) (PluginVersion, error)

UpdatePlugin updates the plugin with the file key, which is obtained by Client.UploadFile. The guest space of the client is not used.

func (*Client) UpdateProcessManagement

func (c *Client) UpdateProcessManagement(ctx context.Context, app int64, settings ProcessManagement, revision int64) (int64, error)

UpdateProcessManagement updates the process management settings of an app in the preview environment and returns the new revision. Revision of the settings is not used. The revision is not checked if revision is zero.

func (*Client) UpdateRecord

func (c *Client) UpdateRecord(ctx context.Context, app int64, update RecordUpdate) (int64, error)

UpdateRecord updates a record and returns the new revision.

func (*Client) UpdateRecordPermissions

func (c *Client) UpdateRecordPermissions(ctx context.Context, app int64, rights []RecordRight, revision int64) (int64, error)

UpdateRecordPermissions updates the record permissions of an app in the preview environment and returns the new revision. The revision is not checked if revision is zero.

func (*Client) UpdateRecords

func (c *Client) UpdateRecords(ctx context.Context, app int64, updates []RecordUpdate) ([]UpdatedRecord, error)

UpdateRecords updates records.

func (*Client) UpdateReminderNotifications

func (c *Client) UpdateReminderNotifications(ctx context.Context, app int64, settings ReminderNotifications, revision int64) (int64, error)

UpdateReminderNotifications updates the reminder notification settings of an app in the preview environment and returns the new revision. Revision of the settings is not used. The revision is not checked if revision is zero.

func (*Client) UpdateReports

func (c *Client) UpdateReports(ctx context.Context, app int64, reports map[string]Report, revision int64) (*UpdatedReports, error)

UpdateReports updates the graphs of an app in the preview environment. The keys of reports are the graph names before the update. The revision is not checked if revision is zero.

func (*Client) UpdateSpace

func (c *Client) UpdateSpace(ctx context.Context, req UpdateSpaceRequest) error

UpdateSpace updates the settings of a space.

func (*Client) UpdateSpaceBody

func (c *Client) UpdateSpaceBody(ctx context.Context, id int64, body string) error

UpdateSpaceBody updates the body of a space in HTML.

func (*Client) UpdateSpaceMembers

func (c *Client) UpdateSpaceMembers(ctx context.Context, id int64, members []SpaceMember) error

UpdateSpaceMembers updates the members of a space. The members with IsImplicit are sent as explicit members.

func (*Client) UpdateStatus

func (c *Client) UpdateStatus(ctx context.Context, app int64, update StatusUpdate) (int64, error)

UpdateStatus updates the status of a record and returns the new revision.

func (*Client) UpdateStatuses

func (c *Client) UpdateStatuses(ctx context.Context, app int64, updates []StatusUpdate) ([]RecordRevision, error)

UpdateStatuses updates the statuses of records.

func (*Client) UpdateThread

func (c *Client) UpdateThread(ctx context.Context, req UpdateThreadRequest) error

UpdateThread updates the name or the body of a thread.

func (*Client) UpdateViews

func (c *Client) UpdateViews(ctx context.Context, app int64, views map[string]View, revision int64) (*UpdatedViews, error)

UpdateViews updates the views of an app in the preview environment. The keys of views are the view names before the update. The revision is not checked if revision is zero.

func (*Client) UploadFile

func (c *Client) UploadFile(ctx context.Context, name string, r io.Reader) (string, error)

UploadFile uploads a file and returns the file key. The content type of the file is detected from the extension of the name.

func (*Client) UpsertAllRecords

func (c *Client) UpsertAllRecords(ctx context.Context, app int64, updates []RecordUpdate) ([]UpdatedRecord, error)

UpsertAllRecords upserts records by splitting them into bulk requests. If a bulk request fails, it returns the records upserted by the earlier bulk requests and an *AllRecordsError.

func (*Client) UpsertRecords

func (c *Client) UpsertRecords(ctx context.Context, app int64, updates []RecordUpdate) ([]UpdatedRecord, error)

UpsertRecords updates records, or adds them if they do not exist. To upsert a single record, call it with one update.

func (*Client) WaitForDeploy

func (c *Client) WaitForDeploy(ctx context.Context, apps []int64) error

WaitForDeploy waits until the deployments of the apps finish, by polling Client.GetDeployStatus. It returns an error if any of the deployments fails or is canceled.

type Comment

type Comment struct {
	ID        int64     `json:"id,string"`
	Text      string    `json:"text"`
	CreatedAt time.Time `json:"createdAt"`
	Creator   Entity    `json:"creator"`
	Mentions  []Mention `json:"mentions"`
}

Comment is a comment on a record.

type CoverType

type CoverType string

CoverType is the type of the cover image of a space.

const (
	CoverTypeBlob   CoverType = "BLOB"
	CoverTypePreset CoverType = "PRESET"
)

Cover types.

type CreateAppPermission

type CreateAppPermission string

CreateAppPermission is who can create apps in a space.

const (
	CreateAppPermissionEveryone CreateAppPermission = "EVERYONE"
	CreateAppPermissionAdmin    CreateAppPermission = "ADMIN"
)

Create app permissions.

type CreateCursorRequest

type CreateCursorRequest struct {
	App    int64    `json:"app"`
	Fields []string `json:"fields,omitzero"`
	Query  string   `json:"query,omitzero"`
	Size   int64    `json:"size,omitzero"`
}

CreateCursorRequest is the request of Client.CreateCursor. Use Quote to quote string values in Query.

type Cursor

type Cursor struct {
	ID         string `json:"id"`
	TotalCount int64  `json:"totalCount,string"`
	Warning    string `json:"-"`
}

Cursor is a cursor to get records. Warning is the value of the X-Cybozu-Warning response header.

type Customization

type Customization struct {
	Scope    CustomizationScope  `json:"scope,omitzero"`
	Desktop  *CustomizationFiles `json:"desktop,omitzero"`
	Mobile   *CustomizationFiles `json:"mobile,omitzero"`
	Revision int64               `json:"revision,string,omitzero"`
}

Customization is the JavaScript and CSS customization of an app.

type CustomizationFile

type CustomizationFile struct {
	Type CustomizationFileType `json:"type"`
	URL  string                `json:"url,omitzero"`
	File *FileInfo             `json:"file,omitzero"`
}

CustomizationFile is a file of the customization. URL is set for files specified by URL, and File is set for uploaded files.

type CustomizationFileType

type CustomizationFileType string

CustomizationFileType is the type of a customization file.

const (
	CustomizationFileTypeURL  CustomizationFileType = "URL"
	CustomizationFileTypeFile CustomizationFileType = "FILE"
)

Customization file types.

type CustomizationFiles

type CustomizationFiles struct {
	JS  []CustomizationFile `json:"js,omitzero"`
	CSS []CustomizationFile `json:"css,omitzero"`
}

CustomizationFiles is the JavaScript and CSS files of the customization.

type CustomizationScope

type CustomizationScope string

CustomizationScope is the users the customization applies to.

const (
	CustomizationScopeAll   CustomizationScope = "ALL"
	CustomizationScopeAdmin CustomizationScope = "ADMIN"
	CustomizationScopeNone  CustomizationScope = "NONE"
)

Customization scopes.

type DayOfWeek

type DayOfWeek string

DayOfWeek is a day of the week.

const (
	DayOfWeekSunday    DayOfWeek = "SUNDAY"
	DayOfWeekMonday    DayOfWeek = "MONDAY"
	DayOfWeekTuesday   DayOfWeek = "TUESDAY"
	DayOfWeekWednesday DayOfWeek = "WEDNESDAY"
	DayOfWeekThursday  DayOfWeek = "THURSDAY"
	DayOfWeekFriday    DayOfWeek = "FRIDAY"
	DayOfWeekSaturday  DayOfWeek = "SATURDAY"
)

Days of the week.

type DeployStatus

type DeployStatus string

DeployStatus is the status of a deployment.

const (
	DeployStatusProcessing DeployStatus = "PROCESSING"
	DeployStatusSuccess    DeployStatus = "SUCCESS"
	DeployStatusFail       DeployStatus = "FAIL"
	DeployStatusCancel     DeployStatus = "CANCEL"
)

Deploy statuses.

type Entity

type Entity struct {
	Code string `json:"code"`
	Name string `json:"name,omitzero"`
}

Entity is a user, department or group.

type EntityType

type EntityType string

EntityType is the type of an entity.

const (
	EntityTypeUser         EntityType = "USER"
	EntityTypeGroup        EntityType = "GROUP"
	EntityTypeOrganization EntityType = "ORGANIZATION"
	EntityTypeFieldEntity  EntityType = "FIELD_ENTITY"
	EntityTypeCreator      EntityType = "CREATOR"
	EntityTypeCustomField  EntityType = "CUSTOM_FIELD"
	EntityTypeFunction     EntityType = "FUNCTION"
)

Entity types.

type Error

type Error struct {
	StatusCode int                    `json:"-"`
	Header     http.Header            `json:"-"`
	Code       string                 `json:"code"`
	ID         string                 `json:"id"`
	Message    string                 `json:"message"`
	Errors     map[string]ErrorDetail `json:"errors,omitzero"`
}

Error is an error response from kintone. Header is the response header.

func (*Error) Error

func (e *Error) Error() string

type ErrorDetail

type ErrorDetail struct {
	Messages []string `json:"messages"`
}

ErrorDetail is the error detail of a specific field or parameter.

type ExecutableUser

type ExecutableUser struct {
	Entities []TargetEntity `json:"entities"`
}

ExecutableUser is the users who can execute an action.

type Field

type Field struct {
	Type  FieldType `json:"type,omitzero"`
	Value any       `json:"value"`
}

Field is a field value of a record.

When decoded from a response, Value has the Go type corresponding to Type:

  • string for text, number, calculated, date and time, radio button, drop-down, link, record number, status, $id and $revision fields
  • []string for check box, multi-choice and category fields
  • Entity for created by and updated by fields
  • []Entity for user, department, group selection and assignee fields
  • []FileInfo for attachment fields
  • []SubtableRow for table fields

When writing records, Type can be omitted. For example,

kintone.Record{
	"title": {Value: "Hello"},
	"users": {Value: []kintone.Entity{{Code: "alice"}}},
	"files": {Value: []kintone.FileInfo{{FileKey: fileKey}}},
}

func (*Field) UnmarshalJSON

func (f *Field) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes the field value into the Go type of the field type.

type FieldAccessRights

type FieldAccessRights struct {
	Viewable bool `json:"viewable"`
	Editable bool `json:"editable"`
}

FieldAccessRights is the access rights on a field.

type FieldEntity

type FieldEntity struct {
	Code string     `json:"code,omitzero"`
	Type EntityType `json:"type"`
}

FieldEntity is an entity specified by the type and the code, such as a user, department or group of the options of a user selection field.

type FieldMapping

type FieldMapping struct {
	Field        string `json:"field"`
	RelatedField string `json:"relatedField"`
}

FieldMapping is a mapping of a field copied by a lookup field.

type FieldOption

type FieldOption struct {
	Label string `json:"label"`
	Index int    `json:"index,string"`
}

FieldOption is an option of a check box, radio button, multi-choice or drop-down field.

type FieldPermissions

type FieldPermissions struct {
	Rights   []FieldRight `json:"rights"`
	Revision int64        `json:"revision,string,omitzero"`
}

FieldPermissions is the field permissions of an app.

type FieldProperty

type FieldProperty struct {
	Type            FieldType                `json:"type"`
	Code            string                   `json:"code,omitzero"`
	Label           string                   `json:"label,omitzero"`
	NoLabel         *bool                    `json:"noLabel,omitzero"`
	Required        *bool                    `json:"required,omitzero"`
	Unique          *bool                    `json:"unique,omitzero"`
	MaxValue        *string                  `json:"maxValue,omitzero"`
	MinValue        *string                  `json:"minValue,omitzero"`
	MaxLength       *string                  `json:"maxLength,omitzero"`
	MinLength       *string                  `json:"minLength,omitzero"`
	DefaultValue    any                      `json:"defaultValue,omitzero"`
	DefaultNowValue *bool                    `json:"defaultNowValue,omitzero"`
	Options         map[string]FieldOption   `json:"options,omitzero"`
	Align           Alignment                `json:"align,omitzero"`
	Expression      *string                  `json:"expression,omitzero"`
	HideExpression  *bool                    `json:"hideExpression,omitzero"`
	Digit           *bool                    `json:"digit,omitzero"`
	ThumbnailSize   string                   `json:"thumbnailSize,omitzero"`
	Protocol        LinkProtocol             `json:"protocol,omitzero"`
	Format          CalcFormat               `json:"format,omitzero"`
	DisplayScale    *string                  `json:"displayScale,omitzero"`
	Unit            *string                  `json:"unit,omitzero"`
	UnitPosition    UnitPosition             `json:"unitPosition,omitzero"`
	Entities        []FieldEntity            `json:"entities,omitzero"`
	ReferenceTable  *ReferenceTable          `json:"referenceTable,omitzero"`
	Lookup          *Lookup                  `json:"lookup,omitzero"`
	OpenGroup       *bool                    `json:"openGroup,omitzero"`
	Fields          map[string]FieldProperty `json:"fields,omitzero"`
	Enabled         *bool                    `json:"enabled,omitzero"`
}

FieldProperty is the setting of a field in the form.

func (*FieldProperty) UnmarshalJSON

func (p *FieldProperty) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes the field property, accepting an empty string for the entities.

type FieldRight

type FieldRight struct {
	Code     string             `json:"code"`
	Entities []FieldRightEntity `json:"entities"`
}

FieldRight is the permissions of the field of Code, in order of priority.

type FieldRightEntity

type FieldRightEntity struct {
	Accessibility Accessibility `json:"accessibility"`
	Entity        FieldEntity   `json:"entity"`
	IncludeSubs   bool          `json:"includeSubs,omitzero"`
}

FieldRightEntity is a field permission of an entity.

type FieldSize

type FieldSize struct {
	Width       string `json:"width,omitzero"`
	Height      string `json:"height,omitzero"`
	InnerHeight string `json:"innerHeight,omitzero"`
}

FieldSize is the size of a field in pixels. Height includes the field name, and InnerHeight does not.

type FieldType

type FieldType string

FieldType is the type of a field.

const (
	FieldTypeRecordNumber       FieldType = "RECORD_NUMBER"
	FieldTypeID                 FieldType = "__ID__"
	FieldTypeRevision           FieldType = "__REVISION__"
	FieldTypeCreator            FieldType = "CREATOR"
	FieldTypeCreatedTime        FieldType = "CREATED_TIME"
	FieldTypeModifier           FieldType = "MODIFIER"
	FieldTypeUpdatedTime        FieldType = "UPDATED_TIME"
	FieldTypeSingleLineText     FieldType = "SINGLE_LINE_TEXT"
	FieldTypeMultiLineText      FieldType = "MULTI_LINE_TEXT"
	FieldTypeRichText           FieldType = "RICH_TEXT"
	FieldTypeNumber             FieldType = "NUMBER"
	FieldTypeCalc               FieldType = "CALC"
	FieldTypeCheckBox           FieldType = "CHECK_BOX"
	FieldTypeRadioButton        FieldType = "RADIO_BUTTON"
	FieldTypeMultiSelect        FieldType = "MULTI_SELECT"
	FieldTypeDropDown           FieldType = "DROP_DOWN"
	FieldTypeUserSelect         FieldType = "USER_SELECT"
	FieldTypeOrganizationSelect FieldType = "ORGANIZATION_SELECT"
	FieldTypeGroupSelect        FieldType = "GROUP_SELECT"
	FieldTypeDate               FieldType = "DATE"
	FieldTypeTime               FieldType = "TIME"
	FieldTypeDateTime           FieldType = "DATETIME"
	FieldTypeLink               FieldType = "LINK"
	FieldTypeFile               FieldType = "FILE"
	FieldTypeSubtable           FieldType = "SUBTABLE"
	FieldTypeCategory           FieldType = "CATEGORY"
	FieldTypeStatus             FieldType = "STATUS"
	FieldTypeStatusAssignee     FieldType = "STATUS_ASSIGNEE"
	FieldTypeReferenceTable     FieldType = "REFERENCE_TABLE"
	FieldTypeGroup              FieldType = "GROUP"
	FieldTypeLabel              FieldType = "LABEL"
	FieldTypeSpacer             FieldType = "SPACER"
	FieldTypeHR                 FieldType = "HR"
)

Field types.

type FileInfo

type FileInfo struct {
	ContentType string `json:"contentType,omitzero"`
	FileKey     string `json:"fileKey"`
	Name        string `json:"name,omitzero"`
	Size        int64  `json:"size,omitzero,string"`
}

FileInfo is a file of an attachment field. Only FileKey is required when writing records.

type FormFields

type FormFields struct {
	Properties map[string]FieldProperty `json:"properties"`
	Revision   int64                    `json:"revision,string"`
}

FormFields is the fields of an app.

type FormLayout

type FormLayout struct {
	Layout   []LayoutRow `json:"layout"`
	Revision int64       `json:"revision,string"`
}

FormLayout is the layout of the form of an app.

type GeneralNotification

type GeneralNotification struct {
	Entity        FieldEntity `json:"entity"`
	IncludeSubs   bool        `json:"includeSubs,omitzero"`
	RecordAdded   bool        `json:"recordAdded,omitzero"`
	RecordEdited  bool        `json:"recordEdited,omitzero"`
	CommentAdded  bool        `json:"commentAdded,omitzero"`
	StatusChanged bool        `json:"statusChanged,omitzero"`
	FileImported  bool        `json:"fileImported,omitzero"`
}

GeneralNotification is a general notification setting.

type GeneralNotifications

type GeneralNotifications struct {
	Notifications     []GeneralNotification `json:"notifications,omitzero"`
	NotifyToCommenter *bool                 `json:"notifyToCommenter,omitzero"`
	Revision          int64                 `json:"revision,string,omitzero"`
}

GeneralNotifications is the general notification settings of an app.

type GeneralSettings

type GeneralSettings struct {
	Name                      string           `json:"name,omitzero"`
	Description               *string          `json:"description,omitzero"`
	Icon                      *AppIcon         `json:"icon,omitzero"`
	Theme                     Theme            `json:"theme,omitzero"`
	TitleField                *TitleField      `json:"titleField,omitzero"`
	EnableThumbnails          *bool            `json:"enableThumbnails,omitzero"`
	EnableBulkDeletion        *bool            `json:"enableBulkDeletion,omitzero"`
	EnableComments            *bool            `json:"enableComments,omitzero"`
	EnableDuplicateRecord     *bool            `json:"enableDuplicateRecord,omitzero"`
	EnableInlineRecordEditing *bool            `json:"enableInlineRecordEditing,omitzero"`
	NumberPrecision           *NumberPrecision `json:"numberPrecision,omitzero"`
	FirstMonthOfFiscalYear    string           `json:"firstMonthOfFiscalYear,omitzero"`
	Revision                  int64            `json:"revision,string,omitzero"`
}

GeneralSettings is the general settings of an app.

type GetAppPluginConfigRequest

type GetAppPluginConfigRequest struct {
	App     int64  `json:"app"`
	ID      string `json:"id"`
	Preview bool   `json:"-"`
}

GetAppPluginConfigRequest is the request of Client.GetAppPluginConfig. ID is the plugin ID. If Preview is true, the config in the preview environment is returned.

type GetAppSettingsRequest

type GetAppSettingsRequest struct {
	App     int64  `json:"app"`
	Lang    string `json:"lang,omitzero"`
	Preview bool   `json:"-"`
}

GetAppSettingsRequest is the request to get settings of an app. If Preview is true, the settings in the preview environment are returned.

type GetAppsRequest

type GetAppsRequest struct {
	IDs      []int64  `json:"ids,omitzero"`
	Codes    []string `json:"codes,omitzero"`
	Name     string   `json:"name,omitzero"`
	SpaceIDs []int64  `json:"spaceIds,omitzero"`
	Offset   int64    `json:"offset,omitzero"`
	Limit    int64    `json:"limit,omitzero"`
}

GetAppsRequest is the request of Client.GetApps.

type GetAppsStatisticsRequest

type GetAppsStatisticsRequest struct {
	Offset int64 `json:"offset,omitzero"`
	Limit  int64 `json:"limit,omitzero"`
}

GetAppsStatisticsRequest is the request of Client.GetAppsStatistics.

type GetCommentsRequest

type GetCommentsRequest struct {
	App    int64  `json:"app"`
	Record int64  `json:"record"`
	Order  string `json:"order,omitzero"`
	Offset int64  `json:"offset,omitzero"`
	Limit  int64  `json:"limit,omitzero"`
}

GetCommentsRequest is the request of Client.GetComments. Order is "asc" or "desc".

type GetCommentsResponse

type GetCommentsResponse struct {
	Comments []Comment `json:"comments"`
	Older    bool      `json:"older"`
	Newer    bool      `json:"newer"`
}

GetCommentsResponse is the response of Client.GetComments. Older and Newer report whether there are older or newer comments.

type GetPluginAppsRequest

type GetPluginAppsRequest struct {
	ID     string `json:"id"`
	Offset int64  `json:"offset,omitzero"`
	Limit  int64  `json:"limit,omitzero"`
}

GetPluginAppsRequest is the request of Client.GetPluginApps. ID is the plugin ID.

type GetPluginsRequest

type GetPluginsRequest struct {
	Offset int64    `json:"offset,omitzero"`
	Limit  int64    `json:"limit,omitzero"`
	IDs    []string `json:"ids,omitzero"`
}

GetPluginsRequest is the request of Client.GetPlugins.

type GetRecordsRequest

type GetRecordsRequest struct {
	App        int64    `json:"app"`
	Fields     []string `json:"fields,omitzero"`
	Query      string   `json:"query,omitzero"`
	TotalCount bool     `json:"totalCount,omitzero"`
}

GetRecordsRequest is the request of Client.GetRecords. Use Quote to quote string values in Query.

type GetRecordsResponse

type GetRecordsResponse struct {
	Records    []Record `json:"records"`
	TotalCount int64    `json:"totalCount,string"`
	Warning    string   `json:"-"`
}

GetRecordsResponse is the response of Client.GetRecords. TotalCount is set only when TotalCount of the request is true. Warning is the value of the X-Cybozu-Warning response header.

type GetRequiredPluginsRequest

type GetRequiredPluginsRequest struct {
	Offset int64 `json:"offset,omitzero"`
	Limit  int64 `json:"limit,omitzero"`
}

GetRequiredPluginsRequest is the request of Client.GetRequiredPlugins.

type GetSpacesStatisticsRequest

type GetSpacesStatisticsRequest struct {
	Offset int64 `json:"offset,omitzero"`
	Limit  int64 `json:"limit,omitzero"`
}

GetSpacesStatisticsRequest is the request of Client.GetSpacesStatistics.

type Guest

type Guest struct {
	Code             string `json:"code"`
	Password         string `json:"password"`
	Timezone         string `json:"timezone"`
	Locale           Locale `json:"locale,omitzero"`
	Image            string `json:"image,omitzero"`
	Name             string `json:"name"`
	SurNameReading   string `json:"surNameReading,omitzero"`
	GivenNameReading string `json:"givenNameReading,omitzero"`
	Company          string `json:"company,omitzero"`
	Division         string `json:"division,omitzero"`
	Phone            string `json:"phone,omitzero"`
	Callto           string `json:"callto,omitzero"`
}

Guest is a guest user to add. Code is the email address of the guest user, and Image is the file key of the image.

type LayoutField

type LayoutField struct {
	Type      FieldType  `json:"type"`
	Code      string     `json:"code,omitzero"`
	Label     string     `json:"label,omitzero"`
	ElementID string     `json:"elementId,omitzero"`
	Size      *FieldSize `json:"size,omitzero"`
}

LayoutField is a field in a layout row. Label is the text of a label field, and ElementID is the element ID of a label, spacer or border field.

type LayoutRow

type LayoutRow struct {
	Type   LayoutType    `json:"type"`
	Code   string        `json:"code,omitzero"`
	Fields []LayoutField `json:"fields,omitzero"`
	Layout []LayoutRow   `json:"layout,omitzero"`
}

LayoutRow is a row of the form layout. Code is the field code of the table or the group, and Layout is the rows in the group.

type LayoutType

type LayoutType string

LayoutType is the type of a layout row.

const (
	LayoutTypeRow      LayoutType = "ROW"
	LayoutTypeSubtable LayoutType = "SUBTABLE"
	LayoutTypeGroup    LayoutType = "GROUP"
)

Layout types.

type LinkProtocol

type LinkProtocol string

LinkProtocol is the type of the values of a link field.

const (
	LinkProtocolWeb  LinkProtocol = "WEB"
	LinkProtocolCall LinkProtocol = "CALL"
	LinkProtocolMail LinkProtocol = "MAIL"
)

Link protocols.

type Locale

type Locale string

Locale is the language of a user. LocaleAuto follows the browser.

const (
	LocaleAuto Locale = "auto"
	LocaleJa   Locale = "ja"
	LocaleEn   Locale = "en"
	LocaleZh   Locale = "zh"
)

Locales.

type Lookup

type Lookup struct {
	RelatedApp         RelatedApp     `json:"relatedApp,omitzero"`
	RelatedKeyField    string         `json:"relatedKeyField,omitzero"`
	FieldMappings      []FieldMapping `json:"fieldMappings,omitzero"`
	LookupPickerFields []string       `json:"lookupPickerFields,omitzero"`
	FilterCond         *string        `json:"filterCond,omitzero"`
	Sort               *string        `json:"sort,omitzero"`
}

Lookup is the setting of a lookup field.

func (*Lookup) UnmarshalJSON

func (l *Lookup) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes the lookup setting, accepting an empty string for the field mappings and the lookup picker fields.

type MappingSourceType

type MappingSourceType string

MappingSourceType is the source of a mapping of an app action.

const (
	MappingSourceTypeField     MappingSourceType = "FIELD"
	MappingSourceTypeRecordURL MappingSourceType = "RECORD_URL"
)

Mapping source types.

type Mention

type Mention struct {
	Code string     `json:"code"`
	Type EntityType `json:"type"`
}

Mention is a mention in a comment.

type NumberPrecision

type NumberPrecision struct {
	Digits        string       `json:"digits,omitzero"`
	DecimalPlaces string       `json:"decimalPlaces,omitzero"`
	RoundingMode  RoundingMode `json:"roundingMode,omitzero"`
}

NumberPrecision is the precision of number and calculated fields.

type Operation

type Operation string

Operation is the operation done on a record by Client.UpsertRecords.

const (
	OperationInsert Operation = "INSERT"
	OperationUpdate Operation = "UPDATE"
)

Operations.

type Option

type Option func(*Client)

Option configures a Client.

func WithAPIToken

func WithAPIToken(tokens ...string) Option

WithAPIToken authenticates with API tokens. Multiple tokens can be specified to access multiple apps (for example on lookup fields).

func WithAcceptLanguage

func WithAcceptLanguage(language string) Option

WithAcceptLanguage sets the Accept-Language header, which selects the language of the error messages with API tokens, and of the data when the language setting of the user follows the browser.

func WithBasicAuth

func WithBasicAuth(username, password string) Option

WithBasicAuth sets the credential of the Basic authentication, which is required when the domain enables it.

func WithGuestSpace

func WithGuestSpace(id int64) Option

WithGuestSpace makes the client access apps in the guest space.

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) Option

WithHTTPClient sets the HTTP client used for requests. The client does not follow redirects, so that the credentials are not sent to other hosts. If httpClient is nil, http.DefaultClient is used.

func WithOAuthToken

func WithOAuthToken(token string) Option

WithOAuthToken authenticates with the OAuth access token.

func WithPassword

func WithPassword(username, password string) Option

WithPassword authenticates with the login name and password.

func WithUserAgent

func WithUserAgent(userAgent string) Option

WithUserAgent sets the User-Agent header.

type PerRecordNotification

type PerRecordNotification struct {
	FilterCond string         `json:"filterCond,omitzero"`
	Title      string         `json:"title,omitzero"`
	Targets    []TargetEntity `json:"targets"`
}

PerRecordNotification is a per record notification setting.

type PerRecordNotifications

type PerRecordNotifications struct {
	Notifications []PerRecordNotification `json:"notifications"`
	Revision      int64                   `json:"revision,string,omitzero"`
}

PerRecordNotifications is the per record notification settings of an app.

type PeriodicReport

type PeriodicReport struct {
	Active *bool        `json:"active,omitzero"`
	Period ReportPeriod `json:"period,omitzero"`
}

PeriodicReport is the setting of the periodic report of a graph.

type Plugin

type Plugin struct {
	ID             string `json:"id"`
	Name           string `json:"name"`
	Description    string `json:"description"`
	IsMarketPlugin bool   `json:"isMarketPlugin"`
	Version        string `json:"version"`
}

Plugin is a plugin installed in kintone. Description and Version are empty for the plugins returned by Client.GetRequiredPlugins.

type PluginApp

type PluginApp struct {
	ID   int64  `json:"id,string"`
	Name string `json:"name"`
}

PluginApp is an app which the plugin is added to.

type PluginVersion

type PluginVersion struct {
	ID      string `json:"id"`
	Version string `json:"version"`
}

PluginVersion is the ID and the version of a plugin.

type ProcessAction

type ProcessAction struct {
	Name           string            `json:"name"`
	From           string            `json:"from"`
	To             string            `json:"to"`
	FilterCond     string            `json:"filterCond,omitzero"`
	Type           ProcessActionType `json:"type,omitzero"`
	ExecutableUser *ExecutableUser   `json:"executableUser,omitzero"`
}

ProcessAction is an action of the process management. ExecutableUser is the users who can execute the action of type SECONDARY.

type ProcessActionType

type ProcessActionType string

ProcessActionType is the type of a process action.

const (
	ProcessActionTypePrimary   ProcessActionType = "PRIMARY"
	ProcessActionTypeSecondary ProcessActionType = "SECONDARY"
)

Process action types.

type ProcessAssignee

type ProcessAssignee struct {
	Type     ProcessAssigneeType `json:"type"`
	Entities []TargetEntity      `json:"entities"`
}

ProcessAssignee is the assignees of a status.

type ProcessAssigneeType

type ProcessAssigneeType string

ProcessAssigneeType is how the assignees of a status work on it.

const (
	ProcessAssigneeTypeOne ProcessAssigneeType = "ONE"
	ProcessAssigneeTypeAll ProcessAssigneeType = "ALL"
	ProcessAssigneeTypeAny ProcessAssigneeType = "ANY"
)

Process assignee types.

type ProcessManagement

type ProcessManagement struct {
	Enable   *bool                   `json:"enable,omitzero"`
	States   map[string]ProcessState `json:"states,omitzero"`
	Actions  []ProcessAction         `json:"actions,omitzero"`
	Revision int64                   `json:"revision,string,omitzero"`
}

ProcessManagement is the process management settings of an app. States and Actions are nil if the process management has never been set.

type ProcessState

type ProcessState struct {
	Name     string           `json:"name,omitzero"`
	Index    int              `json:"index,string"`
	Assignee *ProcessAssignee `json:"assignee,omitzero"`
}

ProcessState is a status of the process management.

type QuarterPattern

type QuarterPattern string

QuarterPattern is the months of a quarterly periodic report.

const (
	QuarterPatternJanAprJulOct QuarterPattern = "JAN_APR_JUL_OCT"
	QuarterPatternFebMayAugNov QuarterPattern = "FEB_MAY_AUG_NOV"
	QuarterPatternMarJunSepDec QuarterPattern = "MAR_JUN_SEP_DEC"
)

Quarter patterns.

type Record

type Record map[string]Field

Record is a kintone record, keyed by the field code.

type RecordAccess

type RecordAccess struct {
	ID     int64                        `json:"id,string"`
	Record RecordAccessRights           `json:"record"`
	Fields map[string]FieldAccessRights `json:"fields"`
}

RecordAccess is the access rights of the user on a record and its fields.

type RecordAccessRights

type RecordAccessRights struct {
	Viewable  bool `json:"viewable"`
	Editable  bool `json:"editable"`
	Deletable bool `json:"deletable"`
}

RecordAccessRights is the access rights on a record.

type RecordPermissions

type RecordPermissions struct {
	Rights   []RecordRight `json:"rights"`
	Revision int64         `json:"revision,string,omitzero"`
}

RecordPermissions is the record permissions of an app, in order of priority.

type RecordRevision

type RecordRevision struct {
	ID       int64 `json:"id,string"`
	Revision int64 `json:"revision,string"`
}

RecordRevision is the ID and the revision of a record.

type RecordRight

type RecordRight struct {
	FilterCond string              `json:"filterCond,omitzero"`
	Entities   []RecordRightEntity `json:"entities"`
}

RecordRight is a record permission of the records matching FilterCond.

type RecordRightEntity

type RecordRightEntity struct {
	Entity      FieldEntity `json:"entity"`
	Viewable    bool        `json:"viewable,omitzero"`
	Editable    bool        `json:"editable,omitzero"`
	Deletable   bool        `json:"deletable,omitzero"`
	IncludeSubs bool        `json:"includeSubs,omitzero"`
}

RecordRightEntity is a record permission of an entity.

type RecordUpdate

type RecordUpdate struct {
	ID        int64      `json:"id,omitzero"`
	UpdateKey *UpdateKey `json:"updateKey,omitzero"`
	Record    Record     `json:"record,omitzero"`
	Revision  int64      `json:"revision,omitzero"`
}

RecordUpdate is an update of a record, specified by either ID or UpdateKey. The revision is not checked if Revision is zero.

type ReferenceTable

type ReferenceTable struct {
	RelatedApp    RelatedApp              `json:"relatedApp,omitzero"`
	Condition     ReferenceTableCondition `json:"condition,omitzero"`
	FilterCond    *string                 `json:"filterCond,omitzero"`
	DisplayFields []string                `json:"displayFields,omitzero"`
	Sort          *string                 `json:"sort,omitzero"`
	Size          string                  `json:"size,omitzero"`
}

ReferenceTable is the setting of a related records field. When RelatedApp is set in an update, the server resets the omitted settings.

type ReferenceTableCondition

type ReferenceTableCondition struct {
	Field        string `json:"field"`
	RelatedField string `json:"relatedField"`
}

ReferenceTableCondition is the condition of the records to show in a related records field.

type RelatedApp

type RelatedApp struct {
	App  int64  `json:"app,string,omitzero"`
	Code string `json:"code,omitzero"`
}

RelatedApp is an app referenced by a related records or lookup field, specified by either App or Code.

type ReminderNotification

type ReminderNotification struct {
	Timing     ReminderTiming `json:"timing"`
	FilterCond string         `json:"filterCond,omitzero"`
	Title      string         `json:"title,omitzero"`
	Targets    []TargetEntity `json:"targets"`
}

ReminderNotification is a reminder notification setting.

type ReminderNotifications

type ReminderNotifications struct {
	Notifications []ReminderNotification `json:"notifications,omitzero"`
	Timezone      string                 `json:"timezone,omitzero"`
	Revision      int64                  `json:"revision,string,omitzero"`
}

ReminderNotifications is the reminder notification settings of an app.

type ReminderTiming

type ReminderTiming struct {
	Code       string `json:"code"`
	DaysLater  int    `json:"daysLater,string"`
	HoursLater *int   `json:"hoursLater,string,omitzero"`
	Time       string `json:"time,omitzero"`
}

ReminderTiming is the timing of a reminder notification, relative to the field of Code. Either HoursLater or Time is set.

type Report

type Report struct {
	ID             int64               `json:"id,string,omitzero"`
	Name           string              `json:"name,omitzero"`
	ChartType      ChartType           `json:"chartType"`
	ChartMode      ChartMode           `json:"chartMode,omitzero"`
	Index          int                 `json:"index,string"`
	Groups         []ReportGroup       `json:"groups,omitzero"`
	Aggregations   []ReportAggregation `json:"aggregations,omitzero"`
	FilterCond     *string             `json:"filterCond,omitzero"`
	Sorts          []ReportSort        `json:"sorts,omitzero"`
	PeriodicReport *PeriodicReport     `json:"periodicReport,omitzero"`
}

Report is the setting of a graph of an app.

type ReportAggregation

type ReportAggregation struct {
	Type AggregationType `json:"type"`
	Code string          `json:"code,omitzero"`
}

ReportAggregation is an aggregation of a graph. Code is empty for COUNT.

type ReportGroup

type ReportGroup struct {
	Code string   `json:"code"`
	Per  TimeUnit `json:"per,omitzero"`
}

ReportGroup is a group of a graph. Per is the time unit of a date or time field.

type ReportPeriod

type ReportPeriod struct {
	Every      TimeUnit       `json:"every"`
	Month      string         `json:"month,omitzero"`
	Time       string         `json:"time,omitzero"`
	Pattern    QuarterPattern `json:"pattern,omitzero"`
	DayOfMonth string         `json:"dayOfMonth,omitzero"`
	DayOfWeek  DayOfWeek      `json:"dayOfWeek,omitzero"`
	Minute     string         `json:"minute,omitzero"`
}

ReportPeriod is the period of a periodic report.

type ReportSort

type ReportSort struct {
	By    ReportSortBy `json:"by"`
	Order SortOrder    `json:"order"`
}

ReportSort is a sort of a graph.

type ReportSortBy

type ReportSortBy string

ReportSortBy is the target of a sort of a graph.

const (
	ReportSortByTotal  ReportSortBy = "TOTAL"
	ReportSortByGroup1 ReportSortBy = "GROUP1"
	ReportSortByGroup2 ReportSortBy = "GROUP2"
	ReportSortByGroup3 ReportSortBy = "GROUP3"
)

Report sort targets.

type Reports

type Reports struct {
	Reports  map[string]Report `json:"reports"`
	Revision int64             `json:"revision,string"`
}

Reports is the graphs of an app, keyed by the graph name.

type RoundingMode

type RoundingMode string

RoundingMode is the rounding mode of numbers.

const (
	RoundingModeHalfEven RoundingMode = "HALF_EVEN"
	RoundingModeUp       RoundingMode = "UP"
	RoundingModeDown     RoundingMode = "DOWN"
)

Rounding modes.

type SortOrder

type SortOrder string

SortOrder is the order of a sort.

const (
	SortOrderAsc  SortOrder = "ASC"
	SortOrderDesc SortOrder = "DESC"
)

Sort orders.

type Space

type Space struct {
	ID                  int64            `json:"id,string"`
	Name                string           `json:"name"`
	DefaultThread       int64            `json:"defaultThread,string"`
	IsPrivate           bool             `json:"isPrivate"`
	Creator             Entity           `json:"creator"`
	Modifier            Entity           `json:"modifier"`
	MemberCount         int64            `json:"memberCount,string"`
	CoverType           CoverType        `json:"coverType"`
	CoverKey            string           `json:"coverKey"`
	CoverURL            string           `json:"coverUrl"`
	Body                string           `json:"body"`
	UseMultiThread      bool             `json:"useMultiThread"`
	IsGuest             bool             `json:"isGuest"`
	AttachedApps        []App            `json:"attachedApps"`
	FixedMember         bool             `json:"fixedMember"`
	ShowAnnouncement    *bool            `json:"showAnnouncement"`
	ShowThreadList      *bool            `json:"showThreadList"`
	ShowAppList         *bool            `json:"showAppList"`
	ShowMemberList      *bool            `json:"showMemberList"`
	ShowRelatedLinkList *bool            `json:"showRelatedLinkList"`
	Permissions         SpacePermissions `json:"permissions"`
}

Space is the information of a space. The portal settings ShowAnnouncement, ShowThreadList, ShowAppList, ShowMemberList and ShowRelatedLinkList are nil for single thread spaces and guest spaces.

type SpaceMember

type SpaceMember struct {
	Entity      FieldEntity `json:"entity"`
	IsAdmin     bool        `json:"isAdmin,omitzero"`
	IsImplicit  bool        `json:"isImplicit,omitzero"`
	IncludeSubs bool        `json:"includeSubs,omitzero"`
}

SpaceMember is a member of a space. IsImplicit is true for the users who belong to the space through a group or a department, and is not sent.

type SpacePermissions

type SpacePermissions struct {
	CreateApp CreateAppPermission `json:"createApp"`
}

SpacePermissions is the permissions of a space.

type SpaceStatistics

type SpaceStatistics struct {
	ID                 int64     `json:"id,string"`
	Name               string    `json:"name"`
	AdministratorCount int64     `json:"administratorCount,string"`
	MemberCount        int64     `json:"memberCount,string"`
	IsPrivate          bool      `json:"isPrivate"`
	IsGuest            bool      `json:"isGuest"`
	Creator            Entity    `json:"creator"`
	CreatedAt          time.Time `json:"createdAt"`
	Modifier           Entity    `json:"modifier"`
	ModifiedAt         time.Time `json:"modifiedAt"`
}

SpaceStatistics is the usage of a space.

func (*SpaceStatistics) UnmarshalJSON

func (s *SpaceStatistics) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes the space statistics, accepting both numbers and strings for the ID and the counts.

type StatusUpdate

type StatusUpdate struct {
	ID       int64  `json:"id"`
	Action   string `json:"action"`
	Assignee string `json:"assignee,omitzero"`
	Revision int64  `json:"revision,omitzero"`
}

StatusUpdate is an update of the status of a record by an action. Assignee is the login name of the user. The revision is not checked if Revision is zero.

type SubtableRow

type SubtableRow struct {
	ID    string `json:"id,omitzero"`
	Value Record `json:"value"`
}

SubtableRow is a row of a table field.

type TargetEntity

type TargetEntity struct {
	Entity      FieldEntity `json:"entity"`
	IncludeSubs bool        `json:"includeSubs,omitzero"`
}

TargetEntity is an entity with whether to include the sub organizations, used for the assignees, the executable users and the notification targets.

type Theme

type Theme string

Theme is the color theme of an app. The themes CLIPBOARD, BINDER, PENCIL and CLIPS are deprecated.

const (
	ThemeWhite     Theme = "WHITE"
	ThemeRed       Theme = "RED"
	ThemeGreen     Theme = "GREEN"
	ThemeBlue      Theme = "BLUE"
	ThemeYellow    Theme = "YELLOW"
	ThemeBlack     Theme = "BLACK"
	ThemeClipboard Theme = "CLIPBOARD"
	ThemeBinder    Theme = "BINDER"
	ThemePencil    Theme = "PENCIL"
	ThemeClips     Theme = "CLIPS"
)

Themes.

type ThreadComment

type ThreadComment struct {
	Text     string              `json:"text,omitzero"`
	Mentions []Mention           `json:"mentions,omitzero"`
	Files    []ThreadCommentFile `json:"files,omitzero"`
}

ThreadComment is a comment on a thread.

type ThreadCommentFile

type ThreadCommentFile struct {
	FileKey string `json:"fileKey"`
	Width   int    `json:"width,omitzero"`
}

ThreadCommentFile is a file attached to a thread comment. Width is the width of the image in pixels.

type TimeUnit

type TimeUnit string

TimeUnit is a unit of time, used for the groups and the periodic reports of graphs.

const (
	TimeUnitYear    TimeUnit = "YEAR"
	TimeUnitQuarter TimeUnit = "QUARTER"
	TimeUnitMonth   TimeUnit = "MONTH"
	TimeUnitWeek    TimeUnit = "WEEK"
	TimeUnitDay     TimeUnit = "DAY"
	TimeUnitHour    TimeUnit = "HOUR"
	TimeUnitMinute  TimeUnit = "MINUTE"
)

Time units.

type TitleField

type TitleField struct {
	SelectionMode TitleSelectionMode `json:"selectionMode"`
	Code          string             `json:"code,omitzero"`
}

TitleField is the field used as the title of records.

type TitleSelectionMode

type TitleSelectionMode string

TitleSelectionMode is how the title field is selected.

const (
	TitleSelectionModeAuto   TitleSelectionMode = "AUTO"
	TitleSelectionModeManual TitleSelectionMode = "MANUAL"
)

Title selection modes.

type UnitPosition

type UnitPosition string

UnitPosition is the position of the unit of number and calculated fields.

const (
	UnitPositionBefore UnitPosition = "BEFORE"
	UnitPositionAfter  UnitPosition = "AFTER"
)

Unit positions.

type UpdateKey

type UpdateKey struct {
	Field string `json:"field"`
	Value string `json:"value"`
}

UpdateKey specifies a record by the value of a field.

type UpdateSpaceRequest

type UpdateSpaceRequest struct {
	ID                  int64             `json:"id"`
	Name                string            `json:"name,omitzero"`
	IsPrivate           *bool             `json:"isPrivate,omitzero"`
	FixedMember         *bool             `json:"fixedMember,omitzero"`
	UseMultiThread      *bool             `json:"useMultiThread,omitzero"`
	ShowAnnouncement    *bool             `json:"showAnnouncement,omitzero"`
	ShowThreadList      *bool             `json:"showThreadList,omitzero"`
	ShowAppList         *bool             `json:"showAppList,omitzero"`
	ShowMemberList      *bool             `json:"showMemberList,omitzero"`
	ShowRelatedLinkList *bool             `json:"showRelatedLinkList,omitzero"`
	Permissions         *SpacePermissions `json:"permissions,omitzero"`
}

UpdateSpaceRequest is the request of Client.UpdateSpace.

type UpdateThreadRequest

type UpdateThreadRequest struct {
	ID   int64   `json:"id"`
	Name string  `json:"name,omitzero"`
	Body *string `json:"body,omitzero"`
}

UpdateThreadRequest is the request of Client.UpdateThread.

type UpdatedAppAction

type UpdatedAppAction struct {
	ID int64 `json:"id,string"`
}

UpdatedAppAction is an action updated by Client.UpdateAppActions.

type UpdatedAppActions

type UpdatedAppActions struct {
	Actions  map[string]UpdatedAppAction `json:"actions"`
	Revision int64                       `json:"revision,string"`
}

UpdatedAppActions is the response of Client.UpdateAppActions, which has the action IDs keyed by the action name.

type UpdatedRecord

type UpdatedRecord struct {
	ID        int64     `json:"id,string"`
	Revision  int64     `json:"revision,string"`
	Operation Operation `json:"operation"`
}

UpdatedRecord is a record updated by Client.UpdateRecords or Client.UpsertRecords.

type UpdatedReport

type UpdatedReport struct {
	ID int64 `json:"id,string"`
}

UpdatedReport is a graph updated by Client.UpdateReports.

type UpdatedReports

type UpdatedReports struct {
	Reports  map[string]UpdatedReport `json:"reports"`
	Revision int64                    `json:"revision,string"`
}

UpdatedReports is the response of Client.UpdateReports, which has the graph IDs keyed by the graph name.

type UpdatedView

type UpdatedView struct {
	ID int64 `json:"id,string"`
}

UpdatedView is a view updated by Client.UpdateViews.

type UpdatedViews

type UpdatedViews struct {
	Views    map[string]UpdatedView `json:"views"`
	Revision int64                  `json:"revision,string"`
}

UpdatedViews is the response of Client.UpdateViews, which has the view IDs keyed by the view name.

type View

type View struct {
	ID          int64           `json:"id,string,omitzero"`
	Name        string          `json:"name,omitzero"`
	Type        ViewType        `json:"type"`
	BuiltinType ViewBuiltinType `json:"builtinType,omitzero"`
	Index       int             `json:"index,string"`
	Fields      []string        `json:"fields,omitzero"`
	Date        string          `json:"date,omitzero"`
	Title       string          `json:"title,omitzero"`
	HTML        string          `json:"html,omitzero"`
	Pager       *bool           `json:"pager,omitzero"`
	Device      ViewDevice      `json:"device,omitzero"`
	FilterCond  *string         `json:"filterCond,omitzero"`
	Sort        *string         `json:"sort,omitzero"`
}

View is the setting of a view of an app.

Fields is used by list views, Date and Title by calendar views, and HTML, Pager and Device by custom views.

type ViewBuiltinType

type ViewBuiltinType string

ViewBuiltinType is the type of a view created by kintone.

const (
	ViewBuiltinTypeAssignee ViewBuiltinType = "ASSIGNEE"
)

View builtin types.

type ViewDevice

type ViewDevice string

ViewDevice is the devices to show a custom view on.

const (
	ViewDeviceDesktop ViewDevice = "DESKTOP"
	ViewDeviceAny     ViewDevice = "ANY"
)

View devices.

type ViewType

type ViewType string

ViewType is the type of a view.

const (
	ViewTypeList     ViewType = "LIST"
	ViewTypeCalendar ViewType = "CALENDAR"
	ViewTypeCustom   ViewType = "CUSTOM"
)

View types.

type Views

type Views struct {
	Views    map[string]View `json:"views"`
	Revision int64           `json:"revision,string"`
}

Views is the views of an app, keyed by the view name.

type WarningError

type WarningError struct {
	Message string
}

WarningError is a warning in the X-Cybozu-Warning response header.

func (*WarningError) Error

func (e *WarningError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL