anytype.Anytype
Used to interact with the Anytype API for authentication, retrieving spaces, creating spaces, and performing global searches. It provides methods to authenticate via a token, fetch spaces, create new spaces, and search for objects across spaces.
Source code in anytype/anytype.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
|
auth(force=False, callback=None)
Authenticates the user by retrieving or creating a session token. If the session token already exists, it validates the token. If not, the user will be prompted to enter a 4-digit code for authentication.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
force
|
bool
|
If True, forces re-authentication even if a token already exists. |
False
|
callback
|
callable
|
A callback function to retrieve the 4-digit code. If None, the user will be prompted to enter the code. |
None
|
Source code in anytype/anytype.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
|
create_space(name)
Creates a new space with a given name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the space to create. |
required |
Returns:
Type | Description |
---|---|
Space
|
A Space instance representing the newly created space. |
Source code in anytype/anytype.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
|
get_spaces(offset=0, limit=10)
Retrieves a list of spaces associated with the authenticated user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
offset
|
int
|
The offset for pagination (default: 0). |
0
|
limit
|
int
|
The limit for the number of results (default: 10). |
10
|
Returns:
Type | Description |
---|---|
list[Space]
|
A list of Space instances. |
Source code in anytype/anytype.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
|
global_search(query, offset=0, limit=10)
Performs a global search for objects across all spaces using a query string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
str
|
The search query string. |
required |
offset
|
int
|
The offset for pagination (default: 0). |
0
|
limit
|
int
|
The limit for the number of results (default: 10). |
10
|
Returns:
Type | Description |
---|---|
list[Object]
|
A list of Object instances that match the search query. |
Source code in anytype/anytype.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
|