Skip to content

Commit 98c9cd7

Browse files
committed
save
1 parent fde8441 commit 98c9cd7

File tree

21 files changed

+732
-71
lines changed

21 files changed

+732
-71
lines changed

docs/en/_meta.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
[
2+
{
3+
"text": "start",
4+
"link": "/guide/start",
5+
"activeMatch": "/guide/start"
6+
},
27
{
38
"text": "docs",
49
"link": "/guide/docs",
510
"activeMatch": "/guide/docs"
611
},
712
{
813
"text": "changelog",
9-
"link": "/guide/start/changelog/",
10-
"activeMatch": "/guide/start/changelog"
14+
"link": "/guide/changelog/",
15+
"activeMatch": "/guide/changelog"
1116
}
1217
]

docs/en/guide/_meta.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
[
22
{
3-
"type": "dir",
3+
"type": "file",
44
"name": "start",
5-
"label": "start",
6-
"collapsible": false,
7-
"collapsed": false
5+
"label": "start"
86
},
97
{
108
"type": "dir",
119
"name": "docs",
1210
"label": "docs",
1311
"collapsible": true,
1412
"collapsed": false
13+
},
14+
{
15+
"type": "file",
16+
"name": "changelog",
17+
"label": "changelog"
1518
}
1619
]

docs/en/guide/changelog.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
outline: true
3+
---
4+
5+
# Changelog
6+
7+
:::details{title=Recent Major Updates}
8+
9+
**Assistant Tools Migration**
10+
11+
- Most importantly, assistant tools have been fully migrated to scripts. You can now **directly create assistant tool scripts through the assistant**, unlocking new levels of flexibility and automation.
12+
13+
**Easier Script Saving from Other Apps**
14+
15+
- You can now quickly save scripts to the Scripting App from other apps like browsers.
16+
17+
**Widget Preview Enhancements**
18+
19+
- Widgets in the preview page are now interactive and properly refresh their UI, providing a more accurate and testable preview experience.
20+
21+
**Script Execution & URL Schemes**
22+
23+
- Added `Script.createDocumentationURLScheme` and `Script.createRunSingleURLScheme` to generate custom deep links for your scripts.
24+
- `Script.run(options)` now supports the `singleMode` parameter to control script execution mode.
25+
- The "Run in App" action in the Shortcuts app also supports configuring `singleMode`.
26+
27+
:::
28+
29+
## 2.1.6
30+
31+
**Assistant Features Update**
32+
33+
- Introduced custom role mode: Define unique roles for assistants beyond coding support.
34+
- Directly @mention assistant tools in the input box for faster interaction.
35+
- Scripts are now automatically saved to the `scripts` folder under the Scripting App's documents folder for easier access and organization.
36+
37+
**Bug Fixes**
38+
39+
- Fixed the issue where **file bookmarks weren't working properly**
40+
- Resolved documentation errors to improve clarity and accuracy

docs/en/guide/docs/contact.md

