Skip to content

Commit

Permalink
Update file title (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
NazarLysyi committed May 16, 2023
1 parent 69de21d commit e674905
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@crowdin/crowdin-apps-functions",
"version": "0.5.0",
"version": "0.5.1",
"description": "Utility library to easily and quickly develop Crowdin App",
"main": "out/index.js",
"types": "out/index.d.ts",
Expand Down
11 changes: 11 additions & 0 deletions src/crowdin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ export async function updateOrCreateFile(
await options.client.sourceFilesApi.updateOrRestoreFile(options.projectId, options.file.id, {
storageId: storageFile.data.id,
});

if (options.title && options.title !== options.file.title) {
await options.client.sourceFilesApi.editFile(options.projectId, options.file.id, [
{
value: options.title,
op: 'replace',
path: '/title',
},
]);
}

//@ts-ignore
return options.file.id;
} else {
Expand Down

0 comments on commit e674905

Please sign in to comment.