1 | ;
|
2 | /**
|
3 | * LIFF server API
|
4 | * LIFF Server API.
|
5 | *
|
6 | * The version of the OpenAPI document: 1.0.0
|
7 | *
|
8 | *
|
9 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
10 | * https://openapi-generator.tech
|
11 | * Do not edit the class manually.
|
12 | */
|
13 | Object.defineProperty(exports, "__esModule", { value: true });
|
14 | exports.LiffClient = void 0;
|
15 | const Types = require("../../types");
|
16 | const http_fetch_1 = require("../../http-fetch");
|
17 | class LiffClient {
|
18 | constructor(config) {
|
19 | if (!config.baseURL) {
|
20 | config.baseURL = "https://api.line.me";
|
21 | }
|
22 | this.httpClient = new http_fetch_1.default({
|
23 | defaultHeaders: {
|
24 | Authorization: "Bearer " + config.channelAccessToken,
|
25 | },
|
26 | baseURL: config.baseURL,
|
27 | });
|
28 | }
|
29 | async parseHTTPResponse(response) {
|
30 | const { LINE_REQUEST_ID_HTTP_HEADER_NAME } = Types;
|
31 | let resBody = Object.assign({}, (await response.json()));
|
32 | if (response.headers.get(LINE_REQUEST_ID_HTTP_HEADER_NAME)) {
|
33 | resBody[LINE_REQUEST_ID_HTTP_HEADER_NAME] = response.headers.get(LINE_REQUEST_ID_HTTP_HEADER_NAME);
|
34 | }
|
35 | return resBody;
|
36 | }
|
37 | /**
|
38 | * Adding the LIFF app to a channel
|
39 | * @param addLiffAppRequest
|
40 | *
|
41 | * @see <a href="https://developers.line.biz/en/reference/liff-server/#add-liff-app"> Documentation</a>
|
42 | */
|
43 | async addLIFFApp(addLiffAppRequest) {
|
44 | return (await this.addLIFFAppWithHttpInfo(addLiffAppRequest)).body;
|
45 | }
|
46 | /**
|
47 | * Adding the LIFF app to a channel.
|
48 | * This method includes HttpInfo object to return additional information.
|
49 | * @param addLiffAppRequest
|
50 | *
|
51 | * @see <a href="https://developers.line.biz/en/reference/liff-server/#add-liff-app"> Documentation</a>
|
52 | */
|
53 | async addLIFFAppWithHttpInfo(addLiffAppRequest) {
|
54 | const params = addLiffAppRequest;
|
55 | const res = await this.httpClient.post("/liff/v1/apps", params);
|
56 | return { httpResponse: res, body: await res.json() };
|
57 | }
|
58 | /**
|
59 | * Deletes a LIFF app from a channel.
|
60 | * @summary Delete LIFF app from a channel
|
61 | * @param liffId ID of the LIFF app to be updated
|
62 | *
|
63 | * @see <a href="https://developers.line.biz/en/reference/liff-server/#delete-liff-app">Delete LIFF app from a channel Documentation</a>
|
64 | */
|
65 | async deleteLIFFApp(liffId) {
|
66 | return (await this.deleteLIFFAppWithHttpInfo(liffId)).body;
|
67 | }
|
68 | /**
|
69 | * Deletes a LIFF app from a channel. .
|
70 | * This method includes HttpInfo object to return additional information.
|
71 | * @summary Delete LIFF app from a channel
|
72 | * @param liffId ID of the LIFF app to be updated
|
73 | *
|
74 | * @see <a href="https://developers.line.biz/en/reference/liff-server/#delete-liff-app">Delete LIFF app from a channel Documentation</a>
|
75 | */
|
76 | async deleteLIFFAppWithHttpInfo(liffId) {
|
77 | const res = await this.httpClient.delete("/liff/v1/apps/{liffId}".replace("{liffId}", String(liffId)));
|
78 | return { httpResponse: res, body: await res.json() };
|
79 | }
|
80 | /**
|
81 | * Gets information on all the LIFF apps added to the channel.
|
82 | * @summary Get all LIFF apps
|
83 | *
|
84 | * @see <a href="https://developers.line.biz/en/reference/liff-server/#get-all-liff-apps">Get all LIFF apps Documentation</a>
|
85 | */
|
86 | async getAllLIFFApps() {
|
87 | return (await this.getAllLIFFAppsWithHttpInfo()).body;
|
88 | }
|
89 | /**
|
90 | * Gets information on all the LIFF apps added to the channel..
|
91 | * This method includes HttpInfo object to return additional information.
|
92 | * @summary Get all LIFF apps
|
93 | *
|
94 | * @see <a href="https://developers.line.biz/en/reference/liff-server/#get-all-liff-apps">Get all LIFF apps Documentation</a>
|
95 | */
|
96 | async getAllLIFFAppsWithHttpInfo() {
|
97 | const res = await this.httpClient.get("/liff/v1/apps");
|
98 | return { httpResponse: res, body: await res.json() };
|
99 | }
|
100 | /**
|
101 | * Update LIFF app settings
|
102 | * @param liffId ID of the LIFF app to be updated
|
103 | * @param updateLiffAppRequest
|
104 | *
|
105 | * @see <a href="https://developers.line.biz/en/reference/liff-server/#update-liff-app"> Documentation</a>
|
106 | */
|
107 | async updateLIFFApp(liffId, updateLiffAppRequest) {
|
108 | return (await this.updateLIFFAppWithHttpInfo(liffId, updateLiffAppRequest))
|
109 | .body;
|
110 | }
|
111 | /**
|
112 | * Update LIFF app settings.
|
113 | * This method includes HttpInfo object to return additional information.
|
114 | * @param liffId ID of the LIFF app to be updated
|
115 | * @param updateLiffAppRequest
|
116 | *
|
117 | * @see <a href="https://developers.line.biz/en/reference/liff-server/#update-liff-app"> Documentation</a>
|
118 | */
|
119 | async updateLIFFAppWithHttpInfo(liffId, updateLiffAppRequest) {
|
120 | const params = updateLiffAppRequest;
|
121 | const res = await this.httpClient.put("/liff/v1/apps/{liffId}".replace("{liffId}", String(liffId)), params);
|
122 | return { httpResponse: res, body: await res.json() };
|
123 | }
|
124 | }
|
125 | exports.LiffClient = LiffClient;
|