Skip to content

Commit b35f006

Browse files
committed
Move createOrUpdateFiles to the root object
1 parent 9860a71 commit b35f006

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Octokit = Octokit.plugin(require("octokit-commit-multiple-files"));
2222

2323
const octokit = new Octokit();
2424

25-
const commits = await octokit.rest.repos.createOrUpdateFiles({
25+
const commits = await octokit.createOrUpdateFiles({
2626
owner,
2727
repo,
2828
branch,
@@ -52,7 +52,7 @@ I hope it works`,
5252
If you want to upload non-text data, you can `base64`` encode the content and provide that as the value. Here's an example that would upload a small GitHub icon to a repository:
5353

5454
```javascript
55-
const commits = await octokit.rest.repos.createOrUpdateFiles({
55+
const commits = await octokit.createOrUpdateFiles({
5656
owner,
5757
repo,
5858
branch,

create-or-update-files.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ test("failure (fileToDelete is missing)", async () => {
448448
test("Loads plugin", () => {
449449
const TestOctokit = Octokit.plugin(require("."));
450450
const testOctokit = new TestOctokit();
451-
expect(testOctokit).toHaveProperty("rest.repos.createOrUpdateFiles");
451+
expect(testOctokit).toHaveProperty("createOrUpdateFiles");
452452
});
453453

454454
test("Does not overwrite other methods", () => {

index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
const plugin = require("./create-or-update-files");
22

33
module.exports = function (octokit) {
4-
octokit.rest.repos.createOrUpdateFiles = plugin.bind(null, octokit);
4+
return {
5+
createOrUpdateFiles: plugin.bind(null, octokit),
6+
};
57
};

0 commit comments

Comments
 (0)