UNPKG

@line/bot-sdk

Version:
53 lines (52 loc) 1.79 kB
"use strict"; /** * Mission Stickers API * This document describes LINE Mission Stickers API. * * The version of the OpenAPI document: 0.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.ShopClient = void 0; const Types = require("../../types"); const utils_1 = require("../../utils"); const http_1 = require("../../http"); class ShopClient { constructor(config) { if (!config.baseURL) { config.baseURL = "https://api.line.me"; } this.httpClient = new http_1.default({ defaultHeaders: { Authorization: "Bearer " + config.channelAccessToken, }, responseParser: this.parseHTTPResponse.bind(this), baseURL: config.baseURL, }); } parseHTTPResponse(response) { const { LINE_REQUEST_ID_HTTP_HEADER_NAME } = Types; let resBody = Object.assign({}, response.data); if (response.headers[LINE_REQUEST_ID_HTTP_HEADER_NAME]) { resBody[LINE_REQUEST_ID_HTTP_HEADER_NAME] = response.headers[LINE_REQUEST_ID_HTTP_HEADER_NAME]; } return resBody; } /** * Sends a mission sticker. * @param missionStickerRequest * * @see <a href="https://developers.line.biz/en/reference/partner-docs/#send-mission-stickers-v3"> Documentation</a> */ async missionStickerV3(missionStickerRequest) { const params = missionStickerRequest; const res = this.httpClient.post("/shop/v3/mission", params); return (0, utils_1.ensureJSON)(res); } } exports.ShopClient = ShopClient;