Skip to content

Commit 8268a78

Browse files
committed
fixes
1 parent f6052d2 commit 8268a78

File tree

4 files changed

+31
-7
lines changed

4 files changed

+31
-7
lines changed

components/apiary/actions/create-api-project/create-api-project.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export default {
3333
],
3434
},
3535
},
36-
3736
async run({ $ }) {
3837
const response = await this.app.createApiProject({
3938
$,

components/apiary/actions/fetch-blueprint/fetch-blueprint.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export default {
1515
],
1616
},
1717
},
18-
1918
async run({ $ }) {
2019
const response = await this.app.fetchBlueprint({
2120
$,

components/apiary/actions/publish-blueprint/publish-blueprint.mjs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,20 @@ export default {
1414
"apiSubdomain",
1515
],
1616
},
17+
code: {
18+
propDefinition: [
19+
app,
20+
"code",
21+
],
22+
},
1723
},
18-
1924
async run({ $ }) {
2025
const response = await this.app.publishBlueprint({
2126
$,
2227
apiSubdomain: this.apiSubdomain,
28+
data: {
29+
code: this.code,
30+
},
2331
});
2432

2533
$.export("$summary", `Successfully published the blueprint with the subdomain '${this.apiSubdomain}'`);

components/apiary/apiary.app.mjs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,26 +46,41 @@ export default {
4646
_baseUrl() {
4747
return "https://api.apiary.io";
4848
},
49+
_headers({
50+
headers = {}, legacy = false,
51+
}) {
52+
return legacy
53+
? {
54+
...headers,
55+
Authentication: `Token ${this.$auth.token}`,
56+
}
57+
: {
58+
...headers,
59+
Authorization: `Bearer ${this.$auth.token}`,
60+
};
61+
},
4962
async _makeRequest(opts = {}) {
5063
const {
5164
$ = this,
5265
path,
5366
headers,
67+
legacy,
5468
...otherOpts
5569
} = opts;
5670
return axios($, {
5771
...otherOpts,
5872
url: this._baseUrl() + path,
59-
headers: {
60-
...headers,
61-
Authorization: `Bearer ${this.$auth.token}`,
62-
},
73+
headers: this._headers({
74+
headers,
75+
legacy,
76+
}),
6377
});
6478
},
6579
async createApiProject(args = {}) {
6680
return this._makeRequest({
6781
path: "/blueprint/create",
6882
method: "post",
83+
legacy: true,
6984
...args,
7085
});
7186
},
@@ -74,6 +89,7 @@ export default {
7489
}) {
7590
return this._makeRequest({
7691
path: `/blueprint/get/${apiSubdomain}`,
92+
legacy: true,
7793
...args,
7894
});
7995
},
@@ -82,6 +98,8 @@ export default {
8298
}) {
8399
return this._makeRequest({
84100
path: `/blueprint/publish/${apiSubdomain}`,
101+
method: "post",
102+
legacy: true,
85103
...args,
86104
});
87105
},

0 commit comments

Comments
 (0)