Documentation
¶
Overview ¶
Package anytype provides a Go SDK for interacting with the Anytype API.
Index ¶
- Constants
- Variables
- func RegisterClientConstructor(constructor clientConstructor)
- type AuthClient
- type Client
- type ClientOption
- type ClientOptions
- type CreateApiKeyResponse
- type CreateChallengeResponse
- type CreateObjectRequest
- type CreatePropertyRequest
- type CreateSpaceRequest
- type CreateTagRequest
- type CreateTypeRequest
- type FilterCondition
- type FilterExpression
- type FilterFormat
- type FilterItem
- func CheckboxFilter(key string, condition FilterCondition, checked bool) FilterItem
- func DateFilter(key string, condition FilterCondition, date string) FilterItem
- func EmailFilter(key string, condition FilterCondition, email string) FilterItem
- func EmptyFilter(key string, condition FilterCondition) FilterItem
- func FilesFilter(key string, condition FilterCondition, fileIDs []string) FilterItem
- func MultiSelectFilter(key string, condition FilterCondition, tagIDs []string) FilterItem
- func NumberFilter(key string, condition FilterCondition, number float64) FilterItem
- func ObjectsFilter(key string, condition FilterCondition, objectIDs []string) FilterItem
- func PhoneFilter(key string, condition FilterCondition, phone string) FilterItem
- func SelectFilter(key string, condition FilterCondition, tagID string) FilterItem
- func TextFilter(key string, condition FilterCondition, text string) FilterItem
- func URLFilter(key string, condition FilterCondition, url string) FilterItem
- type FilterOperator
- type GetOption
- type GetOptions
- type Icon
- type IconFormat
- type ListContext
- type ListFilter
- type ListOption
- type ListOptions
- type ListSort
- type ListView
- type Member
- type MemberClient
- type MemberContext
- type MemberListResponse
- type MemberResponse
- type MemberRole
- type MemberStatus
- type Object
- type ObjectClient
- type ObjectContext
- type ObjectListClient
- type ObjectListContext
- type ObjectListResponse
- type ObjectResponse
- type ObjectViewClient
- type Pagination
- type Property
- type PropertyContext
- type PropertyDefinition
- type PropertyLinkWithValue
- type PropertyResponse
- type SearchClient
- type SearchRequest
- type SearchResponse
- type SortDirection
- type SortOptions
- type SortProperty
- type Space
- type SpaceClient
- type SpaceContext
- type SpaceListResponse
- type SpacePropertyClient
- type SpaceResponse
- type Tag
- type TagClient
- type TagContext
- type TagResponse
- type TemplateClient
- type TemplateContext
- type TemplateResponse
- type Type
- type TypeClient
- type TypeContext
- type TypeResponse
- type UpdateObjectRequest
- type UpdatePropertyRequest
- type UpdateSpaceRequest
- type UpdateTagRequest
- type UpdateTypeRequest
- type VersionInfo
- type ViewClient
- type ViewContext
- type ViewListResponse
Constants ¶
View Source
const ( MemberRoleViewer MemberRole = "viewer" MemberRoleEditor MemberRole = "editor" MemberRoleOwner MemberRole = "owner" MemberRoleNoPermission MemberRole = "no_permission" MemberStatusJoining MemberStatus = "joining" MemberStatusActive MemberStatus = "active" MemberStatusRemoved MemberStatus = "removed" MemberStatusDeclined MemberStatus = "declined" MemberStatusRemoving MemberStatus = "removing" MemberStatusCanceled MemberStatus = "canceled" )
View Source
const ( SortPropertyCreatedDate SortProperty = "created_date" SortPropertyLastModifiedDate SortProperty = "last_modified_date" SortPropertyLastOpenedDate SortProperty = "last_opened_date" SortPropertyName SortProperty = "name" SortDirectionAsc SortDirection = "asc" SortDirectionDesc SortDirection = "desc" )
View Source
const ( // Follows AnyType Versioning Version = "0.53.1" APIVersion = "2025-11-08" )
Variables ¶
View Source
var ErrTypeNotFound = errors.New("type not found")
Functions ¶
func RegisterClientConstructor ¶
func RegisterClientConstructor(constructor clientConstructor)
Types ¶
type AuthClient ¶
type Client ¶
type Client interface {
Auth() AuthClient
Spaces() SpaceClient
Space(spaceID string) SpaceContext
Search() SearchClient
}
func NewClient ¶
func NewClient(opts ...ClientOption) Client
type ClientOption ¶
type ClientOption func(*ClientOptions)
func WithAppKey ¶
func WithAppKey(appKey string) ClientOption
func WithBaseURL ¶
func WithBaseURL(url string) ClientOption
type ClientOptions ¶
type CreateApiKeyResponse ¶ added in v0.4.0
type CreateApiKeyResponse struct {
ApiKey string `json:"api_key"`
}
type CreateChallengeResponse ¶ added in v0.4.0
type CreateChallengeResponse struct {
ChallengeID string `json:"challenge_id"`
}
type CreateObjectRequest ¶
type CreatePropertyRequest ¶ added in v0.53.1
type CreatePropertyRequest struct {
Name string `json:"name"`
Format string `json:"format"`
Key string `json:"key,omitempty"`
Tags []CreateTagRequest `json:"tags,omitempty"`
}
type CreateSpaceRequest ¶
type CreateTagRequest ¶ added in v0.53.1
type CreateTypeRequest ¶ added in v0.3.4
type FilterCondition ¶ added in v0.53.1
type FilterCondition string
const ( FilterConditionEq FilterCondition = "eq" FilterConditionNe FilterCondition = "ne" FilterConditionIn FilterCondition = "in" FilterConditionNin FilterCondition = "nin" FilterConditionEmpty FilterCondition = "empty" FilterConditionNEmpty FilterCondition = "nempty" FilterConditionContains FilterCondition = "contains" FilterConditionNContains FilterCondition = "ncontains" FilterConditionGt FilterCondition = "gt" FilterConditionLt FilterCondition = "lt" FilterConditionGte FilterCondition = "gte" FilterConditionLte FilterCondition = "lte" FilterConditionAll FilterCondition = "all" )
type FilterExpression ¶ added in v0.53.1
type FilterExpression struct {
Operator FilterOperator `json:"operator,omitempty"`
Filters []FilterExpression `json:"filters,omitempty"`
Conditions []FilterItem `json:"conditions,omitempty"`
}
type FilterFormat ¶ added in v0.53.1
type FilterFormat string
FilterFormat determines which JSON field name is used when serializing filter values. The API expects format-specific field names (e.g. "text", "number", "checkbox") rather than generic "value" fields.
const ( FilterFormatText FilterFormat = "text" FilterFormatNumber FilterFormat = "number" FilterFormatSelect FilterFormat = "select" FilterFormatMultiSelect FilterFormat = "multi_select" FilterFormatDate FilterFormat = "date" FilterFormatCheckbox FilterFormat = "checkbox" FilterFormatFiles FilterFormat = "files" FilterFormatURL FilterFormat = "url" FilterFormatEmail FilterFormat = "email" FilterFormatPhone FilterFormat = "phone" FilterFormatObjects FilterFormat = "objects" )
type FilterItem ¶ added in v0.53.1
type FilterItem struct {
Key string `json:"-"`
Format FilterFormat `json:"-"`
Condition FilterCondition `json:"-"`
Value interface{} `json:"-"`
}
FilterItem represents a single filter condition. Set Format to indicate which type of filter value is being used (e.g. FilterFormatText, FilterFormatCheckbox). For empty/nempty conditions, Format and Value can be omitted.
func CheckboxFilter ¶ added in v0.53.1
func CheckboxFilter(key string, condition FilterCondition, checked bool) FilterItem
func DateFilter ¶ added in v0.53.1
func DateFilter(key string, condition FilterCondition, date string) FilterItem
func EmailFilter ¶ added in v0.53.1
func EmailFilter(key string, condition FilterCondition, email string) FilterItem
func EmptyFilter ¶ added in v0.53.1
func EmptyFilter(key string, condition FilterCondition) FilterItem
func FilesFilter ¶ added in v0.53.1
func FilesFilter(key string, condition FilterCondition, fileIDs []string) FilterItem
func MultiSelectFilter ¶ added in v0.53.1
func MultiSelectFilter(key string, condition FilterCondition, tagIDs []string) FilterItem
func NumberFilter ¶ added in v0.53.1
func NumberFilter(key string, condition FilterCondition, number float64) FilterItem
func ObjectsFilter ¶ added in v0.53.1
func ObjectsFilter(key string, condition FilterCondition, objectIDs []string) FilterItem
func PhoneFilter ¶ added in v0.53.1
func PhoneFilter(key string, condition FilterCondition, phone string) FilterItem
func SelectFilter ¶ added in v0.53.1
func SelectFilter(key string, condition FilterCondition, tagID string) FilterItem
func TextFilter ¶ added in v0.53.1
func TextFilter(key string, condition FilterCondition, text string) FilterItem
func URLFilter ¶ added in v0.53.1
func URLFilter(key string, condition FilterCondition, url string) FilterItem
func (FilterItem) MarshalJSON ¶ added in v0.53.1
func (f FilterItem) MarshalJSON() ([]byte, error)
func (*FilterItem) UnmarshalJSON ¶ added in v0.53.1
func (f *FilterItem) UnmarshalJSON(data []byte) error
type FilterOperator ¶ added in v0.53.1
type FilterOperator string
const ( FilterOperatorAnd FilterOperator = "and" FilterOperatorOr FilterOperator = "or" )
type GetOption ¶ added in v0.53.1
type GetOption func(*GetOptions)
func WithFormat ¶ added in v0.53.1
type GetOptions ¶ added in v0.53.1
type GetOptions struct {
Format string
}
func ApplyGetOptions ¶ added in v0.53.1
func ApplyGetOptions(opts ...GetOption) GetOptions
type Icon ¶
type Icon struct {
Format IconFormat `json:"format,omitempty"`
Emoji string `json:"emoji,omitempty"`
File string `json:"file,omitempty"`
Name string `json:"name,omitempty"`
Color string `json:"color,omitempty"`
}
type IconFormat ¶
type IconFormat string
const ( IconFormatEmoji IconFormat = "emoji" IconFormatFile IconFormat = "file" IconFormatIcon IconFormat = "icon" )
type ListContext ¶
type ListContext interface {
Views() ViewClient
View(viewID string) ViewContext
Objects() ObjectListClient
Object(objectID string) ObjectListContext
}
type ListFilter ¶
type ListOption ¶ added in v0.53.1
type ListOption func(*ListOptions)
func WithLimit ¶ added in v0.53.1
func WithLimit(limit int) ListOption
func WithOffset ¶ added in v0.53.1
func WithOffset(offset int) ListOption
type ListOptions ¶ added in v0.53.1
func ApplyListOptions ¶ added in v0.53.1
func ApplyListOptions(opts ...ListOption) ListOptions
type ListView ¶
type ListView struct {
ID string `json:"id"`
Name string `json:"name"`
Layout string `json:"layout"`
Filters []ListFilter `json:"filters,omitempty"`
Sorts []ListSort `json:"sorts,omitempty"`
}
type Member ¶
type Member struct {
ID string `json:"id"`
Object string `json:"object"`
Name string `json:"name"`
GlobalName string `json:"global_name"`
Identity string `json:"identity"`
Role MemberRole `json:"role"`
Status MemberStatus `json:"status"`
Icon *Icon `json:"icon,omitempty"`
}
type MemberClient ¶
type MemberClient interface {
List(ctx context.Context) (*MemberListResponse, error)
}
type MemberContext ¶
type MemberContext interface {
Get(ctx context.Context) (*MemberResponse, error)
}
type MemberListResponse ¶
type MemberListResponse struct {
Data []Member `json:"data"`
Pagination Pagination `json:"pagination"`
}
type MemberResponse ¶
type MemberResponse struct {
Member Member `json:"member"`
}
type MemberRole ¶
type MemberRole string
type MemberStatus ¶
type MemberStatus string
type Object ¶
type Object struct {
ID string `json:"id"`
Object string `json:"object"`
Name string `json:"name"`
SpaceID string `json:"space_id"`
Layout string `json:"layout"`
Archived bool `json:"archived"`
Icon *Icon `json:"icon,omitempty"`
Snippet string `json:"snippet"`
Properties []Property `json:"properties"`
Type *Type `json:"type,omitempty"`
Markdown string `json:"markdown,omitempty"`
}
type ObjectClient ¶
type ObjectClient interface {
List(ctx context.Context, opts ...ListOption) ([]Object, error)
Create(ctx context.Context, request CreateObjectRequest) (*ObjectResponse, error)
}
type ObjectContext ¶
type ObjectContext interface {
Get(ctx context.Context, opts ...GetOption) (*ObjectResponse, error)
Update(ctx context.Context, request UpdateObjectRequest) (*ObjectResponse, error)
Delete(ctx context.Context) (*ObjectResponse, error)
}
type ObjectListClient ¶
type ObjectListContext ¶
type ObjectListResponse ¶
type ObjectListResponse struct {
Data []Object `json:"data"`
Pagination Pagination `json:"pagination"`
}
type ObjectResponse ¶
type ObjectResponse struct {
Object *Object `json:"object"`
}
type ObjectViewClient ¶
type ObjectViewClient interface {
List(ctx context.Context) (*ObjectListResponse, error)
}
type Pagination ¶ added in v0.53.1
type Property ¶
type Property struct {
ID string `json:"id,omitempty"`
Format string `json:"format,omitempty"`
Key string `json:"key,omitempty"`
Name string `json:"name,omitempty"`
Object string `json:"object,omitempty"`
Text string `json:"text,omitempty"`
Number float64 `json:"number,omitempty"`
Checkbox bool `json:"checkbox,omitempty"`
Date string `json:"date,omitempty"`
URL string `json:"url,omitempty"`
Email string `json:"email,omitempty"`
Phone string `json:"phone,omitempty"`
Files []string `json:"files,omitempty"`
Select *Tag `json:"select,omitempty"`
MultiSelect []Tag `json:"multi_select,omitempty"`
Objects []string `json:"objects,omitempty"`
}
type PropertyContext ¶ added in v0.53.1
type PropertyContext interface {
Get(ctx context.Context) (*PropertyResponse, error)
Update(ctx context.Context, request UpdatePropertyRequest) (*PropertyResponse, error)
Delete(ctx context.Context) (*PropertyResponse, error)
Tags() TagClient
Tag(tagID string) TagContext
}
type PropertyDefinition ¶
type PropertyLinkWithValue ¶ added in v0.53.1
type PropertyLinkWithValue struct {
Key string `json:"key"`
Text *string `json:"text,omitempty"`
Number *float64 `json:"number,omitempty"`
Checkbox *bool `json:"checkbox,omitempty"`
Date *string `json:"date,omitempty"`
URL *string `json:"url,omitempty"`
Email *string `json:"email,omitempty"`
Phone *string `json:"phone,omitempty"`
Files []string `json:"files,omitempty"`
Select *string `json:"select,omitempty"`
MultiSelect []string `json:"multi_select,omitempty"`
Objects []string `json:"objects,omitempty"`
}
type PropertyResponse ¶ added in v0.53.1
type PropertyResponse struct {
Property Property `json:"property"`
}
type SearchClient ¶
type SearchClient interface {
Search(ctx context.Context, request SearchRequest) (*SearchResponse, error)
}
type SearchRequest ¶
type SearchRequest struct {
Query string `json:"query"`
Types []string `json:"types,omitempty"`
Sort *SortOptions `json:"sort,omitempty"`
Filters *FilterExpression `json:"filters,omitempty"`
}
type SearchResponse ¶
type SearchResponse struct {
Data []Object `json:"data"`
Pagination Pagination `json:"pagination"`
}
type SortDirection ¶
type SortDirection string
type SortOptions ¶
type SortOptions struct {
Property SortProperty `json:"property_key"`
Direction SortDirection `json:"direction"`
}
type SortProperty ¶
type SortProperty string
type SpaceClient ¶
type SpaceClient interface {
List(ctx context.Context) (*SpaceListResponse, error)
Create(ctx context.Context, request CreateSpaceRequest) (*SpaceResponse, error)
}
type SpaceContext ¶
type SpaceContext interface {
Get(ctx context.Context) (*SpaceResponse, error)
Update(ctx context.Context, request UpdateSpaceRequest) (*SpaceResponse, error)
Objects() ObjectClient
Object(objectID string) ObjectContext
Types() TypeClient
Type(typeID string) TypeContext
Search(ctx context.Context, request SearchRequest) (*SearchResponse, error)
List(listID string) ListContext
Members() MemberClient
Member(memberID string) MemberContext
Properties() SpacePropertyClient
Property(propertyID string) PropertyContext
}
type SpaceListResponse ¶
type SpaceListResponse struct {
Data []Space `json:"data"`
Pagination Pagination `json:"pagination"`
}
type SpacePropertyClient ¶ added in v0.53.1
type SpacePropertyClient interface {
List(ctx context.Context) ([]Property, error)
Create(ctx context.Context, request CreatePropertyRequest) (*PropertyResponse, error)
}
type SpaceResponse ¶
type SpaceResponse struct {
Space Space `json:"space"`
}
type TagClient ¶ added in v0.53.1
type TagClient interface {
List(ctx context.Context) ([]Tag, error)
Create(ctx context.Context, request CreateTagRequest) (*TagResponse, error)
}
type TagContext ¶ added in v0.53.1
type TagContext interface {
Get(ctx context.Context) (*TagResponse, error)
Update(ctx context.Context, request UpdateTagRequest) (*TagResponse, error)
Delete(ctx context.Context) (*TagResponse, error)
}
type TagResponse ¶ added in v0.53.1
type TagResponse struct {
Tag Tag `json:"tag"`
}
type TemplateContext ¶
type TemplateContext interface {
Get(ctx context.Context) (*TemplateResponse, error)
}
type TemplateResponse ¶
type TemplateResponse struct {
Template Object `json:"template"`
}
type Type ¶
type Type struct {
ID string `json:"id"`
Key string `json:"key"`
Name string `json:"name"`
Object string `json:"object"`
Icon *Icon `json:"icon,omitempty"`
Layout string `json:"layout"`
Archived bool `json:"archived"`
PluralName string `json:"plural_name,omitempty"`
Properties []Property `json:"properties,omitempty"`
}
type TypeClient ¶
type TypeContext ¶
type TypeContext interface {
Get(ctx context.Context) (*TypeResponse, error)
Update(ctx context.Context, request UpdateTypeRequest) (*TypeResponse, error)
Delete(ctx context.Context) (*TypeResponse, error)
Templates() TemplateClient
Template(templateID string) TemplateContext
}
type TypeResponse ¶
type TypeResponse struct {
Type Type `json:"type"`
}
type UpdateObjectRequest ¶
type UpdateObjectRequest struct {
Name string `json:"name,omitempty"`
Markdown string `json:"markdown,omitempty"`
Icon *Icon `json:"icon,omitempty"`
TypeKey string `json:"type_key,omitempty"`
Properties []PropertyLinkWithValue `json:"properties,omitempty"`
}
type UpdatePropertyRequest ¶ added in v0.53.1
type UpdateSpaceRequest ¶
type UpdateTagRequest ¶ added in v0.53.1
type UpdateTypeRequest ¶ added in v0.53.1
type VersionInfo ¶
func GetVersionInfo ¶
func GetVersionInfo() VersionInfo
type ViewClient ¶
type ViewClient interface {
List(ctx context.Context) (*ViewListResponse, error)
}
type ViewContext ¶
type ViewContext interface {
Objects() ObjectViewClient
}
type ViewListResponse ¶
type ViewListResponse struct {
Data []ListView `json:"data"`
Pagination Pagination `json:"pagination"`
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package client implements the client interfaces defined in the anytype package
|
Package client implements the client interfaces defined in the anytype package |
|
Package middleware provides HTTP middleware components for the anytype client
|
Package middleware provides HTTP middleware components for the anytype client |
Click to show internal directories.
Click to hide internal directories.