Skip to content

Commit ee247f6

Browse files
author
Christian Wick
committed
Reverting Introduction Sidebare to "hardcoded" for now.
1 parent 7a79609 commit ee247f6

File tree

7 files changed

+211
-130
lines changed

7 files changed

+211
-130
lines changed

docs/.vuepress/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ module.exports = (ctx) => ({
202202
'.vuepress/nav/top/mainNav.js',
203203
// Sidebars
204204
'.vuepress/nav/sidebars.js',
205+
'.vuepress/nav/left/guides.js',
205206
'.vuepress/nav/left/rest/rest.js',
206207
'.vuepress/nav/left/rest/v1/summary.js',
207208
'.vuepress/nav/left/rest/v1/resources.js',

docs/.vuepress/nav/left/guides.js

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,40 @@
1-
const introduction = require('./guides/introduction.js');
1+
// const introduction = require('./guides/introduction.js');
22
const quickstarts = require('./guides/quickstarts.js');
33
const tutorials = require('./guides/tutorials.js');
44
const best_practices = require('./guides/best-practices.js');
55

6-
76
const overview = {
8-
title: 'Overview',
9-
collapsable: false,
10-
sidebarDepth: 0,
11-
children: [
12-
['/api/guides/', 'Settle API Overview'],
13-
],
14-
}
15-
16-
module.exports = [
17-
overview,
18-
introduction,
19-
quickstarts,
20-
tutorials,
21-
best_practices,
22-
]
7+
title: 'Overview',
8+
collapsable: false,
9+
sidebarDepth: 0,
10+
children: [['/api/guides/', 'Settle API Overview']],
11+
};
2312

13+
/**
14+
* @todo #96 @rexgnu Edit the Introductions Sidabar here. Documents are found in '/docs/api/guides/introduction'.
15+
*/
16+
const introduction = {
17+
title: 'Introduction', // required
18+
collapsable: false,
19+
sidebarDepth: 0,
20+
children: [
21+
'/api/guides/introduction/interacting',
22+
'/api/guides/introduction/callbacks',
23+
'/api/guides/introduction/error-responses',
24+
'/api/guides/introduction/media-type',
25+
'/api/guides/introduction/a-note-on-settle-api-users',
26+
'/api/guides/introduction/versioning',
27+
['/api/guides/introduction/resiliency', 'Resiliency'],
28+
],
29+
};
2430

25-
// function getIntroductionSidebar() {
26-
// return [
27-
// '/introduction/',
28-
// '/introduction/interacting',
29-
// '/introduction/callbacks',
30-
// '/introduction/error-responses',
31-
// '/introduction/media-type',
32-
// '/introduction/a-note-on-settle-api-users',
33-
// '/introduction/versioning',
34-
// ['/introduction/resiliency', 'Resiliency'],
35-
// ];
36-
// }
31+
module.exports = [
32+
overview,
33+
introduction,
34+
// quickstarts,
35+
tutorials,
36+
// best_practices,
37+
];
3738

3839
// function getGuidesSidebar() {
3940
// return [
@@ -46,4 +47,4 @@ module.exports = [
4647
// '/guides/permission-requests',
4748
// '/guides/qr-acceptance',
4849
// ];
49-
// }
50+
// }

docs/.vuepress/theme/components/PageReference.vue

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,10 @@
6868
The above services has the following endpoints (resources), and all
6969
methods below are relative to its parent method (service endpoint).
7070
</p>
71-
<div class="md-api_reference_FiraCode">
71+
<div class="md-api_reference_FiraCode" v-if="!resource.internal">
7272
<!-- REST REsources -->
7373

74-
<section
75-
v-if="!resource.internal"
76-
v-for="(resource, index) in $data.resource"
77-
:key="index"
78-
>
74+
<section v-for="(resource, index) in $data.resource" :key="index">
7975
<h3 :id="'v' + resource.version + '-' + resource.headerAnchor">
8076
<router-link
8177
:to="'#v' + resource.version + '-' + resource.headerAnchor"

docs/.vuepress/theme/components/PageResource.vue

Lines changed: 114 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -64,99 +64,92 @@
6464
</div>
6565
</ul>
6666
</div>
67-
<h3 id="status-codes" v-if="statusCodes">
68-
<a href="#status-codes" class="header-anchor">#</a> Status Codes
69-
</h3>
70-
<ul v-if="statusCodes">
71-
<li v-for="(code, index) in statusCodes" :key="index">
72-
<strong>{{ code.code }}</strong> -->
73-
<!-- <strong>{{ code.title }}</strong>, {{ code.description }} -->
74-
<strong>{{ code.title }}</strong>
75-
<span v-if="code.description">, {{ code.description }}</span>
76-
</li>
77-
</ul>
78-
</div>
79-
<h2 id="schema" v-if="schemas.length">
80-
<a href="#schema" class="header-anchor">#</a> Schema
81-
</h2>
82-
<div class="md-api_reference_FiraCode">
83-
<div v-for="(type, entry) in schemas" :key="entry">
84-
<h3 :id="type.name">
85-
<router-link :to="'#' + type.name" class="header-anchor"
86-
>#</router-link
87-
>
88-
{{ type.name }}
67+
<div v-if="statusCodes.length">
68+
<h3 id="status-codes">
69+
<a href="#status-codes" class="header-anchor">#</a> Status Codes
8970
</h3>
9071
<ul>
91-
<li>
92-
Type:
93-
<!-- <code v-if="type.url && type.type">
94-
<router-link :to="type.url">{{ type.type }}</router-link>
95-
</code> -->
96-
<code v-if="type.$ref">
97-
<router-link
98-
:to="'/api/reference/rest/v1/models/#' + type.$ref"
99-
>{{ type.$ref }}</router-link
100-
>
101-
</code>
102-
<code v-else>{{ type.type }}</code>
103-
</li>
104-
105-
<li v-if="type.required">
106-
Required:
107-
<code class="required">{{ type.required }}</code>
108-
</li>
109-
<li v-if="type.enum">
110-
Enum: <code>{{ type.enum }}</code>
111-
</li>
112-
<li v-if="type.default">
113-
Default: <code>{{ type.default }}</code>
114-
</li>
115-
<li
116-
v-if="
117-
type.minLength &&
118-
type.maxLength &&
119-
type.minLength === type.maxLength
120-
"
121-
>
122-
Length: <code>{{ type.minLength }}</code>
123-
</li>
124-
<li v-else-if="type.minLength">
125-
Length: <code>&#8805; {{ type.minLength }}</code>
126-
</li>
127-
<li v-else-if="type.maxLength">
128-
Length: <code>&#8804; {{ type.maxLength }}</code>
129-
</li>
130-
<li v-if="type.minimum && type.type === 'integer'">
131-
Value: <code>&#8805; {{ type.minimum }}</code>
132-
</li>
133-
<li v-if="type.maximum && type.type === 'integer'">
134-
Value: <code>&#8804; {{ type.maximum }}</code>
135-
</li>
136-
<li v-if="type.pattern">
137-
RegExp: <code>{{ type.pattern }}</code>
72+
<li v-for="(code, index) in statusCodes" :key="index">
73+
<strong>{{ code.code }}</strong> -->
74+
<strong>{{ code.title }}</strong
75+
><span v-if="code.description">, {{ code.description }}</span>
13876
</li>
13977
</ul>
140-
<p v-if="type.description">{{ type.description }}</p>
14178
</div>
14279
</div>
80+
<section v-if="schemas.length">
81+
<h2 id="schema">
82+
<a href="#schema" class="header-anchor">#</a> Schema
83+
</h2>
84+
<div class="md-api_reference_FiraCode">
85+
<div v-for="(type, entry) in schemas" :key="entry">
86+
<h3 :id="type.name">
87+
<router-link :to="'#' + type.name" class="header-anchor"
88+
>#</router-link
89+
>
90+
{{ type.name }}
91+
</h3>
92+
<ul>
93+
<li>
94+
Type:
95+
<!-- <code v-if="type.url && type.type">
96+
<router-link :to="type.url">{{ type.type }}</router-link>
97+
</code> -->
98+
<code v-if="type.$ref">
99+
<router-link
100+
:to="'/api/reference/rest/v1/models/#' + type.$ref"
101+
>{{ type.$ref }}</router-link
102+
>
103+
</code>
104+
<code v-else>{{ type.type }}</code>
105+
</li>
106+
107+
<li v-if="type.required">
108+
Required:
109+
<code class="required">{{ type.required }}</code>
110+
</li>
111+
<li v-if="type.enum">
112+
Enum: <code>{{ type.enum }}</code>
113+
</li>
114+
<li v-if="type.default">
115+
Default: <code>{{ type.default }}</code>
116+
</li>
117+
<li
118+
v-if="
119+
type.minLength &&
120+
type.maxLength &&
121+
type.minLength === type.maxLength
122+
"
123+
>
124+
Length: <code>{{ type.minLength }}</code>
125+
</li>
126+
<li v-else-if="type.minLength">
127+
Length: <code>&#8805; {{ type.minLength }}</code>
128+
</li>
129+
<li v-else-if="type.maxLength">
130+
Length: <code>&#8804; {{ type.maxLength }}</code>
131+
</li>
132+
<li v-if="type.minimum && type.type === 'integer'">
133+
Value: <code>&#8805; {{ type.minimum }}</code>
134+
</li>
135+
<li v-if="type.maximum && type.type === 'integer'">
136+
Value: <code>&#8804; {{ type.maximum }}</code>
137+
</li>
138+
<li v-if="type.pattern">
139+
RegExp: <code>{{ type.pattern }}</code>
140+
</li>
141+
</ul>
142+
<p v-if="type.description">{{ type.description }}</p>
143+
</div>
144+
</div>
145+
</section>
146+
143147
<br />
144148
<!-- <h2 id="code-snippets">
145149
<a href="#code-snippets" class="header-anchor">#</a> Code Snippets
146-
</h2>
147-
<div class="language-http extra-class">
148-
<pre class="language-http code-copy-added">
149-
<code>
150-
<span class="token request-line"><span class="token property">POST</span> /some/resource/ HTTP/1.1</span>
151-
<span class="token header-name keyword">HOST:</span> server.test
152-
<span class="token header-name keyword">Accept:</span> application/vnd.mcash.api.merchant.v1+json
153-
<span class="token header-name keyword">Content-Type:</span> application/json
154-
<span class="token header-name keyword">X-Auka-Merchant:</span> T9oWAQ3FSl6oeITuR2ZGWA
155-
<span class="token header-name keyword">X-Auka-User:</span> POS1
156-
<span class="token header-name keyword">Authorization:</span> SECRET MySecretPassword
157-
</code>
158-
</pre>
159-
</div> -->
150+
</h2> -->
151+
<Content slot-key="example" />
152+
160153
<!-- <h2 id="request-body">
161154
<a href="#request-body" class="header-anchor">#</a> Request Body
162155
</h2>
@@ -342,7 +335,7 @@ export default {
342335
343336
if (unsortedShit.length > 0) {
344337
uniqSchemas = _.uniq(unsortedShit);
345-
// console.log(uniqSchemas);
338+
// console.log("uniqSchemas", uniqSchemas);
346339
}
347340
348341
if (uniqSchemas !== undefined) {
@@ -351,18 +344,48 @@ export default {
351344
if (mon.operationId === frontmatter.operationId) {
352345
// console.log(mon);
353346
_.filter(mon.responses, function (apu, smithers) {
354-
// console.log(smithers, apu);
355-
let title = apu.description.split(",")[0];
356-
let description = apu.description.split(",")[1];
357-
console.log("code", title + ":" + description);
347+
let title;
348+
let description;
349+
350+
// console.log("apu", apu.$ref);
351+
if (apu.$ref) {
352+
console.log("$ref", apu.$ref);
353+
let currentResponseRef = apu.$ref.split(
354+
"#/components/responses/"
355+
)[1];
356+
console.log("currentResponseRef: ", currentResponseRef);
357+
// _.filter(reference, function (bart, lisa){})
358+
let response =
359+
reference[page.frontmatter.api].components.responses[
360+
currentResponseRef
361+
];
362+
console.log("response: ", response);
363+
title = response.description;
364+
if (title.includes(",")) {
365+
title = title.split(",")[0];
366+
description = title.split(",")[1];
367+
// console.log("code", title + ":" + description);
368+
} else {
369+
title = title;
370+
}
371+
} else {
372+
console.log("apu", apu);
373+
title = apu.description;
374+
if (title.includes(",")) {
375+
title = apu.description.split(",")[0];
376+
description = apu.description.split(",")[1];
377+
// console.log("code", title + ":" + description);
378+
} else {
379+
title = title;
380+
}
381+
}
358382
359-
// let title = apu.description.split(",")[0];
360-
// let description = apu.description.split(",")[1];
361383
let code = {
362384
code: smithers,
363385
title: title,
364386
description: description,
365387
};
388+
366389
data.statusCodes.push(code);
367390
});
368391
//

docs/api/reference/rest/v1/merchant.balance/get.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,45 @@ operation: get
99
method: get
1010
authLevel: SECRET
1111
authRoles: Any
12-
---
12+
---
13+
14+
::: slot example
15+
16+
## Examples
17+
18+
<code-group>
19+
<code-block title="HTTP">
20+
```http
21+
GET /merchant/v1/merchant/5rg1dkk8/balance/ HTTP/1.1
22+
Host: api.sandbox.settle.eu
23+
X-Settle-Merchant: 5rg1dkk8
24+
Authorization: SECRET 2Z49_HoqEdPu0VqGn6vy2679+tYOT0Fl
25+
```
26+
</code-block>
27+
28+
<code-block title="cURL">
29+
```bash
30+
curl \
31+
--request GET 'https://api.sandbox.settle.eu/merchant/v1/merchant/5rg1dkk8/balance/' \
32+
--header 'X-Settle-Merchant: 5rg1dkk8' \
33+
--header 'Authorization: SECRET 2Z49_HoqEdPu0VqGn6vy2679+tYOT0Fl'
34+
```
35+
</code-block>
36+
37+
<code-block title="Python">
38+
```python
39+
import http.client
40+
conn = http.client.HTTPSConnection("api.sandbox.settle.eu")
41+
payload = ''
42+
headers = {
43+
'X-Settle-Merchant': '5rg1dkk8',
44+
'Authorization': 'SECRET 2Z49_HoqEdPu0VqGn6vy2679+tYOT0Fl'
45+
}
46+
conn.request("GET", "/merchant/v1/merchant/5rg1dkk8/balance/", payload, headers)
47+
res = conn.getresponse()
48+
data = res.read()
49+
print(data.decode("utf-8"))
50+
```
51+
</code-block>
52+
</code-group>
53+
:::

0 commit comments

Comments
 (0)