schema

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnsupportedType is returned if the type is not implemented
	ErrUnsupportedType = errors.New("unsupported type")
)

Functions

func BoolPtr

func BoolPtr(v bool) *bool

func StrPtr

func StrPtr(v string) *string

Types

type ACL

type ACL struct {
	Read    bool  `json:"read"`
	Create  *bool `json:"create,omitempty"`
	Update  *bool `json:"update,omitempty"`
	Delete  *bool `json:"delete,omitempty"`
	SubACL  *ACL  `json:"sub_acl,omitempty"`
	Publish *bool `json:"publish,omitempty"`
}

type BlockSet

type BlockSet struct {
	Title  string  `json:"title"`
	Uid    string  `json:"uid"`
	Schema []Field `json:"schema"`
}

BlockSet is a way to group fields

type Choice

type Choice struct {
	Value string `json:"value"`
}

type ContentType

type ContentType struct {
	Title             string               `json:"title"`
	Description       string               `json:"description"`
	Options           Options              `json:"options"`
	Schema            []Field              `json:"schema"`
	UID               string               `json:"uid"`
	DefaultACL        DefaultACL           `json:"DEFAULT_ACL"`
	SysACL            SysACL               `json:"SYS_ACL"`
	CreatedAt         string               `json:"created_at"`
	UpdatedAt         string               `json:"updated_at"`
	InbuiltClass      bool                 `json:"inbuilt_class"`
	Abilities         ContentTypeAbilities `json:"abilities"`
	LastActivity      LastActivity         `json:"last_activity"`
	MaintainRevisions bool                 `json:"maintain_revisions"`
	Version           int64                `json:"_version"`
	Url               string               `json:"url,omitempty"`
}

type ContentTypeAbilities

type ContentTypeAbilities struct {
	GetOneObject     bool `json:"get_one_object"`
	GetAllObjects    bool `json:"get_all_objects"`
	CreateObject     bool `json:"create_object"`
	UpdateObject     bool `json:"update_object"`
	DeleteObject     bool `json:"delete_object"`
	DeleteAllObjects bool `json:"delete_all_objects"`
}

type DefaultACL

type DefaultACL struct {
	Others ACL           `json:"others"`
	Users  []interface{} `json:"users"`
}

type EnumField

type EnumField struct {
	Advanced bool     `json:"advanced"`
	Choices  []Choice `json:"choices"`
}

type ErrorMessages

type ErrorMessages struct {
	Format string `json:"format"`
}

type Field

type Field struct {
	DataType       string         `json:"data_type"`
	DisplayName    string         `json:"display_name"`
	Uid            string         `json:"uid"`
	FieldMetadata  FieldMetadata  `json:"field_metadata"`
	Format         *string        `json:"format,omitempty"`
	ErrorMessages  *ErrorMessages `json:"error_messages,omitempty"`
	Mandatory      bool           `json:"mandatory"`
	Multiple       bool           `json:"multiple"`
	NonLocalizable *bool          `json:"non_localizable,omitempty"`
	Unique         *bool          `json:"unique,omitempty"`
	Indexed        *bool          `json:"indexed,omitempty"`
	InbuiltModel   *bool          `json:"inbuilt_model,omitempty"`
	Blocks         []BlockSet     `json:"blocks,omitempty"`
	ReferenceTo    StrArray       `json:"reference_to,omitempty"`
	DisplayType    *string        `json:"display_type,omitempty"`
	Enum           *EnumField     `json:"enum,omitempty"`
}

type FieldMetadata

type FieldMetadata struct {
	Description  string      `json:"description"`
	Default      *bool       `json:"_default,omitempty"`
	DefaultValue interface{} `json:"default_value,omitempty"`
	Placeholder  *string     `json:"placeholder,omitempty"`
	Instruction  *string     `json:"instruction,omitempty"`
	Version      *int64      `json:"version,omitempty"`
}

func (FieldMetadata) IsDefaultValue

func (f FieldMetadata) IsDefaultValue() bool

type File