Lines changed: 265 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,265 @@
1+
# Contact
2+
3+
The `Contact` module in the Scripting app allows you to access and manage contacts on the device. You can create, query, update, and delete contacts, as well as manage contact groups and containers.
4+
5+
## Overview of Data Structures
6+
7+
| Type | Description |
8+
| -------------------------------- | ---------------------------------------------------------------------------- |
9+
| **ContactInfo** | Represents detailed information of a single contact. |
10+
| **ContactContainer** | Represents a contact storage container, such as local, Exchange, or CardDAV. |
11+
| **ContactGroup** | Represents a contact group for categorizing contacts. |
12+
| **ContactLabeledValue** | A labeled value, such as phone number or email address. |
13+
| **ContactPostalAddress** | Represents a postal address. |
14+
| **ContactSocialProfile** | Represents social profile information. |
15+
| **ContactInstantMessageAddress** | Represents instant messaging account information. |
16+
17+
---
18+
19+
## Creating a Contact
20+
21+
```ts
22+
try {
23+
const contact = await Contact.createContact({
24+
givenName: "John",
25+
familyName: "Doe",
26+
phoneNumbers: [{ label: "mobile", value: "+1234567890" }],
27+
emailAddresses: [{ label: "work", value: "john.doe@example.com" }],
28+
});
29+
console.log("Contact created:", contact);
30+
} catch (error) {
31+
console.error("Failed to create contact:", error);
32+
}
33+
```
34+
35+
- Either `givenName` or `familyName` is required.
36+
- You may specify an optional `containerIdentifier`. If not provided, the contact is added to the default container.
37+
- Always handle potential errors due to permission issues or invalid input.
38+
39+
---
40+
41+
## Updating a Contact
42+
43+
```ts
44+
try {
45+
const updated = await Contact.updateContact({
46+
identifier: contact.identifier,
47+
phoneNumbers: [{ label: "home", value: "+9876543210" }],
48+
});
49+
console.log("Contact updated:", updated);
50+
} catch (error) {
51+
console.error("Failed to update contact:", error);
52+
}
53+
```
54+
55+
- `identifier` is required.
56+
- Only the provided fields will be updated; others remain unchanged.
57+
58+
---
59+
60+
## Fetching Contacts
61+
62+
### Fetch a Contact by Identifier
63+
64+
```ts
65+
try {
66+
const contact = await Contact.fetchContact(contactId, { fetchImageData: true });
67+
console.log("Contact fetched:", contact);
68+
} catch (error) {
69+
console.error("Failed to fetch contact:", error);
70+
}
71+
```
72+
73+
### Fetch All Contacts
74+
75+
```ts
76+
try {
77+
const contacts = await Contact.fetchAllContacts({ fetchImageData: false });
78+
console.log("All contacts:", contacts);
79+
} catch (error) {
80+
console.error("Failed to fetch contacts:", error);
81+
}
82+
```
83+
84+
### Fetch Contacts in a Container or Group
85+
86+
```ts
87+
try {
88+
const contacts = await Contact.fetchContactsInContainer(containerId);
89+
console.log("Contacts in container:", contacts);
90+
} catch (error) {
91+
console.error("Failed to fetch contacts in container:", error);
92+
}
93+
94+
try {
95+
const groupContacts = await Contact.fetchContactsInGroup(groupId);
96+
console.log("Contacts in group:", groupContacts);
97+
} catch (error) {
98+
console.error("Failed to fetch contacts in group:", error);
99+
}
100+
```
101+
102+
- Set `fetchImageData` to `true` only if you need the contact's image data.
103+
104+
---
105+
106+
## Deleting a Contact
107+
108+
```ts
109+
try {
110+
await Contact.deleteContact(contactId);
111+
console.log("Contact deleted");
112+
} catch (error) {
113+
console.error("Failed to delete contact:", error);
114+
}
115+
```
116+
117+
---
118+
119+
## Contact Container Management
120+
121+
### Fetch All Containers
122+
123+
```ts
124+
try {
125+
const containers = await Contact.fetchContainers();
126+
console.log("Contact containers:", containers);
127+
} catch (error) {
128+
console.error("Failed to fetch containers:", error);
129+
}
130+
```
131+
132+
### Get the Default Container Identifier
133+
134+
```ts
135+
try {
136+
const defaultContainerId = await Contact.defaultContainerIdentifier;
137+
console.log("Default container ID:", defaultContainerId);
138+
} catch (error) {
139+
console.error("Failed to fetch default container:", error);
140+
}
141+
```
142+
143+
Container types:
144+
145+
- `unassigned`
146+
- `local`
147+
- `exchange`
148+
- `cardDAV`
149+
150+
---
151+
152+
## Contact Group Management
153+
154+
### Create a Contact Group
155+
156+
```ts
157+
try {
158+
const group = await Contact.createGroup("Friends", defaultContainerId);
159+
console.log("Group created:", group);
160+
} catch (error) {
161+
console.error("Failed to create group:", error);
162+
}
163+
```
164+
165+
### Fetch Groups
166+
167+
```ts
168+
try {
169+
const groups = await Contact.fetchGroups();
170+
console.log("Groups:", groups);
171+
} catch (error) {
172+
console.error("Failed to fetch groups:", error);
173+
}
174+
```
175+
176+
### Delete a Group
177+
178+
```ts
179+
try {
180+
await Contact.deleteGroup(groupId);
181+
console.log("Group deleted");
182+
} catch (error) {
183+
console.error("Failed to delete group:", error);
184+
}
185+
```
186+
187+
---
188+
189+
## Managing Contact and Group Relationship
190+
191+
### Add Contact to a Group
192+
193+
```ts
194+
try {
195+
await Contact.addContactToGroup(contactId, groupId);
196+
console.log("Contact added to group");
197+
} catch (error) {
198+
console.error("Failed to add contact to group:", error);
199+
}
200+
```
201+
202+
### Remove Contact from a Group
203+
204+
```ts
205+
try {
206+
await Contact.removeContactFromGroup(contactId, groupId);
207+
console.log("Contact removed from group");
208+
} catch (error) {
209+
console.error("Failed to remove contact from group:", error);
210+
}
211+
```
212+
213+
---
214+
215+
## Example ContactInfo Structure
216+
217+
```json
218+
{
219+
"identifier": "XXXX-XXXX",
220+
"givenName": "John",
221+
"familyName": "Doe",
222+
"phoneNumbers": [{ "label": "mobile", "value": "+1234567890" }],
223+
"emailAddresses": [{ "label": "work", "value": "john@example.com" }],
224+
"postalAddresses": [
225+
{
226+
"label": "home",
227+
"street": "123 Apple St.",
228+
"city": "Cupertino",
229+
"state": "CA",
230+
"postalCode": "95014",
231+
"country": "USA",
232+
"isoCountryCode": "US"
233+
}
234+
]
235+
}
236+
```
237+
238+
---
239+
240+
## Important Notes
241+
242+
- All API operations can fail due to reasons such as lack of permission or invalid parameters. Always use `try-catch`.
243+
- User permission is required to access contacts.
244+
- `imageData` should only be fetched if necessary to reduce memory usage.
245+
- Ensure the `identifier` is valid when performing update or delete operations.
246+
247+
---
248+
249+
## Complete Example: Create and Fetch a Contact
250+
251+
```ts
252+
try {
253+
const contact = await Contact.createContact({
254+
givenName: "Alice",
255+
familyName: "Smith",
256+
phoneNumbers: [{ label: "mobile", value: "+19876543210" }],
257+
});
258+
console.log("Contact created:", contact);
259+
260+
const fetched = await Contact.fetchContact(contact.identifier);
261+
console.log("Fetched contact:", fetched.givenName);
262+
} catch (error) {
263+
console.error("Operation failed:", error);
264+
}
265+
```

docs/en/guide/start.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Welcome to Scripting App
2+
3+
## Key Features
4+
5+
- Customizable editor themes and fonts
6+
- Advanced debugging tools
7+
- Seamless integration with iOS widgets
8+
- Support for App Intents and rich notifications
9+
10+
[View Documentation](/guide/docs/index)
11+
12+
## Getting Started
13+
14+
[Download on the App Store](https://apps.apple.com/app/apple-store/id6479691128) and start building amazing scripts.
15+
16+
## Explore the Power of Scripting
17+
18+
Easily create and run scripts using our powerful TypeScript and TSX development environment. Customize your experience with advanced features to boost productivity.

docs/en/guide/start/changelog.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

docs/en/guide/start/index.md

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)