playcanvas / playcanvas-sync

Real-time synchronization of files between PlayCanvas and your local machine
https://playcanvas.com/
MIT License
75 stars 18 forks source link

Add method post #51

Closed querielo closed 2 years ago

querielo commented 2 years ago

It can be used as await api.methodPost(PATH, PREF, true, payload);

yaustar commented 2 years ago

What's the context of the PR? I can see a function being added but not used anywhere? 😅

querielo commented 2 years ago

It can be used like this to create a new checkpoint

            await api.methodPost(`/checkpoints`, "/api", true, {
                branchId: PLAYCANVAS_BRANCH_ID,
                description: "My awesome checkpoint",
                projectId: PLAYCANVAS_PROJECT_ID,
            });
yaustar commented 2 years ago

For the purposes of a PR, I'm a bit hesitant to merge code that isn't used as it's quite confusing (why do we have an internal function that isn't used anywhere?)

Do you have plans to use this function in a future PR? If so, I would prefer this to be merged with these changes so it's all in the same context.

willeastcott commented 2 years ago

@yaustar But aren't the functions in api for devs who want to programmatically drive pc-sync with Node? So I'm not sure it's right to say they're internal.

yaustar commented 2 years ago

@yaustar But aren't the functions in api for devs who want to programmatically drive pc-sync with Node? So I'm not sure it's right to say they're internal.

Not really sure about the direction to go here as pc-sync wasn't meant to be a library to be built on top of programmatically.

We could change direction so that it is one and create a public API so that we have a default scripts to do things like push/pull etc

And/Or convert this to a NPM package so that it can used as a library in projects.

querielo commented 2 years ago

The main reason to use pc-sync as a library is ability to create a custom development pipeline with ESNext, Typescript, Eslint, Prettier, CI/CD, review processes and so on.

willeastcott commented 2 years ago

Sounds good. Thanks for the contribution, @querielo! Merging...