Skip to content

Commit b08a4de

Browse files
authored
Update README.md
1 parent 846f8bd commit b08a4de

File tree

1 file changed

+48
-16
lines changed

1 file changed

+48
-16
lines changed

README.md

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ In order to use this library, please install this library.
2929

3030
1. [Install library](https://developers.google.com/apps-script/guides/libraries).
3131
- Library's project key is **`1nUiajCHQReVwWPq7rNAvsIcWvPptmMUSzeytnzVHDpdoxUIvuX0e_reL`**.
32+
1. Copy the dependencies of the Apps Script ([appsscript.json](#appsscript)).
3233

3334
## About scopes
3435

@@ -43,13 +44,41 @@ About the install of scopes using the library, this library requires manually in
4344
4445
# Methods
4546

46-
| Method | Description |
47+
<a name="methods"></a>
48+
49+
## Libarary
50+
51+
| Method | Description |
52+
| :------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------ |
53+
| **IO_GetSamples** * | Saves file with code examples in the user script. |
54+
| getScriptContent | Retrieves the content of the script file. |
55+
| getScriptFiles | Retrieves a list of files associated with a script based on its script_id. |
56+
| getTemplateScriptFiles | Fetches a list of template files (script_id of the template is defined in the script properties, default template id is set to the library's id). |
57+
| assignTemplate | Initializes the class and sets the ID of the template script as the data source. |
58+
59+
\* - makes changes the script file
60+
61+
<a name="methods_class"></a>
62+
63+
## Library Class
64+
65+
| Method | Description |
4766
| :------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------ |
48-
| getScriptContent | Allows fetching the content of a script file based on its script_id. |
49-
| IO_GetScriptFiles | Retrieves a list of files associated with a script based on its script_id. |
50-
| IO_GetTemplateScriptFiles | Fetches a list of template files (script_id of the template is defined in the script properties; default template id is set to the library's id). |
51-
| IO_UpdateFile | Updates an existing file within the script. |
52-
| IO_AddNewFile | Adds a new file or replaces an existing one within the script. |
67+
| assignTemplate | Initializes the class and sets the ID of the template script as the data source. |
68+
| **Operations** |
69+
| AddNewFile | Adds a new file or replaces an existing one within the script. |
70+
| renameFile | Renames a file within the script. |
71+
| createBlankFile | Creates a new blank file within the script. |
72+
| setCustomSource | Sets the content of the source in a file within the script. |
73+
| addFileToUserJson | Adds a file to the user's script. |
74+
| **General** |
75+
| **commit**\* | Applies the pending changes made to the script. |
76+
| drop | Discards the local changes made to the script, without reverting a commit. |
77+
| viewChanges | Displays a list of changes that will be applied to the script upon committing. |
78+
| getChanges | Retrieves a list of changes that will be applied to the script upon committing. |
79+
| getTemplateId | Retrieves the current ID of the script's template. |
80+
81+
\* - makes changes the script file
5382

5483
# Usage
5584

@@ -75,7 +104,7 @@ appsscript file, json:
75104
{
76105
"userSymbol": "ScriptSync",
77106
"libraryId": "1nUiajCHQReVwWPq7rNAvsIcWvPptmMUSzeytnzVHDpdoxUIvuX0e_reL",
78-
"version": "3"
107+
"version": "4"
79108
}
80109
]
81110
},
@@ -96,21 +125,16 @@ appsscript file, json:
96125
A sample script is as follows. This sample script copying the library to current project.
97126

98127
```javascript
99-
function deploy() {
100-
const filesToCopy = ["lib_common", "lib_main", "lib_sett", "lib_types"];
101-
102-
for (let file of filesToCopy) {
103-
const res = ScriptSync.IO_AddNewFile(file);
104-
if (!res) break;
105-
}
128+
function samples() {
129+
ScriptSync.IO_GetSamples();
106130
}
107131
```
108132

109133
- The template_script_id identifier is stored in the library properties as a `SETTINGS` property, thats:
110134
`{"template_script_id":"1nUiajCHQReVwWPq7rNAvsIcWvPptmMUSzeytnzVHDpdoxUIvuX0e_reL"}`
111135

112136
You can set your script_id as follows:
113-
`ScriptSync.IO_AddNewFile(fromFile, toFile, ScriptId)`
137+
`ScriptSync.assignTemplate(TemplateScriptId)`
114138

115139
You can copy the library and set the property manually or using the method (inside your library):
116140

@@ -137,7 +161,7 @@ The library and your script template must be shared.
137161

138162
# Licence
139163

140-
[MIT](LICENCE)
164+
[MIT](LICENSE)
141165

142166
<a name="author"></a>
143167

@@ -151,6 +175,14 @@ If you have any questions and commissions for me, feel free to tell me.
151175

152176
# Update History
153177

178+
- v2.0.4 (May 12, 2024)
179+
180+
1. Completely rewritten the library code based on classes.
181+
2. Added new methods:
182+
- General class methods: 4 methods of [assignTemplate](#methods_class), [commit](#methods_class), [drop](#methods_class), [viewChanges](#methods_class), [getChanges](#methods_class) and [getTemplateId](#methods_class) were added.
183+
- File operations: 8 methods of [getScriptContent](#methods_class), [AddNewFile](#methods_class), [renameFile](#methods_class), [createBlankFile](#methods_class), [setCustomSource](#methods_class) and [addFileToUserJson](#methods_class) were added.
184+
- [IO_GetSamples](#methods) method.
185+
154186
- v1.0.0 (May 5, 2024)
155187

156188
1. Initial release.

0 commit comments

Comments
 (0)