UNPKG

2.19 kBJavaScriptView Raw
1"use strict";
2/**
3 * Mission Stickers API
4 * This document describes LINE Mission Stickers API.
5 *
6 * The version of the OpenAPI document: 0.0.1
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 */
13Object.defineProperty(exports, "__esModule", { value: true });
14exports.ShopClient = void 0;
15const Types = require("../../types");
16const http_fetch_1 = require("../../http-fetch");
17class ShopClient {
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 * Sends a mission sticker.
39 * @param missionStickerRequest
40 *
41 * @see <a href="https://developers.line.biz/en/reference/partner-docs/#send-mission-stickers-v3"> Documentation</a>
42 */
43 async missionStickerV3(missionStickerRequest) {
44 return (await this.missionStickerV3WithHttpInfo(missionStickerRequest))
45 .body;
46 }
47 /**
48 * Sends a mission sticker..
49 * This method includes HttpInfo object to return additional information.
50 * @param missionStickerRequest
51 *
52 * @see <a href="https://developers.line.biz/en/reference/partner-docs/#send-mission-stickers-v3"> Documentation</a>
53 */
54 async missionStickerV3WithHttpInfo(missionStickerRequest) {
55 const params = missionStickerRequest;
56 const res = await this.httpClient.post("/shop/v3/mission", params);
57 return { httpResponse: res, body: await res.json() };
58 }
59}
60exports.ShopClient = ShopClient;