@@ -6,23 +6,61 @@ import SEO from "../../components/0_utlilities/seo";
6
6
import Sidebar from "../../components/2_molecules/sidemenu" ;
7
7
8
8
const apiPage = ( { data } ) => {
9
- // const node = pageContext.name;
10
9
const n = data . allPaths . edges [ 0 ] . node ;
11
- // console.log(n);
10
+ const modes = {
11
+ get : "get" ,
12
+ post : "post" ,
13
+ put : "put"
14
+ } ;
15
+ const responses = {
16
+ _200 : "_200" ,
17
+ _204 : "_204" ,
18
+ default : "default"
19
+ } ;
12
20
return (
13
21
< Layout title = "API Documentation" subtitle = "Linode API Documentation" >
14
22
< SEO title = "API Documentation" description = "" />
15
23
< div className = "flex flex-wrap" >
16
- < div className = "w-full md:w-1/4 mt-8 " >
24
+ < div className = "w-full md:w-1/4" >
17
25
< Sidebar />
18
26
</ div >
19
27
< div className = "w-full md:w-3/4 pl-8" >
20
28
< h1 >
21
- { n . name }
22
- { /* {(n.get && n.get.tags) ||
23
- (n.post && n.post.tags) ||
24
- (n.put && n.put.tags)} */ }
29
+ { ( n . get && n . get . tags ) ||
30
+ ( n . post && n . get . post ) ||
31
+ ( n . put && n . put . tags ) }
25
32
</ h1 >
33
+ { Object . keys ( n ) . map ( e => {
34
+ const mode = modes [ e ] ;
35
+ const m = n [ mode ] ;
36
+ // console.log(m);
37
+ return (
38
+ m && (
39
+ < div key = { e } className = "mb-8" >
40
+ < h2 id = { mode } > { m . summary } </ h2 >
41
+ < p >
42
+ < b > { mode } </ b > https://api.linode.com/v4{ m . name }
43
+ </ p >
44
+ < p > { m . description } </ p >
45
+ { Object . keys ( m . responses ) . map ( ( e , i ) => {
46
+ const response = responses [ e ] ;
47
+ const r = m . responses [ response ] ;
48
+ console . log ( r ) ;
49
+ return (
50
+ r && (
51
+ < div key = { i } >
52
+ < p >
53
+ < b > { response . replace ( / [ _ ] / g, " " ) } </ b > :
54
+ { r . description }
55
+ </ p >
56
+ </ div >
57
+ )
58
+ ) ;
59
+ } ) }
60
+ </ div >
61
+ )
62
+ ) ;
63
+ } ) }
26
64
</ div >
27
65
</ div >
28
66
</ Layout >
@@ -50,6 +88,17 @@ export const query = graphql`
50
88
x_linode_redoc_load_ids
51
89
x_linode_cli_command
52
90
tags
91
+ responses {
92
+ _200 {
93
+ description
94
+ }
95
+ _204 {
96
+ description
97
+ }
98
+ default {
99
+ description
100
+ }
101
+ }
53
102
}
54
103
post {
55
104
x_linode_grant
@@ -60,6 +109,14 @@ export const query = graphql`
60
109
x_linode_cli_command
61
110
x_linode_charge
62
111
x_linode_cli_skip
112
+ responses {
113
+ _200 {
114
+ description
115
+ }
116
+ default {
117
+ description
118
+ }
119
+ }
63
120
}
64
121
put {
65
122
x_linode_grant
@@ -68,6 +125,14 @@ export const query = graphql`
68
125
operationId
69
126
x_linode_cli_action
70
127
x_linode_cli_skip
128
+ responses {
129
+ _200 {
130
+ description
131
+ }
132
+ default {
133
+ description
134
+ }
135
+ }
71
136
}
72
137
}
73
138
}
0 commit comments