type File struct {
	SchemaVersion  int64                  `json:"_version"`
	ACL            map[string]interface{} `json:"acl"`
	ContentType    string                 `json:"content_type"`
	CreatedAt      string                 `json:"created_at,omitempty"`
	CreatedBy      string                 `json:"created_by,omitempty"`
	FileSize       string                 `json:"file_size,omitempty"`
	Filename       string                 `json:"filename,omitempty"`
	IsDir          *bool                  `json:"is_dir,omitempty"`
	ParentUID      string                 `json:"parent_uid,omitempty"`
	PublishDetails *FilePublishDetails    `json:"publish_details,omitempty"`
	Tags           []string               `json:"tags"`
	Title          string                 `json:"title"`
	UID            string                 `json:"uid"`
	Url            string                 `json:"url"`
	UpdatedAt      string                 `json:"updated_at,omitempty"`
	UpdatedBy      string                 `json:"updated_by,omitempty"`
}

File is one of the predefined ContentTypes

type FilePublishDetails

type FilePublishDetails struct {
	Environment string `json:"environment,omitempty"`
	Locale      string `json:"locale,omitempty"`
	Time        string `json:"time,omitempty"`
	User        string `json:"user,omitempty"`
}

type GlobalField

type GlobalField struct {
	CreatedAt    string  `json:"created_at"`
	UpdatedAt    string  `json:"updated_at"`
	Title        string  `json:"title"`
	UID          string  `json:"uid"`
	Version      *int64  `json:"_version,omitempty"`
	InbuiltClass *bool   `json:"inbuilt_class,omitempty"`
	Schema       []Field `json:"schema"`

	MaintainRevisions bool          `json:"maintain_revisions"`
	Description       string        `json:"description"`
	LastActivity      *LastActivity `json:"last_activity,omitempty"`
}

type LastActivity

type LastActivity interface{}

type Options

type Options struct {
	IsPage    bool     `json:"is_page"`
	Singleton bool     `json:"singleton"`
	SubTitle  []string `json:"sub_title"`
	Title     string   `json:"title"`
}

type Role

type Role struct {
	Uid         string   `json:"uid"`
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Users       []string `json:"users"`
	CreatedAt   string   `json:"created_at"`
	UpdatedAt   string   `json:"updated_at"`
	APIKey      string   `json:"api_key"`
	Rules       []Rule   `json:"rules"`
}

type Rule

type Rule struct {
	Module       string   `json:"module"`
	Locales      []string `json:"locales"`
	ACL          ACL      `json:"acl"`
	Environments []string `json:"environments"`
	Assets       []string `json:"assets"`
}

type StrArray

type StrArray []string

StrArray string array to be used on JSON UnmarshalJSON adapted from: https://gist.github.com/crgimenes/c3b8b4fcce8529e9201f83c8da134f32

func (*StrArray) MarshalJSON

func (sa *StrArray) MarshalJSON() ([]byte, error)

MarshalJSON provides custom marshalling for a S

func (*StrArray) UnmarshalJSON

func (sa *StrArray) UnmarshalJSON(data []byte) error

UnmarshalJSON convert JSON object array of string or a string format strings to a golang string array

type SysACL

type SysACL struct {
	Others ACL         `json:"others"`
	Roles  interface{} `json:"roles"`
}

type User

type User struct {
	Uid            string   `json:"uid"`
	CreatedAt      string   `json:"created_at"`
	UpdatedAt      string   `json:"updated_at"`
	Email          string   `json:"email"`
	Username       string   `json:"username"`
	FirstName      string   `json:"first_name"`
	LastName       string   `json:"last_name"`
	Company        string   `json:"company"`
	OrgUid         []string `json:"org_uid"`
	SharedOrgUid   []string `json:"shared_org_uid"`
	MobileNumber   string   `json:"mobile_number"`
	CountryCode    string   `json:"country_code"`
	TfaStatus      string   `json:"tfa_status"`
	AuthyID        string   `json:"authy_id"`
	Active         bool     `json:"active"`
	FailedAttempts int64    `json:"failed_attempts"`
	Authtoken      string   `json:"authtoken"`
	Roles          []Role   `json:"roles"`
}

type UserResponse

type UserResponse struct {
	User User `json:"user"`
}

Jump to

Keyboard shortcuts

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