@@ -53,7 +53,7 @@ const client = createClient({
53
53
</script >
54
54
```
55
55
56
- After, How to use it below.
56
+ After, How to use ` get ` it below.
57
57
58
58
``` javascript
59
59
client
@@ -75,10 +75,80 @@ client
75
75
.catch ((err ) => console .log (err));
76
76
```
77
77
78
- If you are using TypeScript, specify the response type.
78
+ And, Api corresponding to each content are also available. example.
79
+
80
+ ``` javascript
81
+ // Get list API data
82
+ client
83
+ .getList ({
84
+ endpoint: ' endpoint' ,
85
+ })
86
+ .then ((res ) => console .log (res))
87
+ .catch ((err ) => console .log (err));
88
+
89
+ // Get list API detail data
90
+ client
91
+ .getListDetail ({
92
+ endpoint: ' endpoint' ,
93
+ contentId: ' contentId' ,
94
+ })
95
+ .then ((res ) => console .log (res))
96
+ .catch ((err ) => console .log (err));
97
+
98
+ // Get object API data
99
+ client
100
+ .getObject ({
101
+ endpoint: ' endpoint' ,
102
+ })
103
+ .then ((res ) => console .log (res))
104
+ .catch ((err ) => console .log (err));
105
+ ```
106
+
107
+ ### TypeScript
108
+
109
+ If you are using TypeScript, use ` getList ` , ` getListDetail ` , ` getObject ` . This internally contains a common type of content.
79
110
80
111
``` typescript
81
- client .get <ResponseType >({endpoint: ' endpoint' })
112
+ // Type definition
113
+ type Content = {
114
+ text: string ,
115
+ }
116
+
117
+ /**
118
+ * // getList response type
119
+ * {
120
+ * contents: Content; // This is Content type
121
+ * totalCount: number;
122
+ * limit: number;
123
+ * offset: number;
124
+ * }
125
+ */
126
+ client .getList <Content >({ // other })
127
+
128
+ /**
129
+ * // getListDetail response type
130
+ * {
131
+ * id: string;
132
+ * createdAt: string;
133
+ * updatedAt: string;
134
+ * publishedAt: string;
135
+ * revisedAt: string;
136
+ * text: string; // This is Content type.
137
+ * }
138
+ */
139
+ client.getListDetail<Content>({ // other })
140
+
141
+ /**
142
+ * // getObject response type
143
+ * {
144
+ * createdAt: string;
145
+ * updatedAt: string;
146
+ * publishedAt: string;
147
+ * revisedAt: string;
148
+ * text: string; // This is Content type.
149
+ * }
150
+ */
151
+ client .getObject <Content >({ // other })
82
152
` ` `
83
153
84
154
# LICENSE
0 commit comments