From 9d85fa4ea6cb09e0c750e6cacfce29f438c5f9e4 Mon Sep 17 00:00:00 2001 From: Evan Lin Date: Tue, 14 Mar 2023 12:14:37 +0800 Subject: [PATCH] ignore vendor --- .gitignore | 304 ++++++ go.mod | 2 +- go.sum | 2 + .../line/line-bot-sdk-go/v7/LICENSE.txt | 201 ---- .../v7/linebot/account_link.go | 54 - .../line-bot-sdk-go/v7/linebot/actions.go | 309 ------ .../line-bot-sdk-go/v7/linebot/audience.go | 880 ---------------- .../line/line-bot-sdk-go/v7/linebot/client.go | 327 ------ .../v7/linebot/content_provider.go | 31 - .../line-bot-sdk-go/v7/linebot/delivery.go | 98 -- .../v7/linebot/demographic_filter.go | 300 ------ .../line/line-bot-sdk-go/v7/linebot/emoji.go | 32 - .../line/line-bot-sdk-go/v7/linebot/error.go | 45 - .../line/line-bot-sdk-go/v7/linebot/event.go | 544 ---------- .../line/line-bot-sdk-go/v7/linebot/flex.go | 960 ------------------ .../v7/linebot/flex_unmarshal.go | 217 ---- .../v7/linebot/get_bot_info.go | 68 -- .../line-bot-sdk-go/v7/linebot/get_content.go | 53 - .../line-bot-sdk-go/v7/linebot/get_count.go | 86 -- .../v7/linebot/get_follower_ids.go | 149 --- .../line-bot-sdk-go/v7/linebot/get_ids.go | 215 ---- .../line-bot-sdk-go/v7/linebot/get_profile.go | 123 --- .../line-bot-sdk-go/v7/linebot/get_quota.go | 87 -- .../line-bot-sdk-go/v7/linebot/get_summary.go | 53 - .../line-bot-sdk-go/v7/linebot/imagemap.go | 130 --- .../line-bot-sdk-go/v7/linebot/imageset.go | 31 - .../line-bot-sdk-go/v7/linebot/insight.go | 184 ---- .../line/line-bot-sdk-go/v7/linebot/leave.go | 86 -- .../line/line-bot-sdk-go/v7/linebot/liff.go | 208 ---- .../line-bot-sdk-go/v7/linebot/mention.go | 13 - .../line-bot-sdk-go/v7/linebot/message.go | 648 ------------ .../line/line-bot-sdk-go/v7/linebot/oauth.go | 97 -- .../line/line-bot-sdk-go/v7/linebot/oauth2.go | 141 --- .../line-bot-sdk-go/v7/linebot/progress.go | 68 -- .../line-bot-sdk-go/v7/linebot/quick_reply.go | 58 -- .../line/line-bot-sdk-go/v7/linebot/raw.go | 69 -- .../line-bot-sdk-go/v7/linebot/recipient.go | 102 -- .../line-bot-sdk-go/v7/linebot/response.go | 884 ---------------- .../line-bot-sdk-go/v7/linebot/richmenu.go | 880 ---------------- .../v7/linebot/send_message.go | 357 ------- .../line/line-bot-sdk-go/v7/linebot/sender.go | 44 - .../line-bot-sdk-go/v7/linebot/template.go | 261 ----- .../v7/linebot/validate_message.go | 247 ----- .../line-bot-sdk-go/v7/linebot/version.go | 19 - .../line-bot-sdk-go/v7/linebot/webhook.go | 174 ---- vendor/modules.txt | 3 - 46 files changed, 307 insertions(+), 9537 deletions(-) delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/LICENSE.txt delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/account_link.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/actions.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/audience.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/client.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/content_provider.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/delivery.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/demographic_filter.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/emoji.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/error.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/event.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/flex.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/flex_unmarshal.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_bot_info.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_content.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_count.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_follower_ids.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_ids.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_profile.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_quota.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_summary.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/imagemap.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/imageset.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/insight.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/leave.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/liff.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/mention.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/message.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/oauth.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/oauth2.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/progress.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/quick_reply.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/raw.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/recipient.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/response.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/richmenu.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/send_message.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/sender.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/template.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/validate_message.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/version.go delete mode 100644 vendor/github.com/line/line-bot-sdk-go/v7/linebot/webhook.go delete mode 100644 vendor/modules.txt diff --git a/.gitignore b/.gitignore index ddad340c4..73e291867 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,305 @@ LineBotTemplate +### core template +*.swp +*.*~ +project.lock.json +.DS_Store +*.pyc +nupkg/ + +# Visual Studio Code +.vscode + +# Rider +.idea + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +build/ +bld/ +[Bb]in/ +[Oo]bj/ +[Oo]ut/ +msbuild.log +msbuild.err +msbuild.wrn + +# Visual Studio 2015 +.vs/ + + +### VisualStudioCode template +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Linux template +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### Go template +# If you prefer the allow list template instead of the deny list, see community template: +# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore +# +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +vendor/ + +# Go workspace file +go.work + +### Go.AllowList template +# Allowlisting gitignore template for GO projects prevents us +# from adding various unwanted local files, such as generated +# files, developer configurations or IDE-specific files etc. +# +# Recommended: Go.AllowList.gitignore + +# Ignore everything +* + +# But not these files... +!/.gitignore + +!*.go +!go.sum +!go.mod + +!README.md +!LICENSE + +# !Makefile + +# ...even if they are in subdirectories +!*/ + +### Windows template +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### Vim template +# Swap +[._]*.s[a-v][a-z] +!*.svg # comment out if you don't need vector files +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim +Sessionx.vim + +# Temporary +.netrwhist +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + +### macOS template +# General +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### OpenSSL template +# OpenSSL-related files best not committed + +## Certificate Authority +*.ca + +## Certificate +*.crt + +## Certificate Sign Request +*.csr + +## Certificate +*.der + +## Key database file +*.kdb + +## OSCP request data +*.org + +## PKCS #12 +*.p12 + +## PEM-encoded certificate data +*.pem + +## Random number seed +*.rnd + +## SSLeay data +*.ssleay + +## S/MIME message +*.smime \ No newline at end of file diff --git a/go.mod b/go.mod index bd8a13fae..9a725b68c 100644 --- a/go.mod +++ b/go.mod @@ -3,4 +3,4 @@ module github.com/kkdai/LineBotTemplate // +heroku goVersion go1.17 go 1.17 -require github.com/line/line-bot-sdk-go/v7 v7.18.0 +require github.com/line/line-bot-sdk-go/v7 v7.19.0 diff --git a/go.sum b/go.sum index 0717e5f35..40653cce3 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,8 @@ github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/line/line-bot-sdk-go/v7 v7.18.0 h1:ogrOioYKnCuyDlbNAuFb7hGdv1KGkluKWUcZx/Uocds= github.com/line/line-bot-sdk-go/v7 v7.18.0/go.mod h1:2CXH5xBgADszymGNRRUiUqBQ/0G6r2nx3BviBYtnB3U= +github.com/line/line-bot-sdk-go/v7 v7.19.0 h1:WEbuBBSq65RMMqTn3vIl+Eb4wv2CjhZz7kiw8XTk2Wg= +github.com/line/line-bot-sdk-go/v7 v7.19.0/go.mod h1:idpoxOZgtSd8JyhctMMpwg5LNgRAIL/QIxa5S0DXcMg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/LICENSE.txt b/vendor/github.com/line/line-bot-sdk-go/v7/LICENSE.txt deleted file mode 100644 index 9bfccca9a..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/LICENSE.txt +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright (C) 2016 LINE Corp. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/account_link.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/account_link.go deleted file mode 100644 index a1da6b4e2..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/account_link.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2016 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "context" - "fmt" -) - -// IssueLinkToken method -// https://developers.line.me/en/reference/messaging-api/#issue-link-token -func (client *Client) IssueLinkToken(userID string) *IssueLinkTokenCall { - return &IssueLinkTokenCall{ - c: client, - userID: userID, - } -} - -// IssueLinkTokenCall type -type IssueLinkTokenCall struct { - c *Client - ctx context.Context - - userID string -} - -// WithContext method -func (call *IssueLinkTokenCall) WithContext(ctx context.Context) *IssueLinkTokenCall { - call.ctx = ctx - return call -} - -// Do method -func (call *IssueLinkTokenCall) Do() (*LinkTokenResponse, error) { - endpoint := fmt.Sprintf(APIEndpointLinkToken, call.userID) - res, err := call.c.post(call.ctx, endpoint, nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToLinkTokenResponse(res) -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/actions.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/actions.go deleted file mode 100644 index 184280fa8..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/actions.go +++ /dev/null @@ -1,309 +0,0 @@ -// Copyright 2018 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import "encoding/json" - -// ActionType type -type ActionType string - -// ActionType constants -const ( - ActionTypeURI ActionType = "uri" - ActionTypeMessage ActionType = "message" - ActionTypePostback ActionType = "postback" - ActionTypeDatetimePicker ActionType = "datetimepicker" - ActionTypeCamera ActionType = "camera" - ActionTypeCameraRoll ActionType = "cameraRoll" - ActionTypeLocation ActionType = "location" -) - -// InputOption type -type InputOption string - -// InputOption constants -const ( - InputOptionCloseRichMenu InputOption = "closeRichMenu" - InputOptionOpenRichMenu InputOption = "openRichMenu" - InputOptionOpenKeyboard InputOption = "openKeyboard" - InputOptionOpenVoice InputOption = "openVoice" -) - -// Action interface -type Action interface { - json.Marshaler -} - -// TemplateAction interface -type TemplateAction interface { - Action - TemplateAction() -} - -// QuickReplyAction type -type QuickReplyAction interface { - Action - QuickReplyAction() -} - -// URIAction type -type URIAction struct { - Label string - URI string - AltURI *URIActionAltURI -} - -// URIActionAltURI type -type URIActionAltURI struct { - Desktop string `json:"desktop"` -} - -// MarshalJSON method of URIAction -func (a *URIAction) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type ActionType `json:"type"` - Label string `json:"label,omitempty"` - URI string `json:"uri"` - AltURI *URIActionAltURI `json:"altUri,omitempty"` - }{ - Type: ActionTypeURI, - Label: a.Label, - URI: a.URI, - AltURI: a.AltURI, - }) -} - -// MessageAction type -type MessageAction struct { - Label string - Text string -} - -// MarshalJSON method of MessageAction -func (a *MessageAction) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type ActionType `json:"type"` - Label string `json:"label,omitempty"` - Text string `json:"text"` - }{ - Type: ActionTypeMessage, - Label: a.Label, - Text: a.Text, - }) -} - -// PostbackAction type -type PostbackAction struct { - Label string - Data string - Text string - DisplayText string - InputOption InputOption - FillInText string -} - -// MarshalJSON method of PostbackAction -func (a *PostbackAction) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type ActionType `json:"type"` - Label string `json:"label,omitempty"` - Data string `json:"data"` - Text string `json:"text,omitempty"` - DisplayText string `json:"displayText,omitempty"` - InputOption InputOption `json:"inputOption,omitempty"` - FillInText string `json:"fillInText,omitempty"` - }{ - Type: ActionTypePostback, - Label: a.Label, - Data: a.Data, - Text: a.Text, - DisplayText: a.DisplayText, - InputOption: a.InputOption, - FillInText: a.FillInText, - }) -} - -// DatetimePickerAction type -type DatetimePickerAction struct { - Label string - Data string - Mode string - Initial string - Max string - Min string -} - -// MarshalJSON method of DatetimePickerAction -func (a *DatetimePickerAction) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type ActionType `json:"type"` - Label string `json:"label,omitempty"` - Data string `json:"data"` - Mode string `json:"mode"` - Initial string `json:"initial,omitempty"` - Max string `json:"max,omitempty"` - Min string `json:"min,omitempty"` - }{ - Type: ActionTypeDatetimePicker, - Label: a.Label, - Data: a.Data, - Mode: a.Mode, - Initial: a.Initial, - Max: a.Max, - Min: a.Min, - }) -} - -// CameraAction type -type CameraAction struct { - Label string -} - -// MarshalJSON method of CameraAction -func (a *CameraAction) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type ActionType `json:"type"` - Label string `json:"label"` - }{ - Type: ActionTypeCamera, - Label: a.Label, - }) -} - -// CameraRollAction type -type CameraRollAction struct { - Label string -} - -// MarshalJSON method of CameraRollAction -func (a *CameraRollAction) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type ActionType `json:"type"` - Label string `json:"label"` - }{ - Type: ActionTypeCameraRoll, - Label: a.Label, - }) -} - -// LocationAction type -type LocationAction struct { - Label string -} - -// MarshalJSON method of LocationAction -func (a *LocationAction) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type ActionType `json:"type"` - Label string `json:"label"` - }{ - Type: ActionTypeLocation, - Label: a.Label, - }) -} - -// TemplateAction implements TemplateAction interface -func (*URIAction) TemplateAction() {} - -// TemplateAction implements TemplateAction interface -func (*MessageAction) TemplateAction() {} - -// TemplateAction implements TemplateAction interface -func (*PostbackAction) TemplateAction() {} - -// TemplateAction implements TemplateAction interface -func (*DatetimePickerAction) TemplateAction() {} - -// QuickReplyAction implements QuickReplyAction interface -func (*MessageAction) QuickReplyAction() {} - -// QuickReplyAction implements QuickReplyAction interface -func (*PostbackAction) QuickReplyAction() {} - -// QuickReplyAction implements QuickReplyAction interface -func (*DatetimePickerAction) QuickReplyAction() {} - -// QuickReplyAction implements QuickReplyAction interface -func (*CameraAction) QuickReplyAction() {} - -// QuickReplyAction implements QuickReplyAction interface -func (*CameraRollAction) QuickReplyAction() {} - -// QuickReplyAction implements QuickReplyAction interface -func (*LocationAction) QuickReplyAction() {} - -// QuickReplyAction implements URI's QuickReplyAction interface -func (*URIAction) QuickReplyAction() {} - -// NewURIAction function -func NewURIAction(label, uri string) *URIAction { - return &URIAction{ - Label: label, - URI: uri, - } -} - -// NewMessageAction function -func NewMessageAction(label, text string) *MessageAction { - return &MessageAction{ - Label: label, - Text: text, - } -} - -// NewPostbackAction function -func NewPostbackAction(label, data, text, displayText string, inputOption InputOption, fillInText string) *PostbackAction { - return &PostbackAction{ - Label: label, - Data: data, - Text: text, - DisplayText: displayText, - InputOption: inputOption, - FillInText: fillInText, - } -} - -// NewDatetimePickerAction function -func NewDatetimePickerAction(label, data, mode, initial, max, min string) *DatetimePickerAction { - return &DatetimePickerAction{ - Label: label, - Data: data, - Mode: mode, - Initial: initial, - Max: max, - Min: min, - } -} - -// NewCameraAction function -func NewCameraAction(label string) *CameraAction { - return &CameraAction{ - Label: label, - } -} - -// NewCameraRollAction function -func NewCameraRollAction(label string) *CameraRollAction { - return &CameraRollAction{ - Label: label, - } -} - -// NewLocationAction function -func NewLocationAction(label string) *LocationAction { - return &LocationAction{ - Label: label, - } -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/audience.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/audience.go deleted file mode 100644 index eae69dce0..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/audience.go +++ /dev/null @@ -1,880 +0,0 @@ -package linebot - -import ( - "bytes" - "context" - "encoding/json" - "fmt" - "io" - "net/url" - "strconv" - "strings" -) - -// AudienceStatusType type -type AudienceStatusType string - -// String method -func (a AudienceStatusType) String() string { - return string(a) -} - -const ( - // INPROGRESS const - INPROGRESS AudienceStatusType = "IN_PROGRESS" - // READY const - READY AudienceStatusType = "READY" - // FAILED const - FAILED AudienceStatusType = "FAILED" - // EXPIRED const - EXPIRED AudienceStatusType = "EXPIRED" - // INACTIVE const - INACTIVE AudienceStatusType = "INACTIVE" - // ACTIVATING const - ACTIVATING AudienceStatusType = "ACTIVATING" -) - -// AudienceAuthorityLevelType type -type AudienceAuthorityLevelType string - -// String method -func (a AudienceAuthorityLevelType) String() string { - return string(a) -} - -const ( - // PUBLIC const - PUBLIC AudienceAuthorityLevelType = "PUBLIC" - // PRIVATE const - PRIVATE AudienceAuthorityLevelType = "PRIVATE" -) - -// IUploadAudienceGroupOption type -type IUploadAudienceGroupOption interface { - Apply(call *UploadAudienceGroupCall) -} - -// WithUploadAudienceGroupCallIsIfaAudience func -func WithUploadAudienceGroupCallIsIfaAudience(isIfaAudience bool) IUploadAudienceGroupOption { - return &withUploadAudienceGroupCallIsIfaAudience{ - isIfaAudience: isIfaAudience, - } -} - -type withUploadAudienceGroupCallIsIfaAudience struct { - isIfaAudience bool -} - -func (w *withUploadAudienceGroupCallIsIfaAudience) Apply(call *UploadAudienceGroupCall) { - call.IsIfaAudience = w.isIfaAudience -} - -// WithUploadAudienceGroupCallUploadDescription func -func WithUploadAudienceGroupCallUploadDescription(uploadDescription string) IUploadAudienceGroupOption { - return &withUploadAudienceGroupCallUploadDescription{ - uploadDescription: uploadDescription, - } -} - -type withUploadAudienceGroupCallUploadDescription struct { - uploadDescription string -} - -func (w *withUploadAudienceGroupCallUploadDescription) Apply(call *UploadAudienceGroupCall) { - call.UploadDescription = w.uploadDescription -} - -// WithUploadAudienceGroupCallAudiences func -func WithUploadAudienceGroupCallAudiences(audiences ...string) IUploadAudienceGroupOption { - return &withUploadAudienceGroupCallAudiences{ - audiences: audiences, - } -} - -type withUploadAudienceGroupCallAudiences struct { - audiences []string -} - -func (w *withUploadAudienceGroupCallAudiences) Apply(call *UploadAudienceGroupCall) { - for _, item := range w.audiences { - call.Audiences = append(call.Audiences, audience{ID: item}) - } -} - -// UploadAudienceGroup method -func (client *Client) UploadAudienceGroup(description string, options ...IUploadAudienceGroupOption) *UploadAudienceGroupCall { - call := &UploadAudienceGroupCall{ - c: client, - Description: description, - } - for _, item := range options { - item.Apply(call) - } - return call -} - -type audience struct { - ID string `json:"id,omitempty"` -} - -// UploadAudienceGroupCall type -type UploadAudienceGroupCall struct { - c *Client - ctx context.Context - Description string `validate:"required,max=120"` - IsIfaAudience bool - UploadDescription string - Audiences []audience `validate:"max=10000"` -} - -// WithContext method -func (call *UploadAudienceGroupCall) WithContext(ctx context.Context) *UploadAudienceGroupCall { - call.ctx = ctx - return call -} - -func (call *UploadAudienceGroupCall) encodeJSON(w io.Writer) error { - enc := json.NewEncoder(w) - return enc.Encode(struct { - Description string `json:"description,omitempty"` - IsIfaAudience bool `json:"isIfaAudience,omitempty"` - UploadDescription string `json:"uploadDescription,omitempty"` - Audiences []audience `json:"audiences,omitempty"` - }{ - Description: call.Description, - IsIfaAudience: call.IsIfaAudience, - UploadDescription: call.UploadDescription, - Audiences: call.Audiences, - }) -} - -// Do method -func (call *UploadAudienceGroupCall) Do() (*UploadAudienceGroupResponse, error) { - var buf bytes.Buffer - if err := call.encodeJSON(&buf); err != nil { - return nil, err - } - res, err := call.c.post(call.ctx, APIAudienceGroupUpload, &buf) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToAudienceGroupResponse(res) -} - -// IUploadAudienceGroupByFileOption type -type IUploadAudienceGroupByFileOption interface { - Apply(call *UploadAudienceGroupByFileCall) -} - -// WithUploadAudienceGroupByFileCallIsIfaAudience func -func WithUploadAudienceGroupByFileCallIsIfaAudience(isIfaAudience bool) IUploadAudienceGroupByFileOption { - return &withUploadAudienceGroupByFileCallIsIfaAudience{ - isIfaAudience: isIfaAudience, - } -} - -type withUploadAudienceGroupByFileCallIsIfaAudience struct { - isIfaAudience bool -} - -func (w *withUploadAudienceGroupByFileCallIsIfaAudience) Apply(call *UploadAudienceGroupByFileCall) { - call.IsIfaAudience = w.isIfaAudience -} - -// WithUploadAudienceGroupByFileCallUploadDescription func -func WithUploadAudienceGroupByFileCallUploadDescription(uploadDescription string) IUploadAudienceGroupByFileOption { - return &withUploadAudienceGroupByFileCallUploadDescription{ - uploadDescription: uploadDescription, - } -} - -type withUploadAudienceGroupByFileCallUploadDescription struct { - uploadDescription string -} - -func (w *withUploadAudienceGroupByFileCallUploadDescription) Apply(call *UploadAudienceGroupByFileCall) { - call.UploadDescription = w.uploadDescription -} - -// UploadAudienceGroupByFile method -func (client *Client) UploadAudienceGroupByFile(description string, audiences []string, options ...IUploadAudienceGroupByFileOption) *UploadAudienceGroupByFileCall { - call := &UploadAudienceGroupByFileCall{ - c: client, - Description: description, - Audiences: audiences, - } - for _, item := range options { - item.Apply(call) - } - return call -} - -// UploadAudienceGroupByFileCall type -type UploadAudienceGroupByFileCall struct { - c *Client - ctx context.Context - Description string `json:"description,omitempty" validate:"required,max=120"` - IsIfaAudience bool `json:"isIfaAudience,omitempty"` - UploadDescription string `json:"uploadDescription,omitempty"` - Audiences []string `json:"audiences,omitempty" validate:"max=1500000"` -} - -// WithContext method -func (call *UploadAudienceGroupByFileCall) WithContext(ctx context.Context) *UploadAudienceGroupByFileCall { - call.ctx = ctx - return call -} - -// Do method -func (call *UploadAudienceGroupByFileCall) Do() (*UploadAudienceGroupResponse, error) { - buf := bytes.NewBuffer([]byte{}) - defer buf.Reset() - _, errWriteString := buf.WriteString(strings.Join(call.Audiences, "\n")) - if errWriteString != nil { - return nil, errWriteString - } - - form := map[string]io.Reader{ - "description": strings.NewReader(call.Description), - "file": buf, - } - if call.IsIfaAudience { - form["isIfaAudience"] = strings.NewReader(strconv.FormatBool(call.IsIfaAudience)) - } - if call.UploadDescription != "" { - form["uploadDescription"] = strings.NewReader(call.UploadDescription) - } - res, err := call.c.postFormFile(call.ctx, APIAudienceGroupUploadByFile, form) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToAudienceGroupResponse(res) -} - -// IAddAudiencesOption type -type IAddAudiencesOption interface { - Apply(call *AddAudiencesCall) -} - -// WithAddAudiencesCallUploadDescription type -func WithAddAudiencesCallUploadDescription(uploadDescription string) IAddAudiencesOption { - return &withAddAudiencesCallUploadDescription{ - uploadDescription: uploadDescription, - } -} - -type withAddAudiencesCallUploadDescription struct { - uploadDescription string -} - -func (w *withAddAudiencesCallUploadDescription) Apply(call *AddAudiencesCall) { - call.UploadDescription = w.uploadDescription -} - -// AddAudiences method -func (client *Client) AddAudiences(audienceGroupID int, audiences []string, options ...IAddAudiencesOption) *AddAudiencesCall { - call := &AddAudiencesCall{ - c: client, - AudienceGroupID: audienceGroupID, - } - for _, item := range audiences { - call.Audiences = append(call.Audiences, audience{ID: item}) - } - for _, item := range options { - item.Apply(call) - } - return call -} - -// AddAudiencesCall type -type AddAudiencesCall struct { - c *Client - ctx context.Context - AudienceGroupID int `validate:"required"` - UploadDescription string - Audiences []audience `validate:"required,max=10000"` -} - -// WithContext method -func (call *AddAudiencesCall) WithContext(ctx context.Context) *AddAudiencesCall { - call.ctx = ctx - return call -} - -func (call *AddAudiencesCall) encodeJSON(w io.Writer) error { - enc := json.NewEncoder(w) - return enc.Encode(struct { - AudienceGroupID int `json:"audienceGroupId,omitempty"` - UploadDescription string `json:"uploadDescription,omitempty"` - Audiences []audience `json:"audiences,omitempty"` - }{ - AudienceGroupID: call.AudienceGroupID, - UploadDescription: call.UploadDescription, - Audiences: call.Audiences, - }) -} - -// Do method -func (call *AddAudiencesCall) Do() (*BasicResponse, error) { - var buf bytes.Buffer - if err := call.encodeJSON(&buf); err != nil { - return nil, err - } - res, err := call.c.put(call.ctx, APIAudienceGroupUpload, &buf) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// IAddAudiencesByFileOption type -type IAddAudiencesByFileOption interface { - Apply(call *AddAudiencesByFileCall) -} - -// WithAddAudiencesByFileCallUploadDescription func -func WithAddAudiencesByFileCallUploadDescription(uploadDescription string) IAddAudiencesByFileOption { - return &withAddAudiencesByFileCallUploadDescription{ - uploadDescription: uploadDescription, - } -} - -type withAddAudiencesByFileCallUploadDescription struct { - uploadDescription string -} - -func (w *withAddAudiencesByFileCallUploadDescription) Apply(call *AddAudiencesByFileCall) { - call.UploadDescription = w.uploadDescription -} - -// AddAudiencesByFile method -func (client *Client) AddAudiencesByFile(audienceGroupID int, audiences []string, options ...IAddAudiencesByFileOption) *AddAudiencesByFileCall { - call := &AddAudiencesByFileCall{ - c: client, - AudienceGroupID: audienceGroupID, - Audiences: audiences, - } - for _, item := range options { - item.Apply(call) - } - return call -} - -// AddAudiencesByFileCall type -type AddAudiencesByFileCall struct { - c *Client - ctx context.Context - AudienceGroupID int `json:"audienceGroupId,omitempty" validate:"required"` - UploadDescription string `json:"uploadDescription,omitempty"` - Audiences []string `json:"audiences,omitempty" validate:"required,max=1500000"` -} - -// WithContext method -func (call *AddAudiencesByFileCall) WithContext(ctx context.Context) *AddAudiencesByFileCall { - call.ctx = ctx - return call -} - -// Do method -func (call *AddAudiencesByFileCall) Do() (*BasicResponse, error) { - buf := bytes.NewBuffer([]byte{}) - defer buf.Reset() - _, errWriteString := buf.WriteString(strings.Join(call.Audiences, "\n")) - if errWriteString != nil { - return nil, errWriteString - } - - form := map[string]io.Reader{ - "audienceGroupId": strings.NewReader(strconv.FormatInt(int64(call.AudienceGroupID), 10)), - "file": buf, - } - if call.UploadDescription != "" { - form["uploadDescription"] = strings.NewReader(call.UploadDescription) - } - res, err := call.c.putFormFile(call.ctx, APIAudienceGroupUploadByFile, form) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// IClickAudienceGroupOption type -type IClickAudienceGroupOption interface { - Apply(call *ClickAudienceGroupCall) -} - -// WithClickAudienceGroupCallClickURL func -func WithClickAudienceGroupCallClickURL(clickURL string) IClickAudienceGroupOption { - return &withClickAudienceGroupCallClickURL{ - clickURL: clickURL, - } -} - -type withClickAudienceGroupCallClickURL struct { - clickURL string -} - -func (w *withClickAudienceGroupCallClickURL) Apply(call *ClickAudienceGroupCall) { - call.ClickURL = w.clickURL -} - -// ClickAudienceGroup method -func (client *Client) ClickAudienceGroup(description, requestID string, options ...IClickAudienceGroupOption) *ClickAudienceGroupCall { - call := &ClickAudienceGroupCall{ - c: client, - Description: description, - RequestID: requestID, - } - for _, item := range options { - item.Apply(call) - } - return call -} - -// ClickAudienceGroupCall type -type ClickAudienceGroupCall struct { - c *Client - ctx context.Context - Description string `validate:"required,max=120"` - RequestID string `validate:"required"` - ClickURL string `validate:"max=2000"` -} - -// WithContext method -func (call *ClickAudienceGroupCall) WithContext(ctx context.Context) *ClickAudienceGroupCall { - call.ctx = ctx - return call -} - -func (call *ClickAudienceGroupCall) encodeJSON(w io.Writer) error { - enc := json.NewEncoder(w) - return enc.Encode(struct { - Description string `json:"description,omitempty"` - RequestID string `json:"requestId,omitempty"` - ClickURL string `json:"clickUrl,omitempty"` - }{ - Description: call.Description, - RequestID: call.RequestID, - ClickURL: call.ClickURL, - }) -} - -// Do method -func (call *ClickAudienceGroupCall) Do() (*ClickAudienceGroupResponse, error) { - var buf bytes.Buffer - if err := call.encodeJSON(&buf); err != nil { - return nil, err - } - res, err := call.c.post(call.ctx, APIAudienceGroupClick, &buf) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToClickAudienceGroupResponse(res) -} - -// IMPAudienceGroup method -func (client *Client) IMPAudienceGroup(description, requestID string) *IMPAudienceGroupCall { - call := &IMPAudienceGroupCall{ - c: client, - Description: description, - RequestID: requestID, - } - return call -} - -// IMPAudienceGroupCall type -type IMPAudienceGroupCall struct { - c *Client - ctx context.Context - Description string `validate:"required,max=120"` - RequestID string `validate:"required"` -} - -// WithContext method -func (call *IMPAudienceGroupCall) WithContext(ctx context.Context) *IMPAudienceGroupCall { - call.ctx = ctx - return call -} - -func (call *IMPAudienceGroupCall) encodeJSON(w io.Writer) error { - enc := json.NewEncoder(w) - return enc.Encode(struct { - Description string `json:"description,omitempty"` - RequestID string `json:"requestId,omitempty"` - }{ - Description: call.Description, - RequestID: call.RequestID, - }) -} - -// Do method -func (call *IMPAudienceGroupCall) Do() (*IMPAudienceGroupResponse, error) { - var buf bytes.Buffer - if err := call.encodeJSON(&buf); err != nil { - return nil, err - } - res, err := call.c.post(call.ctx, APIAudienceGroupIMP, &buf) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToIMPAudienceGroupResponse(res) -} - -// UpdateAudienceGroupDescription method -func (client *Client) UpdateAudienceGroupDescription(audienceGroupID int, description string) *UpdateAudienceGroupDescriptionCall { - call := &UpdateAudienceGroupDescriptionCall{ - c: client, - AudienceGroupID: audienceGroupID, - Description: description, - } - return call -} - -// UpdateAudienceGroupDescriptionCall type -type UpdateAudienceGroupDescriptionCall struct { - c *Client - ctx context.Context - AudienceGroupID int `json:"-" validate:"required"` - Description string `validate:"required,max=120"` -} - -// WithContext method -func (call *UpdateAudienceGroupDescriptionCall) WithContext(ctx context.Context) *UpdateAudienceGroupDescriptionCall { - call.ctx = ctx - return call -} - -func (call *UpdateAudienceGroupDescriptionCall) encodeJSON(w io.Writer) error { - enc := json.NewEncoder(w) - return enc.Encode(struct { - Description string `json:"description,omitempty"` - }{ - Description: call.Description, - }) -} - -// Do method -func (call *UpdateAudienceGroupDescriptionCall) Do() (*BasicResponse, error) { - var buf bytes.Buffer - if err := call.encodeJSON(&buf); err != nil { - return nil, err - } - res, err := call.c.put(call.ctx, fmt.Sprintf(APIAudienceGroupUpdateDescription, call.AudienceGroupID), &buf) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// ActivateAudienceGroup method -func (client *Client) ActivateAudienceGroup(audienceGroupID int) *ActivateAudienceGroupCall { - call := &ActivateAudienceGroupCall{ - c: client, - AudienceGroupID: audienceGroupID, - } - return call -} - -// ActivateAudienceGroupCall type -type ActivateAudienceGroupCall struct { - c *Client - ctx context.Context - AudienceGroupID int `json:"-" validate:"required"` -} - -// WithContext method -func (call *ActivateAudienceGroupCall) WithContext(ctx context.Context) *ActivateAudienceGroupCall { - call.ctx = ctx - return call -} - -// Do method -func (call *ActivateAudienceGroupCall) Do() (*BasicResponse, error) { - res, err := call.c.put(call.ctx, fmt.Sprintf(APIAudienceGroupActivate, call.AudienceGroupID), nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// DeleteAudienceGroup method -func (client *Client) DeleteAudienceGroup(audienceGroupID int) *DeleteAudienceGroupCall { - call := &DeleteAudienceGroupCall{ - c: client, - AudienceGroupID: audienceGroupID, - } - return call -} - -// DeleteAudienceGroupCall type -type DeleteAudienceGroupCall struct { - c *Client - ctx context.Context - AudienceGroupID int `json:"-" validate:"required"` -} - -// WithContext method -func (call *DeleteAudienceGroupCall) WithContext(ctx context.Context) *DeleteAudienceGroupCall { - call.ctx = ctx - return call -} - -// Do method -func (call *DeleteAudienceGroupCall) Do() (*BasicResponse, error) { - res, err := call.c.delete(call.ctx, fmt.Sprintf(APIAudienceGroup, call.AudienceGroupID)) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// GetAudienceGroup method -func (client *Client) GetAudienceGroup(audienceGroupID int) *GetAudienceGroupCall { - call := &GetAudienceGroupCall{ - c: client, - AudienceGroupID: audienceGroupID, - } - return call -} - -// GetAudienceGroupCall type -type GetAudienceGroupCall struct { - c *Client - ctx context.Context - AudienceGroupID int `json:"-" validate:"required"` -} - -// WithContext method -func (call *GetAudienceGroupCall) WithContext(ctx context.Context) *GetAudienceGroupCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetAudienceGroupCall) Do() (*GetAudienceGroupResponse, error) { - res, err := call.c.get(call.ctx, call.c.endpointBase, fmt.Sprintf(APIAudienceGroup, call.AudienceGroupID), nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToGetAudienceGroupResponse(res) -} - -// IListAudienceGroupOption type -type IListAudienceGroupOption interface { - Apply(call *ListAudienceGroupCall) -} - -// WithListAudienceGroupCallDescription func -func WithListAudienceGroupCallDescription(description string) IListAudienceGroupOption { - return &withListAudienceGroupCallDescription{ - description: description, - } -} - -type withListAudienceGroupCallDescription struct { - description string -} - -func (w *withListAudienceGroupCallDescription) Apply(call *ListAudienceGroupCall) { - call.Description = w.description -} - -// WithListAudienceGroupCallStatus func -func WithListAudienceGroupCallStatus(status AudienceStatusType) IListAudienceGroupOption { - return &withListAudienceGroupCallStatus{ - status: status, - } -} - -type withListAudienceGroupCallStatus struct { - status AudienceStatusType -} - -func (w *withListAudienceGroupCallStatus) Apply(call *ListAudienceGroupCall) { - call.Status = w.status -} - -// WithListAudienceGroupCallSize func -func WithListAudienceGroupCallSize(size int) IListAudienceGroupOption { - return &withListAudienceGroupCallSize{ - size: size, - } -} - -type withListAudienceGroupCallSize struct { - size int -} - -func (w *withListAudienceGroupCallSize) Apply(call *ListAudienceGroupCall) { - call.Size = w.size -} - -// WithListAudienceGroupCallIncludesExternalPublicGroups func -func WithListAudienceGroupCallIncludesExternalPublicGroups(includesExternalPublicGroups bool) IListAudienceGroupOption { - return &withListAudienceGroupCallIncludesExternalPublicGroups{ - includesExternalPublicGroups: includesExternalPublicGroups, - } -} - -type withListAudienceGroupCallIncludesExternalPublicGroups struct { - includesExternalPublicGroups bool -} - -func (w *withListAudienceGroupCallIncludesExternalPublicGroups) Apply(call *ListAudienceGroupCall) { - call.IncludesExternalPublicGroups = w.includesExternalPublicGroups -} - -// WithListAudienceGroupCallCreateRoute func -func WithListAudienceGroupCallCreateRoute(createRoute string) IListAudienceGroupOption { - return &withListAudienceGroupCallCreateRoute{ - createRoute: createRoute, - } -} - -type withListAudienceGroupCallCreateRoute struct { - createRoute string -} - -func (w *withListAudienceGroupCallCreateRoute) Apply(call *ListAudienceGroupCall) { - call.CreateRoute = w.createRoute -} - -// ListAudienceGroup method -func (client *Client) ListAudienceGroup(page int, options ...IListAudienceGroupOption) *ListAudienceGroupCall { - call := &ListAudienceGroupCall{ - c: client, - Page: page, - IncludesExternalPublicGroups: true, - } - for _, item := range options { - item.Apply(call) - } - return call -} - -// ListAudienceGroupCall type -type ListAudienceGroupCall struct { - c *Client - ctx context.Context - Page int `json:"-" validate:"required,min=1"` - Description string `json:"-"` - Status AudienceStatusType `json:"-"` - Size int `json:"-" validate:"min=1,max=40"` - IncludesExternalPublicGroups bool `json:"-"` - CreateRoute string `json:"-"` -} - -// WithContext method -func (call *ListAudienceGroupCall) WithContext(ctx context.Context) *ListAudienceGroupCall { - call.ctx = ctx - return call -} - -// Do method -func (call *ListAudienceGroupCall) Do() (*ListAudienceGroupResponse, error) { - u := url.Values{} - u.Set("page", strconv.FormatInt(int64(call.Page), 10)) - u.Set("size", strconv.FormatInt(int64(call.Size), 10)) - if call.Description != "" { - u.Set("description", call.Description) - } - if call.Status != "" { - u.Set("status", call.Status.String()) - } - if !call.IncludesExternalPublicGroups { - u.Set("includesExternalPublicGroups", strconv.FormatBool(call.IncludesExternalPublicGroups)) - } - if call.CreateRoute != "" { - u.Set("createRoute", call.CreateRoute) - } - res, err := call.c.get(call.ctx, call.c.endpointBase, APIAudienceGroupList, u) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToListAudienceGroupResponse(res) -} - -// GetAudienceGroupAuthorityLevel method -func (client *Client) GetAudienceGroupAuthorityLevel() *GetAudienceGroupAuthorityLevelCall { - return &GetAudienceGroupAuthorityLevelCall{ - c: client, - } -} - -// GetAudienceGroupAuthorityLevelCall type -type GetAudienceGroupAuthorityLevelCall struct { - c *Client - ctx context.Context -} - -// WithContext method -func (call *GetAudienceGroupAuthorityLevelCall) WithContext(ctx context.Context) *GetAudienceGroupAuthorityLevelCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetAudienceGroupAuthorityLevelCall) Do() (*GetAudienceGroupAuthorityLevelResponse, error) { - res, err := call.c.get(call.ctx, call.c.endpointBase, APIAudienceGroupAuthorityLevel, nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToGetAudienceGroupAuthorityLevelResponse(res) -} - -// ChangeAudienceGroupAuthorityLevel method -func (client *Client) ChangeAudienceGroupAuthorityLevel(authorityLevel AudienceAuthorityLevelType) *ChangeAudienceGroupAuthorityLevelCall { - call := &ChangeAudienceGroupAuthorityLevelCall{ - c: client, - AuthorityLevel: authorityLevel, - } - return call -} - -// ChangeAudienceGroupAuthorityLevelCall type -type ChangeAudienceGroupAuthorityLevelCall struct { - c *Client - ctx context.Context - AuthorityLevel AudienceAuthorityLevelType `validate:"required"` -} - -// WithContext method -func (call *ChangeAudienceGroupAuthorityLevelCall) WithContext(ctx context.Context) *ChangeAudienceGroupAuthorityLevelCall { - call.ctx = ctx - return call -} - -func (call *ChangeAudienceGroupAuthorityLevelCall) encodeJSON(w io.Writer) error { - enc := json.NewEncoder(w) - return enc.Encode(struct { - AuthorityLevel AudienceAuthorityLevelType `json:"authorityLevel,omitempty"` - }{ - AuthorityLevel: call.AuthorityLevel, - }) -} - -// Do method -func (call *ChangeAudienceGroupAuthorityLevelCall) Do() (*BasicResponse, error) { - var buf bytes.Buffer - if err := call.encodeJSON(&buf); err != nil { - return nil, err - } - res, err := call.c.put(call.ctx, APIAudienceGroupAuthorityLevel, &buf) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/client.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/client.go deleted file mode 100644 index 7526baf94..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/client.go +++ /dev/null @@ -1,327 +0,0 @@ -// Copyright 2016 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "bytes" - "context" - "errors" - "fmt" - "io" - "io/ioutil" - "mime/multipart" - "net/http" - "net/textproto" - "net/url" - "path" - "time" -) - -// APIEndpoint constants -const ( - APIEndpointBase = "https://api.line.me" - APIEndpointBaseData = "https://api-data.line.me" - - APIEndpointPushMessage = "/v2/bot/message/push" - APIEndpointBroadcastMessage = "/v2/bot/message/broadcast" - APIEndpointReplyMessage = "/v2/bot/message/reply" - APIEndpointMulticast = "/v2/bot/message/multicast" - APIEndpointNarrowcast = "/v2/bot/message/narrowcast" - APIEndpointValidatePushMessage = "/v2/bot/message/validate/push" - APIEndpointValidateBroadcastMessage = "/v2/bot/message/validate/broadcast" - APIEndpointValidateReplyMessage = "/v2/bot/message/validate/reply" - APIEndpointValidateMulticastMessage = "/v2/bot/message/validate/multicast" - APIEndpointValidateNarrowcastMessage = "/v2/bot/message/validate/narrowcast" - APIEndpointGetMessageContent = "/v2/bot/message/%s/content" - APIEndpointGetMessageQuota = "/v2/bot/message/quota" - APIEndpointGetMessageConsumption = "/v2/bot/message/quota/consumption" - APIEndpointGetMessageQuotaConsumption = "/v2/bot/message/quota/consumption" - APIEndpointLeaveGroup = "/v2/bot/group/%s/leave" - APIEndpointLeaveRoom = "/v2/bot/room/%s/leave" - APIEndpointGetProfile = "/v2/bot/profile/%s" - APIEndpointGetFollowerIDs = "/v2/bot/followers/ids" - APIEndpointGetGroupMemberProfile = "/v2/bot/group/%s/member/%s" - APIEndpointGetRoomMemberProfile = "/v2/bot/room/%s/member/%s" - APIEndpointGetGroupMemberIDs = "/v2/bot/group/%s/members/ids" - APIEndpointGetRoomMemberIDs = "/v2/bot/room/%s/members/ids" - APIEndpointGetGroupMemberCount = "/v2/bot/group/%s/members/count" - APIEndpointGetRoomMemberCount = "/v2/bot/room/%s/members/count" - APIEndpointGetGroupSummary = "/v2/bot/group/%s/summary" - APIEndpointCreateRichMenu = "/v2/bot/richmenu" - APIEndpointGetRichMenu = "/v2/bot/richmenu/%s" - APIEndpointListRichMenu = "/v2/bot/richmenu/list" - APIEndpointDeleteRichMenu = "/v2/bot/richmenu/%s" - APIEndpointGetUserRichMenu = "/v2/bot/user/%s/richmenu" - APIEndpointLinkUserRichMenu = "/v2/bot/user/%s/richmenu/%s" - APIEndpointUnlinkUserRichMenu = "/v2/bot/user/%s/richmenu" - APIEndpointSetDefaultRichMenu = "/v2/bot/user/all/richmenu/%s" - APIEndpointDefaultRichMenu = "/v2/bot/user/all/richmenu" // Get: GET / Delete: DELETE - APIEndpointDownloadRichMenuImage = "/v2/bot/richmenu/%s/content" // Download: GET / Upload: POST - APIEndpointUploadRichMenuImage = "/v2/bot/richmenu/%s/content" // Download: GET / Upload: POST - APIEndpointBulkLinkRichMenu = "/v2/bot/richmenu/bulk/link" - APIEndpointBulkUnlinkRichMenu = "/v2/bot/richmenu/bulk/unlink" - APIEndpointValidateRichMenuObject = "/v2/bot/richmenu/validate" - - APIEndpointCreateRichMenuAlias = "/v2/bot/richmenu/alias" - APIEndpointGetRichMenuAlias = "/v2/bot/richmenu/alias/%s" - APIEndpointUpdateRichMenuAlias = "/v2/bot/richmenu/alias/%s" - APIEndpointDeleteRichMenuAlias = "/v2/bot/richmenu/alias/%s" - APIEndpointListRichMenuAlias = "/v2/bot/richmenu/alias/list" - - APIEndpointGetAllLIFFApps = "/liff/v1/apps" - APIEndpointAddLIFFApp = "/liff/v1/apps" - APIEndpointUpdateLIFFApp = "/liff/v1/apps/%s/view" - APIEndpointDeleteLIFFApp = "/liff/v1/apps/%s" - - APIEndpointLinkToken = "/v2/bot/user/%s/linkToken" - - APIEndpointGetMessageDelivery = "/v2/bot/message/delivery/%s" - APIEndpointGetMessageProgress = "/v2/bot/message/progress/%s" - APIEndpointInsight = "/v2/bot/insight/%s" - APIEndpointGetBotInfo = "/v2/bot/info" - - APIEndpointIssueAccessToken = "/v2/oauth/accessToken" - APIEndpointRevokeAccessToken = "/v2/oauth/revoke" - - APIEndpointIssueAccessTokenV2 = "/oauth2/v2.1/token" - APIEndpointGetAccessTokensV2 = "/oauth2/v2.1/tokens/kid" - APIEndpointRevokeAccessTokenV2 = "/oauth2/v2.1/revoke" - - APIEndpointGetWebhookInfo = "/v2/bot/channel/webhook/endpoint" - APIEndpointSetWebhookEndpoint = "/v2/bot/channel/webhook/endpoint" - APIEndpointTestWebhook = "/v2/bot/channel/webhook/test" - - APIAudienceGroupUpload = "/v2/bot/audienceGroup/upload" - APIAudienceGroupUploadByFile = "/v2/bot/audienceGroup/upload/byFile" - APIAudienceGroupClick = "/v2/bot/audienceGroup/click" - APIAudienceGroupIMP = "/v2/bot/audienceGroup/imp" - APIAudienceGroupUpdateDescription = "/v2/bot/audienceGroup/%d/updateDescription" - APIAudienceGroupActivate = "/v2/bot/audienceGroup/%d/activate" - APIAudienceGroup = "/v2/bot/audienceGroup/%d" - APIAudienceGroupList = "/v2/bot/audienceGroup/list" - APIAudienceGroupAuthorityLevel = "/v2/bot/audienceGroup/authorityLevel" -) - -// Client type -type Client struct { - channelSecret string - channelToken string - endpointBase *url.URL // default APIEndpointBase - endpointBaseData *url.URL // default APIEndpointBaseData - httpClient *http.Client // default http.DefaultClient - retryKeyID string // X-Line-Retry-Key allows you to safely retry API requests without duplicating messages -} - -// ClientOption type -type ClientOption func(*Client) error - -// New returns a new bot client instance. -func New(channelSecret, channelToken string, options ...ClientOption) (*Client, error) { - if channelSecret == "" { - return nil, errors.New("missing channel secret") - } - if channelToken == "" { - return nil, errors.New("missing channel access token") - } - c := &Client{ - channelSecret: channelSecret, - channelToken: channelToken, - httpClient: http.DefaultClient, - } - for _, option := range options { - err := option(c) - if err != nil { - return nil, err - } - } - if c.endpointBase == nil { - u, err := url.ParseRequestURI(APIEndpointBase) - if err != nil { - return nil, err - } - c.endpointBase = u - } - if c.endpointBaseData == nil { - u, err := url.ParseRequestURI(APIEndpointBaseData) - if err != nil { - return nil, err - } - c.endpointBaseData = u - } - return c, nil -} - -// WithHTTPClient function -func WithHTTPClient(c *http.Client) ClientOption { - return func(client *Client) error { - client.httpClient = c - return nil - } -} - -// WithEndpointBase function -func WithEndpointBase(endpointBase string) ClientOption { - return func(client *Client) error { - u, err := url.ParseRequestURI(endpointBase) - if err != nil { - return err - } - client.endpointBase = u - return nil - } -} - -// WithEndpointBaseData function -func WithEndpointBaseData(endpointBaseData string) ClientOption { - return func(client *Client) error { - u, err := url.ParseRequestURI(endpointBaseData) - if err != nil { - return err - } - client.endpointBaseData = u - return nil - } -} - -func (client *Client) url(base *url.URL, endpoint string) string { - u := *base - u.Path = path.Join(u.Path, endpoint) - return u.String() -} - -func (client *Client) do(ctx context.Context, req *http.Request) (*http.Response, error) { - req.Header.Set("Authorization", "Bearer "+client.channelToken) - req.Header.Set("User-Agent", "LINE-BotSDK-Go/"+version) - if len(client.retryKeyID) > 0 { - req.Header.Set("X-Line-Retry-Key", client.retryKeyID) - } - if ctx != nil { - req = req.WithContext(ctx) - } - return client.httpClient.Do(req) -} - -func (client *Client) get(ctx context.Context, base *url.URL, endpoint string, query url.Values) (*http.Response, error) { - req, err := http.NewRequest(http.MethodGet, client.url(base, endpoint), nil) - if err != nil { - return nil, err - } - if query != nil { - req.URL.RawQuery = query.Encode() - } - return client.do(ctx, req) -} - -func (client *Client) post(ctx context.Context, endpoint string, body io.Reader) (*http.Response, error) { - req, err := http.NewRequest(http.MethodPost, client.url(client.endpointBase, endpoint), body) - if err != nil { - return nil, err - } - req.Header.Set("Content-Type", "application/json; charset=UTF-8") - return client.do(ctx, req) -} - -func (client *Client) postForm(ctx context.Context, endpoint string, body io.Reader) (*http.Response, error) { - req, err := http.NewRequest("POST", client.url(client.endpointBase, endpoint), body) - if err != nil { - return nil, err - } - req.Header.Set("Content-Type", "application/x-www-form-urlencoded") - return client.do(ctx, req) -} - -func (client *Client) postFormFile(ctx context.Context, endpoint string, values map[string]io.Reader) (*http.Response, error) { - b, contentType, err := uploadFile(values) - if err != nil { - return nil, err - } - req, err := http.NewRequest(http.MethodPost, client.url(client.endpointBaseData, endpoint), &b) - if err != nil { - return nil, err - } - req.Header.Set("Content-Type", contentType) - return client.do(ctx, req) -} - -func (client *Client) put(ctx context.Context, endpoint string, body io.Reader) (*http.Response, error) { - req, err := http.NewRequest(http.MethodPut, client.url(client.endpointBase, endpoint), body) - if err != nil { - return nil, err - } - req.Header.Set("Content-Type", "application/json; charset=UTF-8") - return client.do(ctx, req) -} - -func (client *Client) putFormFile(ctx context.Context, endpoint string, values map[string]io.Reader) (*http.Response, error) { - b, contentType, err := uploadFile(values) - if err != nil { - return nil, err - } - req, err := http.NewRequest(http.MethodPut, client.url(client.endpointBaseData, endpoint), &b) - if err != nil { - return nil, err - } - req.Header.Set("Content-Type", contentType) - return client.do(ctx, req) -} - -func (client *Client) delete(ctx context.Context, endpoint string) (*http.Response, error) { - req, err := http.NewRequest(http.MethodDelete, client.url(client.endpointBase, endpoint), nil) - if err != nil { - return nil, err - } - return client.do(ctx, req) -} - -func (client *Client) setRetryKey(retryKey string) { - client.retryKeyID = retryKey -} - -func closeResponse(res *http.Response) error { - defer res.Body.Close() - _, err := io.Copy(ioutil.Discard, res.Body) - return err -} - -func uploadFile(values map[string]io.Reader) (bytes.Buffer, string, error) { - var ( - b bytes.Buffer - err error - ) - w := multipart.NewWriter(&b) - for key, r := range values { - var fw io.Writer - if x, ok := r.(io.Closer); ok { - defer x.Close() - } - if _, ok := r.(*bytes.Buffer); ok { - h := make(textproto.MIMEHeader) - h.Set("Content-Disposition", fmt.Sprintf(`form-data; name="%s"; filename="%s.txt"`, key, time.Now().Format("20060102150405"))) - h.Set("Content-Type", "text/plain") - if fw, err = w.CreatePart(h); err != nil { - return b, "", err - } - } else { - if fw, err = w.CreateFormField(key); err != nil { - return b, "", err - } - } - if _, err := io.Copy(fw, r); err != nil { - return b, "", err - } - } - w.Close() - return b, w.FormDataContentType(), nil -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/content_provider.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/content_provider.go deleted file mode 100644 index df04393bc..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/content_provider.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2021 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -// ContentProviderType type -type ContentProviderType string - -// ContentProviderType constants -const ( - ContentProviderTypeLINE ContentProviderType = "line" - ContentProviderTypeExternal ContentProviderType = "external" -) - -// ContentProvider type -type ContentProvider struct { - Type ContentProviderType `json:"type"` - OriginalContentURL string `json:"originalContentUrl,omitempty"` - PreviewImageURL string `json:"previewImageUrl,omitempty"` -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/delivery.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/delivery.go deleted file mode 100644 index c1c7edba4..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/delivery.go +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright 2019 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "context" - "fmt" - "net/url" -) - -// DeliveryType type -type DeliveryType string - -// DeliveryType constants -const ( - DeliveryTypeMulticast DeliveryType = "multicast" - DeliveryTypePush DeliveryType = "push" - DeliveryTypeReply DeliveryType = "reply" - DeliveryTypeBroadcast DeliveryType = "broadcast" -) - -// GetNumberReplyMessages method -func (client *Client) GetNumberReplyMessages(date string) *GetNumberMessagesCall { - return &GetNumberMessagesCall{ - c: client, - date: date, - deliveryType: DeliveryTypeReply, - } -} - -// GetNumberPushMessages method -func (client *Client) GetNumberPushMessages(date string) *GetNumberMessagesCall { - return &GetNumberMessagesCall{ - c: client, - date: date, - deliveryType: DeliveryTypePush, - } -} - -// GetNumberMulticastMessages method -func (client *Client) GetNumberMulticastMessages(date string) *GetNumberMessagesCall { - return &GetNumberMessagesCall{ - c: client, - date: date, - deliveryType: DeliveryTypeMulticast, - } -} - -// GetNumberBroadcastMessages method -func (client *Client) GetNumberBroadcastMessages(date string) *GetNumberMessagesCall { - return &GetNumberMessagesCall{ - c: client, - date: date, - deliveryType: DeliveryTypeBroadcast, - } -} - -// GetNumberMessagesCall type -type GetNumberMessagesCall struct { - c *Client - ctx context.Context - - date string - deliveryType DeliveryType -} - -// WithContext method -func (call *GetNumberMessagesCall) WithContext(ctx context.Context) *GetNumberMessagesCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetNumberMessagesCall) Do() (*MessagesNumberResponse, error) { - endpoint := fmt.Sprintf(APIEndpointGetMessageDelivery, call.deliveryType) - var q url.Values - if call.date != "" { - q = url.Values{"date": []string{call.date}} - } - res, err := call.c.get(call.ctx, call.c.endpointBase, endpoint, q) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToMessagesNumberResponse(res) -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/demographic_filter.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/demographic_filter.go deleted file mode 100644 index eddd9e720..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/demographic_filter.go +++ /dev/null @@ -1,300 +0,0 @@ -// Copyright 2020 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import "encoding/json" - -// DemographicFilter interface -type DemographicFilter interface { - DemographicFilter() -} - -// GenderType type -type GenderType string - -// GenderType constants -const ( - GenderMale GenderType = "male" - GenderFemale GenderType = "female" -) - -// GenderFilter type -type GenderFilter struct { - Type string `json:"type"` - Genders []GenderType `json:"oneOf"` -} - -// NewGenderFilter function -func NewGenderFilter(genders ...GenderType) *GenderFilter { - return &GenderFilter{ - Type: "gender", - Genders: genders, - } -} - -// DemographicFilter implements DemographicFilter interface -func (*GenderFilter) DemographicFilter() {} - -// AgeType type -type AgeType string - -// AgeType constants -const ( - AgeEmpty AgeType = "" - Age15 AgeType = "age_15" - Age20 AgeType = "age_20" - Age25 AgeType = "age_25" - Age30 AgeType = "age_30" - Age35 AgeType = "age_35" - Age40 AgeType = "age_40" - Age45 AgeType = "age_45" - Age50 AgeType = "age_50" -) - -// AgeFilter type -type AgeFilter struct { - Type string `json:"type"` - GTE AgeType `json:"gte,omitempty"` // greater than or equal to - LT AgeType `json:"lt,omitempty"` // less than -} - -// NewAgeFilter function -func NewAgeFilter(gte, lt AgeType) *AgeFilter { - return &AgeFilter{ - Type: "age", - GTE: gte, - LT: lt, - } -} - -// DemographicFilter implements DemographicFilter interface -func (*AgeFilter) DemographicFilter() {} - -// AppType type -type AppType string - -// AppType constants -const ( - AppTypeIOS AppType = "ios" - AppTypeAndroid AppType = "android" -) - -// AppTypeFilter type -type AppTypeFilter struct { - Type string `json:"type"` - AppTypes []AppType `json:"oneOf"` -} - -// NewAppTypeFilter function -func NewAppTypeFilter(appTypes ...AppType) *AppTypeFilter { - return &AppTypeFilter{ - Type: "appType", - AppTypes: appTypes, - } -} - -// DemographicFilter implements DemographicFilter interface -func (*AppTypeFilter) DemographicFilter() {} - -// AreaType type -type AreaType string - -// AreaType constants -const ( - AreaJPHokkaido AreaType = "jp_01" - AreaJPAomori AreaType = "jp_02" - AreaJPIwate AreaType = "jp_03" - AreaJPMiyagi AreaType = "jp_04" - AreaJPAkita AreaType = "jp_05" - AreaJPYamagata AreaType = "jp_06" - AreaJPFukushima AreaType = "jp_07" - AreaJPIbaraki AreaType = "jp_08" - AreaJPTochigi AreaType = "jp_09" - AreaJPGunma AreaType = "jp_10" - AreaJPSaitama AreaType = "jp_11" - AreaJPChiba AreaType = "jp_12" - AreaJPTokyo AreaType = "jp_13" - AreaJPKanagawa AreaType = "jp_14" - AreaJPNiigata AreaType = "jp_15" - AreaJPToyama AreaType = "jp_16" - AreaJPIshikawa AreaType = "jp_17" - AreaJPFukui AreaType = "jp_18" - AreaJPYamanashi AreaType = "jp_19" - AreaJPNagano AreaType = "jp_20" - AreaJPGifu AreaType = "jp_21" - AreaJPShizuoka AreaType = "jp_22" - AreaJPAichi AreaType = "jp_23" - AreaJPMie AreaType = "jp_24" - AreaJPShiga AreaType = "jp_25" - AreaJPKyoto AreaType = "jp_26" - AreaJPOsaka AreaType = "jp_27" - AreaJPHyougo AreaType = "jp_28" - AreaJPNara AreaType = "jp_29" - AreaJPWakayama AreaType = "jp_30" - AreaJPTottori AreaType = "jp_31" - AreaJPShimane AreaType = "jp_32" - AreaJPOkayama AreaType = "jp_33" - AreaJPHiroshima AreaType = "jp_34" - AreaJPYamaguchi AreaType = "jp_35" - AreaJPTokushima AreaType = "jp_36" - AreaJPKagawa AreaType = "jp_37" - AreaJPEhime AreaType = "jp_38" - AreaJPKouchi AreaType = "jp_39" - AreaJPFukuoka AreaType = "jp_40" - AreaJPSaga AreaType = "jp_41" - AreaJPNagasaki AreaType = "jp_42" - AreaJPKumamoto AreaType = "jp_43" - AreaJPOita AreaType = "jp_44" - AreaJPMiyazaki AreaType = "jp_45" - AreaJPKagoshima AreaType = "jp_46" - AreaJPOkinawa AreaType = "jp_47" - AreaTWTaipeiCity AreaType = "tw_01" - AreaTWNewTaipeiCity AreaType = "tw_02" - AreaTWTaoyuanCity AreaType = "tw_03" - AreaTWTaichungCity AreaType = "tw_04" - AreaTWTainanCity AreaType = "tw_05" - AreaTWKaohsiungCity AreaType = "tw_06" - AreaTWKeelungCity AreaType = "tw_07" - AreaTWHsinchuCity AreaType = "tw_08" - AreaTWChiayiCity AreaType = "tw_09" - AreaTWHsinchuCounty AreaType = "tw_10" - AreaTWMiaoliCounty AreaType = "tw_11" - AreaTWChanghuaCounty AreaType = "tw_12" - AreaTWNantouCounty AreaType = "tw_13" - AreaTWYunlinCounty AreaType = "tw_14" - AreaTWChiayiCounty AreaType = "tw_15" - AreaTWPingtungCounty AreaType = "tw_16" - AreaTWYilanCounty AreaType = "tw_17" - AreaTWHualienCounty AreaType = "tw_18" - AreaTWTaitungCounty AreaType = "tw_19" - AreaTWPenghuCounty AreaType = "tw_20" - AreaTWKinmenCounty AreaType = "tw_21" - AreaTWLienchiangCounty AreaType = "tw_22" - AreaTHBangkok AreaType = "th_01" - AreaTHPattaya AreaType = "th_02" - AreaTHNorthern AreaType = "th_03" - AreaTHCentral AreaType = "th_04" - AreaTHSouthern AreaType = "th_05" - AreaTHEastern AreaType = "th_06" - AreaTHNorthEastern AreaType = "th_07" - AreaTHWestern AreaType = "th_08" - AreaIDBali AreaType = "id_01" - AreaIDBandung AreaType = "id_02" - AreaIDBanjarmasin AreaType = "id_03" - AreaIDJabodetabek AreaType = "id_04" - AreaIDLainnya AreaType = "id_05" - AreaIDMakassar AreaType = "id_06" - AreaIDMedan AreaType = "id_07" - AreaIDPalembang AreaType = "id_08" - AreaIDSamarinda AreaType = "id_09" - AreaIDSemarang AreaType = "id_10" - AreaIDSurabaya AreaType = "id_11" - AreaIDYogyakarta AreaType = "id_12" -) - -// AreaFilter type -type AreaFilter struct { - Type string `json:"type"` - Areas []AreaType `json:"oneOf"` -} - -// NewAreaFilter function -func NewAreaFilter(areaTypes ...AreaType) *AreaFilter { - return &AreaFilter{ - Type: "area", - Areas: areaTypes, - } -} - -// DemographicFilter implements DemographicFilter interface -func (*AreaFilter) DemographicFilter() {} - -// PeriodType type -type PeriodType string - -// PeriodType constants -const ( - PeriodEmpty PeriodType = "" - PeriodDay7 PeriodType = "day_7" - PeriodDay30 PeriodType = "day_30" - PeriodDay90 PeriodType = "day_90" - PeriodDay180 PeriodType = "day_180" - PeriodDay365 PeriodType = "day_365" -) - -// SubscriptionPeriodFilter type -type SubscriptionPeriodFilter struct { - Type string `json:"type"` - GTE PeriodType `json:"gte,omitempty"` // greater than or equal to - LT PeriodType `json:"lt,omitempty"` // less than -} - -// NewSubscriptionPeriodFilter function -func NewSubscriptionPeriodFilter(gte, lt PeriodType) *SubscriptionPeriodFilter { - return &SubscriptionPeriodFilter{ - Type: "subscriptionPeriod", - GTE: gte, - LT: lt, - } -} - -// DemographicFilter implements DemographicFilter interface -func (*SubscriptionPeriodFilter) DemographicFilter() {} - -// DemographicFilterOperator struct -type DemographicFilterOperator struct { - ConditionAnd []DemographicFilter `json:"and,omitempty"` - ConditionOr []DemographicFilter `json:"or,omitempty"` - ConditionNot DemographicFilter `json:"not,omitempty"` -} - -// DemographicFilterOperatorAnd method -func DemographicFilterOperatorAnd(conditions ...DemographicFilter) *DemographicFilterOperator { - return &DemographicFilterOperator{ - ConditionAnd: conditions, - } -} - -// DemographicFilterOperatorOr method -func DemographicFilterOperatorOr(conditions ...DemographicFilter) *DemographicFilterOperator { - return &DemographicFilterOperator{ - ConditionOr: conditions, - } -} - -// DemographicFilterOperatorNot method -func DemographicFilterOperatorNot(condition DemographicFilter) *DemographicFilterOperator { - return &DemographicFilterOperator{ - ConditionNot: condition, - } -} - -// MarshalJSON method of DemographicFilterOperator -func (o *DemographicFilterOperator) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type string `json:"type"` - ConditionAnd []DemographicFilter `json:"and,omitempty"` - ConditionOr []DemographicFilter `json:"or,omitempty"` - ConditionNot DemographicFilter `json:"not,omitempty"` - }{ - Type: "operator", - ConditionAnd: o.ConditionAnd, - ConditionOr: o.ConditionOr, - ConditionNot: o.ConditionNot, - }) -} - -// DemographicFilter implements DemographicFilter interface -func (*DemographicFilterOperator) DemographicFilter() {} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/emoji.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/emoji.go deleted file mode 100644 index 62e1886ca..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/emoji.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2020 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -// Emoji type -type Emoji struct { - Index int `json:"index"` - Length int `json:"length,omitempty"` - ProductID string `json:"productId,omitempty"` - EmojiID string `json:"emojiId,omitempty"` -} - -// NewEmoji function -func NewEmoji(index int, productID, emojiID string) *Emoji { - return &Emoji{ - Index: index, - ProductID: productID, - EmojiID: emojiID, - } -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/error.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/error.go deleted file mode 100644 index 043a92fdd..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/error.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2016 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "bytes" - "errors" - "fmt" -) - -// errors -var ( - ErrInvalidSignature = errors.New("invalid signature") -) - -// APIError type -type APIError struct { - Code int - Response *ErrorResponse -} - -// Error method -func (e *APIError) Error() string { - var buf bytes.Buffer - fmt.Fprintf(&buf, "linebot: APIError %d ", e.Code) - if e.Response != nil { - fmt.Fprintf(&buf, "%s", e.Response.Message) - for _, d := range e.Response.Details { - fmt.Fprintf(&buf, "\n[%s] %s", d.Property, d.Message) - } - } - return buf.String() -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/event.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/event.go deleted file mode 100644 index bc333f7be..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/event.go +++ /dev/null @@ -1,544 +0,0 @@ -// Copyright 2016 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "encoding/hex" - "encoding/json" - "time" -) - -// EventType type -type EventType string - -// EventType constants -const ( - EventTypeMessage EventType = "message" - EventTypeFollow EventType = "follow" - EventTypeUnfollow EventType = "unfollow" - EventTypeJoin EventType = "join" - EventTypeLeave EventType = "leave" - EventTypeMemberJoined EventType = "memberJoined" - EventTypeMemberLeft EventType = "memberLeft" - EventTypePostback EventType = "postback" - EventTypeBeacon EventType = "beacon" - EventTypeAccountLink EventType = "accountLink" - EventTypeThings EventType = "things" - EventTypeUnsend EventType = "unsend" - EventTypeVideoPlayComplete EventType = "videoPlayComplete" -) - -// EventMode type -type EventMode string - -// EventMode constants -const ( - EventModeActive EventMode = "active" - EventModeStandby EventMode = "standby" -) - -// EventSourceType type -type EventSourceType string - -// EventSourceType constants -const ( - EventSourceTypeUser EventSourceType = "user" - EventSourceTypeGroup EventSourceType = "group" - EventSourceTypeRoom EventSourceType = "room" -) - -// EventSource type -type EventSource struct { - Type EventSourceType `json:"type"` - UserID string `json:"userId,omitempty"` - GroupID string `json:"groupId,omitempty"` - RoomID string `json:"roomId,omitempty"` -} - -// Params type -type Params struct { - Date string `json:"date,omitempty"` - Time string `json:"time,omitempty"` - Datetime string `json:"datetime,omitempty"` - NewRichMenuAliasID string `json:"newRichMenuAliasId,omitempty"` - Status string `json:"status,omitempty"` -} - -// Members type -type Members struct { - Members []EventSource `json:"members"` -} - -// Postback type -type Postback struct { - Data string `json:"data"` - Params *Params `json:"params,omitempty"` -} - -// BeaconEventType type -type BeaconEventType string - -// BeaconEventType constants -const ( - BeaconEventTypeEnter BeaconEventType = "enter" - BeaconEventTypeLeave BeaconEventType = "leave" - BeaconEventTypeBanner BeaconEventType = "banner" - BeaconEventTypeStay BeaconEventType = "stay" -) - -// Beacon type -type Beacon struct { - Hwid string - Type BeaconEventType - DeviceMessage []byte -} - -// AccountLinkResult type -type AccountLinkResult string - -// AccountLinkResult constants -const ( - AccountLinkResultOK AccountLinkResult = "ok" - AccountLinkResultFailed AccountLinkResult = "failed" -) - -// AccountLink type -type AccountLink struct { - Result AccountLinkResult - Nonce string -} - -// ThingsResult type -type ThingsResult struct { - ScenarioID string - Revision int - StartTime int64 - EndTime int64 - ResultCode ThingsResultCode - ActionResults []*ThingsActionResult - BLENotificationPayload []byte - ErrorReason string -} - -// ThingsResultCode type -type ThingsResultCode string - -// ThingsResultCode constants -const ( - ThingsResultCodeSuccess ThingsResultCode = "success" - ThingsResultCodeGattError ThingsResultCode = "gatt_error" - ThingsResultCodeRuntimeError ThingsResultCode = "runtime_error" -) - -// ThingsActionResult type -type ThingsActionResult struct { - Type ThingsActionResultType - Data []byte -} - -// ThingsActionResultType type -type ThingsActionResultType string - -// ThingsActionResultType constants -const ( - ThingsActionResultTypeBinary ThingsActionResultType = "binary" - ThingsActionResultTypeVoid ThingsActionResultType = "void" -) - -// Things type -type Things struct { - DeviceID string - Type string - Result *ThingsResult -} - -// Unsend type -type Unsend struct { - MessageID string `json:"messageId"` -} - -// VideoPlayComplete type -type VideoPlayComplete struct { - TrackingID string `json:"trackingId"` -} - -// StickerResourceType type -type StickerResourceType string - -// StickerResourceType constants -const ( - StickerResourceTypeStatic StickerResourceType = "STATIC" - StickerResourceTypeAnimation StickerResourceType = "ANIMATION" - StickerResourceTypeSound StickerResourceType = "SOUND" - StickerResourceTypeAnimationSound StickerResourceType = "ANIMATION_SOUND" - StickerResourceTypePerStickerText StickerResourceType = "MESSAGE" - StickerResourceTypePopup StickerResourceType = "POPUP" - StickerResourceTypePopupSound StickerResourceType = "POPUP_SOUND" - StickerResourceTypeNameText StickerResourceType = "CUSTOM" -) - -// DeliveryContext type -type DeliveryContext struct { - IsRedelivery bool `json:"isRedelivery"` -} - -// Event type -type Event struct { - ReplyToken string - Type EventType - Mode EventMode - Timestamp time.Time - Source *EventSource - Message Message - Joined *Members - Left *Members - Postback *Postback - Beacon *Beacon - AccountLink *AccountLink - Things *Things - Members []*EventSource - Unsend *Unsend - VideoPlayComplete *VideoPlayComplete - WebhookEventID string - DeliveryContext DeliveryContext -} - -type rawEvent struct { - ReplyToken string `json:"replyToken,omitempty"` - Type EventType `json:"type"` - Mode EventMode `json:"mode"` - Timestamp int64 `json:"timestamp"` - Source *EventSource `json:"source"` - Message *rawEventMessage `json:"message,omitempty"` - Postback *Postback `json:"postback,omitempty"` - Beacon *rawBeaconEvent `json:"beacon,omitempty"` - AccountLink *rawAccountLinkEvent `json:"link,omitempty"` - Joined *rawMemberEvent `json:"joined,omitempty"` - Left *rawMemberEvent `json:"left,omitempty"` - Things *rawThingsEvent `json:"things,omitempty"` - Unsend *Unsend `json:"unsend,omitempty"` - VideoPlayComplete *VideoPlayComplete `json:"videoPlayComplete,omitempty"` - WebhookEventID string `json:"webhookEventId"` - DeliveryContext DeliveryContext `json:"deliveryContext"` -} - -type rawMemberEvent struct { - Members []*EventSource `json:"members"` -} - -type rawEventMessage struct { - ID string `json:"id"` - Type MessageType `json:"type"` - Text string `json:"text,omitempty"` - Duration int `json:"duration,omitempty"` - Title string `json:"title,omitempty"` - Address string `json:"address,omitempty"` - FileName string `json:"fileName,omitempty"` - FileSize int `json:"fileSize,omitempty"` - Latitude float64 `json:"latitude,omitempty"` - Longitude float64 `json:"longitude,omitempty"` - PackageID string `json:"packageId,omitempty"` - StickerID string `json:"stickerId,omitempty"` - ContentProvider *ContentProvider `json:"contentProvider,omitempty"` - ImageSet *ImageSet `json:"imageSet,omitempty"` - StickerResourceType StickerResourceType `json:"stickerResourceType,omitempty"` - Keywords []string `json:"keywords,omitempty"` - Emojis []*Emoji `json:"emojis,omitempty"` - Mention *Mention `json:"mention,omitempty"` -} - -type rawBeaconEvent struct { - Hwid string `json:"hwid"` - Type BeaconEventType `json:"type"` - DM string `json:"dm,omitempty"` -} - -type rawAccountLinkEvent struct { - Result AccountLinkResult `json:"result"` - Nonce string `json:"nonce"` -} - -type rawThingsResult struct { - ScenarioID string `json:"scenarioId"` - Revision int `json:"revision"` - StartTime int64 `json:"startTime"` - EndTime int64 `json:"endTime"` - ResultCode ThingsResultCode `json:"resultCode"` - ActionResults []*rawThingsActionResult `json:"actionResults"` - BLENotificationPayload string `json:"bleNotificationPayload,omitempty"` - ErrorReason string `json:"errorReason,omitempty"` -} - -type rawThingsActionResult struct { - Type ThingsActionResultType `json:"type,omitempty"` - Data string `json:"data,omitempty"` -} - -type rawThingsEvent struct { - DeviceID string `json:"deviceId"` - Type string `json:"type"` - Result *rawThingsResult `json:"result,omitempty"` -} - -const ( - milliSecPerSec = int64(time.Second / time.Millisecond) - nanoSecPerMilliSec = int64(time.Millisecond / time.Nanosecond) -) - -// MarshalJSON method of Event -func (e *Event) MarshalJSON() ([]byte, error) { - raw := rawEvent{ - ReplyToken: e.ReplyToken, - Type: e.Type, - Mode: e.Mode, - Timestamp: e.Timestamp.Unix()*milliSecPerSec + int64(e.Timestamp.Nanosecond())/int64(time.Millisecond), - Source: e.Source, - Postback: e.Postback, - Unsend: e.Unsend, - VideoPlayComplete: e.VideoPlayComplete, - WebhookEventID: e.WebhookEventID, - DeliveryContext: e.DeliveryContext, - } - if e.Beacon != nil { - raw.Beacon = &rawBeaconEvent{ - Hwid: e.Beacon.Hwid, - Type: e.Beacon.Type, - DM: hex.EncodeToString(e.Beacon.DeviceMessage), - } - } - if e.AccountLink != nil { - raw.AccountLink = &rawAccountLinkEvent{ - Result: e.AccountLink.Result, - Nonce: e.AccountLink.Nonce, - } - } - - switch e.Type { - case EventTypeMemberJoined: - raw.Joined = &rawMemberEvent{ - Members: e.Members, - } - case EventTypeMemberLeft: - raw.Left = &rawMemberEvent{ - Members: e.Members, - } - case EventTypeThings: - raw.Things = &rawThingsEvent{ - DeviceID: e.Things.DeviceID, - Type: e.Things.Type, - } - if e.Things.Result != nil { - raw.Things.Result = &rawThingsResult{ - ScenarioID: e.Things.Result.ScenarioID, - Revision: e.Things.Result.Revision, - StartTime: e.Things.Result.StartTime, - EndTime: e.Things.Result.EndTime, - ResultCode: e.Things.Result.ResultCode, - - BLENotificationPayload: string(e.Things.Result.BLENotificationPayload), - ErrorReason: e.Things.Result.ErrorReason, - } - if e.Things.Result.ActionResults != nil { - raw.Things.Result.ActionResults = make([]*rawThingsActionResult, len(e.Things.Result.ActionResults)) - } - for i := range e.Things.Result.ActionResults { - raw.Things.Result.ActionResults[i] = &rawThingsActionResult{ - Type: e.Things.Result.ActionResults[i].Type, - Data: string(e.Things.Result.ActionResults[i].Data), - } - } - } - } - - switch m := e.Message.(type) { - case *TextMessage: - raw.Message = &rawEventMessage{ - Type: MessageTypeText, - ID: m.ID, - Text: m.Text, - Emojis: m.Emojis, - Mention: m.Mention, - } - case *ImageMessage: - raw.Message = &rawEventMessage{ - Type: MessageTypeImage, - ID: m.ID, - ContentProvider: m.ContentProvider, - ImageSet: m.ImageSet, - } - case *VideoMessage: - raw.Message = &rawEventMessage{ - Type: MessageTypeVideo, - ID: m.ID, - Duration: m.Duration, - ContentProvider: m.ContentProvider, - } - case *AudioMessage: - raw.Message = &rawEventMessage{ - Type: MessageTypeAudio, - ID: m.ID, - Duration: m.Duration, - ContentProvider: m.ContentProvider, - } - case *FileMessage: - raw.Message = &rawEventMessage{ - Type: MessageTypeFile, - ID: m.ID, - FileName: m.FileName, - FileSize: m.FileSize, - } - case *LocationMessage: - raw.Message = &rawEventMessage{ - Type: MessageTypeLocation, - ID: m.ID, - Title: m.Title, - Address: m.Address, - Latitude: m.Latitude, - Longitude: m.Longitude, - } - case *StickerMessage: - raw.Message = &rawEventMessage{ - Type: MessageTypeSticker, - ID: m.ID, - PackageID: m.PackageID, - StickerID: m.StickerID, - StickerResourceType: m.StickerResourceType, - Keywords: m.Keywords, - Text: m.Text, - } - } - return json.Marshal(&raw) -} - -// UnmarshalJSON method of Event -func (e *Event) UnmarshalJSON(body []byte) (err error) { - rawEvent := rawEvent{} - if err = json.Unmarshal(body, &rawEvent); err != nil { - return - } - - e.ReplyToken = rawEvent.ReplyToken - e.Type = rawEvent.Type - e.Mode = rawEvent.Mode - e.Timestamp = time.Unix(rawEvent.Timestamp/milliSecPerSec, (rawEvent.Timestamp%milliSecPerSec)*nanoSecPerMilliSec).UTC() - e.Source = rawEvent.Source - e.WebhookEventID = rawEvent.WebhookEventID - e.DeliveryContext = rawEvent.DeliveryContext - - switch rawEvent.Type { - case EventTypeMessage: - switch rawEvent.Message.Type { - case MessageTypeText: - e.Message = &TextMessage{ - ID: rawEvent.Message.ID, - Text: rawEvent.Message.Text, - Emojis: rawEvent.Message.Emojis, - Mention: rawEvent.Message.Mention, - } - case MessageTypeImage: - e.Message = &ImageMessage{ - ID: rawEvent.Message.ID, - ContentProvider: rawEvent.Message.ContentProvider, - ImageSet: rawEvent.Message.ImageSet, - } - case MessageTypeVideo: - e.Message = &VideoMessage{ - ID: rawEvent.Message.ID, - Duration: rawEvent.Message.Duration, - ContentProvider: rawEvent.Message.ContentProvider, - } - case MessageTypeAudio: - e.Message = &AudioMessage{ - ID: rawEvent.Message.ID, - Duration: rawEvent.Message.Duration, - ContentProvider: rawEvent.Message.ContentProvider, - } - case MessageTypeFile: - e.Message = &FileMessage{ - ID: rawEvent.Message.ID, - FileName: rawEvent.Message.FileName, - FileSize: rawEvent.Message.FileSize, - } - case MessageTypeLocation: - e.Message = &LocationMessage{ - ID: rawEvent.Message.ID, - Title: rawEvent.Message.Title, - Address: rawEvent.Message.Address, - Latitude: rawEvent.Message.Latitude, - Longitude: rawEvent.Message.Longitude, - } - case MessageTypeSticker: - e.Message = &StickerMessage{ - ID: rawEvent.Message.ID, - PackageID: rawEvent.Message.PackageID, - StickerID: rawEvent.Message.StickerID, - StickerResourceType: rawEvent.Message.StickerResourceType, - Keywords: rawEvent.Message.Keywords, - Text: rawEvent.Message.Text, - } - } - case EventTypePostback: - e.Postback = rawEvent.Postback - case EventTypeBeacon: - var deviceMessage []byte - deviceMessage, err = hex.DecodeString(rawEvent.Beacon.DM) - if err != nil { - return - } - e.Beacon = &Beacon{ - Hwid: rawEvent.Beacon.Hwid, - Type: rawEvent.Beacon.Type, - DeviceMessage: deviceMessage, - } - case EventTypeAccountLink: - e.AccountLink = &AccountLink{ - Result: rawEvent.AccountLink.Result, - Nonce: rawEvent.AccountLink.Nonce, - } - case EventTypeMemberJoined: - e.Members = rawEvent.Joined.Members - case EventTypeMemberLeft: - e.Members = rawEvent.Left.Members - case EventTypeThings: - e.Things = &Things{ - Type: rawEvent.Things.Type, - DeviceID: rawEvent.Things.DeviceID, - } - if rawEvent.Things.Result != nil { - rawResult := rawEvent.Things.Result - e.Things.Result = &ThingsResult{ - ScenarioID: rawResult.ScenarioID, - Revision: rawResult.Revision, - StartTime: rawResult.StartTime, - EndTime: rawResult.EndTime, - ResultCode: rawResult.ResultCode, - ActionResults: make([]*ThingsActionResult, len(rawResult.ActionResults)), - BLENotificationPayload: []byte(rawResult.BLENotificationPayload), - ErrorReason: rawResult.ErrorReason, - } - for i := range rawResult.ActionResults { - e.Things.Result.ActionResults[i] = &ThingsActionResult{ - Type: rawResult.ActionResults[i].Type, - Data: []byte(rawResult.ActionResults[i].Data), - } - } - } - case EventTypeUnsend: - e.Unsend = rawEvent.Unsend - case EventTypeVideoPlayComplete: - e.VideoPlayComplete = rawEvent.VideoPlayComplete - } - return -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/flex.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/flex.go deleted file mode 100644 index abc958413..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/flex.go +++ /dev/null @@ -1,960 +0,0 @@ -// Copyright 2018 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import "encoding/json" - -// FlexContainerType type -type FlexContainerType string - -// IntPtr is a helper function for using *int values -func IntPtr(v int) *int { - return &v -} - -// FlexContainerType constants -const ( - FlexContainerTypeBubble FlexContainerType = "bubble" - FlexContainerTypeCarousel FlexContainerType = "carousel" -) - -// FlexComponentType type -type FlexComponentType string - -// FlexComponentType constants -const ( - FlexComponentTypeBox FlexComponentType = "box" - FlexComponentTypeButton FlexComponentType = "button" - FlexComponentTypeFiller FlexComponentType = "filler" - FlexComponentTypeIcon FlexComponentType = "icon" - FlexComponentTypeImage FlexComponentType = "image" - FlexComponentTypeSeparator FlexComponentType = "separator" - FlexComponentTypeSpacer FlexComponentType = "spacer" - FlexComponentTypeSpan FlexComponentType = "span" - FlexComponentTypeText FlexComponentType = "text" - FlexComponentTypeVideo FlexComponentType = "video" -) - -// FlexBubbleSizeType type -type FlexBubbleSizeType string - -// FlexBubbleSizeType constants -const ( - FlexBubbleSizeTypeNano FlexBubbleSizeType = "nano" - FlexBubbleSizeTypeMicro FlexBubbleSizeType = "micro" - FlexBubbleSizeTypeKilo FlexBubbleSizeType = "kilo" - FlexBubbleSizeTypeMega FlexBubbleSizeType = "mega" - FlexBubbleSizeTypeGiga FlexBubbleSizeType = "giga" -) - -// FlexBubbleDirectionType type -type FlexBubbleDirectionType string - -// FlexBubbleDirectionType constants -const ( - FlexBubbleDirectionTypeLTR FlexBubbleDirectionType = "ltr" - FlexBubbleDirectionTypeRTL FlexBubbleDirectionType = "rtl" -) - -// FlexButtonStyleType type -type FlexButtonStyleType string - -// FlexButtonStyleType constants -const ( - FlexButtonStyleTypeLink FlexButtonStyleType = "link" - FlexButtonStyleTypePrimary FlexButtonStyleType = "primary" - FlexButtonStyleTypeSecondary FlexButtonStyleType = "secondary" -) - -// FlexButtonHeightType type -type FlexButtonHeightType string - -// FlexButtonHeightType constants -const ( - FlexButtonHeightTypeMd FlexButtonHeightType = "md" - FlexButtonHeightTypeSm FlexButtonHeightType = "sm" -) - -// FlexIconAspectRatioType type -type FlexIconAspectRatioType string - -// FlexIconAspectRatioType constants -const ( - FlexIconAspectRatioType1to1 FlexIconAspectRatioType = "1:1" - FlexIconAspectRatioType2to1 FlexIconAspectRatioType = "2:1" - FlexIconAspectRatioType3to1 FlexIconAspectRatioType = "3:1" -) - -// FlexImageSizeType type -type FlexImageSizeType string - -// FlexImageSizeType constants -const ( - FlexImageSizeTypeXxs FlexImageSizeType = "xxs" - FlexImageSizeTypeXs FlexImageSizeType = "xs" - FlexImageSizeTypeSm FlexImageSizeType = "sm" - FlexImageSizeTypeMd FlexImageSizeType = "md" - FlexImageSizeTypeLg FlexImageSizeType = "lg" - FlexImageSizeTypeXl FlexImageSizeType = "xl" - FlexImageSizeTypeXxl FlexImageSizeType = "xxl" - FlexImageSizeType3xl FlexImageSizeType = "3xl" - FlexImageSizeType4xl FlexImageSizeType = "4xl" - FlexImageSizeType5xl FlexImageSizeType = "5xl" - FlexImageSizeTypeFull FlexImageSizeType = "full" -) - -// FlexImageAspectRatioType type -type FlexImageAspectRatioType string - -// FlexImageAspectRatioType constants -const ( - FlexImageAspectRatioType1to1 FlexImageAspectRatioType = "1:1" - FlexImageAspectRatioType1_51to1 FlexImageAspectRatioType = "1.51:1" - FlexImageAspectRatioType1_91to1 FlexImageAspectRatioType = "1.91:1" - FlexImageAspectRatioType4to3 FlexImageAspectRatioType = "4:3" - FlexImageAspectRatioType16to9 FlexImageAspectRatioType = "16:9" - FlexImageAspectRatioType20to13 FlexImageAspectRatioType = "20:13" - FlexImageAspectRatioType2to1 FlexImageAspectRatioType = "2:1" - FlexImageAspectRatioType3to1 FlexImageAspectRatioType = "3:1" - FlexImageAspectRatioType3to4 FlexImageAspectRatioType = "3:4" - FlexImageAspectRatioType9to16 FlexImageAspectRatioType = "9:16" - FlexImageAspectRatioType1to2 FlexImageAspectRatioType = "1:2" - FlexImageAspectRatioType1to3 FlexImageAspectRatioType = "1:3" -) - -// FlexImageAspectModeType type -type FlexImageAspectModeType string - -// FlexImageAspectModeType constants -const ( - FlexImageAspectModeTypeCover FlexImageAspectModeType = "cover" - FlexImageAspectModeTypeFit FlexImageAspectModeType = "fit" -) - -// FlexVideoAspectRatioType type -type FlexVideoAspectRatioType string - -// FlexVideoAspectRatioType constants -const ( - FlexVideoAspectRatioType1to1 FlexVideoAspectRatioType = "1:1" - FlexVideoAspectRatioType4to3 FlexVideoAspectRatioType = "4:3" - FlexVideoAspectRatioType16to9 FlexVideoAspectRatioType = "16:9" - FlexVideoAspectRatioType20to13 FlexVideoAspectRatioType = "20:13" - FlexVideoAspectRatioType21to9 FlexVideoAspectRatioType = "21:9" - FlexVideoAspectRatioType3to4 FlexVideoAspectRatioType = "3:4" - FlexVideoAspectRatioType9to16 FlexVideoAspectRatioType = "9:16" - FlexVideoAspectRatioType13to20 FlexVideoAspectRatioType = "13:20" - FlexVideoAspectRatioType9to21 FlexVideoAspectRatioType = "9:21" -) - -// FlexBoxLayoutType type -type FlexBoxLayoutType string - -// FlexBoxLayoutType constants -const ( - FlexBoxLayoutTypeHorizontal FlexBoxLayoutType = "horizontal" - FlexBoxLayoutTypeVertical FlexBoxLayoutType = "vertical" - FlexBoxLayoutTypeBaseline FlexBoxLayoutType = "baseline" -) - -// FlexComponentPositionType type -type FlexComponentPositionType string - -// FlexComponentPositionType constants -const ( - FlexComponentPositionTypeRelative FlexComponentPositionType = "relative" - FlexComponentPositionTypeAbsolute FlexComponentPositionType = "absolute" -) - -// FlexComponentSpacingType type -type FlexComponentSpacingType string - -// FlexComponentSpacingType constants -const ( - FlexComponentSpacingTypeNone FlexComponentSpacingType = "none" - FlexComponentSpacingTypeXs FlexComponentSpacingType = "xs" - FlexComponentSpacingTypeSm FlexComponentSpacingType = "sm" - FlexComponentSpacingTypeMd FlexComponentSpacingType = "md" - FlexComponentSpacingTypeLg FlexComponentSpacingType = "lg" - FlexComponentSpacingTypeXl FlexComponentSpacingType = "xl" - FlexComponentSpacingTypeXxl FlexComponentSpacingType = "xxl" -) - -// FlexComponentMarginType type -type FlexComponentMarginType string - -// FlexComponentMarginType constants -const ( - FlexComponentMarginTypeNone FlexComponentMarginType = "none" - FlexComponentMarginTypeXs FlexComponentMarginType = "xs" - FlexComponentMarginTypeSm FlexComponentMarginType = "sm" - FlexComponentMarginTypeMd FlexComponentMarginType = "md" - FlexComponentMarginTypeLg FlexComponentMarginType = "lg" - FlexComponentMarginTypeXl FlexComponentMarginType = "xl" - FlexComponentMarginTypeXxl FlexComponentMarginType = "xxl" -) - -// FlexComponentOffsetType type -type FlexComponentOffsetType string - -// FlexComponentOffsetType constants -const ( - FlexComponentOffsetTypeNone FlexComponentOffsetType = "none" - FlexComponentOffsetTypeXs FlexComponentOffsetType = "xs" - FlexComponentOffsetTypeSm FlexComponentOffsetType = "sm" - FlexComponentOffsetTypeMd FlexComponentOffsetType = "md" - FlexComponentOffsetTypeLg FlexComponentOffsetType = "lg" - FlexComponentOffsetTypeXl FlexComponentOffsetType = "xl" - FlexComponentOffsetTypeXxl FlexComponentOffsetType = "xxl" -) - -// FlexComponentPaddingType type -type FlexComponentPaddingType string - -// FlexComponentPaddingType constants -const ( - FlexComponentPaddingTypeNone FlexComponentPaddingType = "none" - FlexComponentPaddingTypeXs FlexComponentPaddingType = "xs" - FlexComponentPaddingTypeSm FlexComponentPaddingType = "sm" - FlexComponentPaddingTypeMd FlexComponentPaddingType = "md" - FlexComponentPaddingTypeLg FlexComponentPaddingType = "lg" - FlexComponentPaddingTypeXl FlexComponentPaddingType = "xl" - FlexComponentPaddingTypeXxl FlexComponentPaddingType = "xxl" -) - -// FlexComponentGravityType type -type FlexComponentGravityType string - -// FlexComponentGravityType constants -const ( - FlexComponentGravityTypeTop FlexComponentGravityType = "top" - FlexComponentGravityTypeBottom FlexComponentGravityType = "bottom" - FlexComponentGravityTypeCenter FlexComponentGravityType = "center" -) - -// FlexComponentAlignType type -type FlexComponentAlignType string - -// FlexComponentAlignType constants -const ( - FlexComponentAlignTypeStart FlexComponentAlignType = "start" - FlexComponentAlignTypeEnd FlexComponentAlignType = "end" - FlexComponentAlignTypeCenter FlexComponentAlignType = "center" -) - -// FlexComponentCornerRadiusType type -type FlexComponentCornerRadiusType string - -// FlexComponentCornerRadius constants -const ( - FlexComponentCornerRadiusTypeNone FlexComponentCornerRadiusType = "none" - FlexComponentCornerRadiusTypeXs FlexComponentCornerRadiusType = "xs" - FlexComponentCornerRadiusTypeSm FlexComponentCornerRadiusType = "sm" - FlexComponentCornerRadiusTypeMd FlexComponentCornerRadiusType = "md" - FlexComponentCornerRadiusTypeLg FlexComponentCornerRadiusType = "lg" - FlexComponentCornerRadiusTypeXl FlexComponentCornerRadiusType = "xl" - FlexComponentCornerRadiusTypeXxl FlexComponentCornerRadiusType = "xxl" -) - -// FlexIconSizeType type -type FlexIconSizeType string - -// FlexIconSizeType constants -const ( - FlexIconSizeTypeXxs FlexIconSizeType = "xxs" - FlexIconSizeTypeXs FlexIconSizeType = "xs" - FlexIconSizeTypeSm FlexIconSizeType = "sm" - FlexIconSizeTypeMd FlexIconSizeType = "md" - FlexIconSizeTypeLg FlexIconSizeType = "lg" - FlexIconSizeTypeXl FlexIconSizeType = "xl" - FlexIconSizeTypeXxl FlexIconSizeType = "xxl" - FlexIconSizeType3xl FlexIconSizeType = "3xl" - FlexIconSizeType4xl FlexIconSizeType = "4xl" - FlexIconSizeType5xl FlexIconSizeType = "5xl" -) - -// FlexSpacerSizeType type -type FlexSpacerSizeType string - -// FlexSpacerSizeType constants -const ( - FlexSpacerSizeTypeXs FlexSpacerSizeType = "xs" - FlexSpacerSizeTypeSm FlexSpacerSizeType = "sm" - FlexSpacerSizeTypeMd FlexSpacerSizeType = "md" - FlexSpacerSizeTypeLg FlexSpacerSizeType = "lg" - FlexSpacerSizeTypeXl FlexSpacerSizeType = "xl" - FlexSpacerSizeTypeXxl FlexSpacerSizeType = "xxl" -) - -// FlexTextWeightType type -type FlexTextWeightType string - -// FlexTextWeightType constants -const ( - FlexTextWeightTypeRegular FlexTextWeightType = "regular" - FlexTextWeightTypeBold FlexTextWeightType = "bold" -) - -// FlexTextSizeType type -type FlexTextSizeType string - -// FlexTextSizeType constants -const ( - FlexTextSizeTypeXxs FlexTextSizeType = "xxs" - FlexTextSizeTypeXs FlexTextSizeType = "xs" - FlexTextSizeTypeSm FlexTextSizeType = "sm" - FlexTextSizeTypeMd FlexTextSizeType = "md" - FlexTextSizeTypeLg FlexTextSizeType = "lg" - FlexTextSizeTypeXl FlexTextSizeType = "xl" - FlexTextSizeTypeXxl FlexTextSizeType = "xxl" - FlexTextSizeType3xl FlexTextSizeType = "3xl" - FlexTextSizeType4xl FlexTextSizeType = "4xl" - FlexTextSizeType5xl FlexTextSizeType = "5xl" -) - -// FlexTextStyleType type -type FlexTextStyleType string - -// FlexTextStyleType constants -const ( - FlexTextStyleTypeNormal FlexTextStyleType = "normal" - FlexTextStyleTypeItalic FlexTextStyleType = "italic" -) - -// FlexTextDecorationType type -type FlexTextDecorationType string - -// FlexTextDecorationType constants -const ( - FlexTextDecorationTypeNone FlexTextDecorationType = "none" - FlexTextDecorationTypeUnderline FlexTextDecorationType = "underline" - FlexTextDecorationTypeLineThrough FlexTextDecorationType = "line-through" -) - -// FlexComponentJustifyContentType type -type FlexComponentJustifyContentType string - -// FlexComponentJustifyContentType constants -const ( - FlexComponentJustifyContentTypeFlexStart FlexComponentJustifyContentType = "flex-start" - FlexComponentJustifyContentTypeFlexEnd FlexComponentJustifyContentType = "flex-end" - FlexComponentJustifyContentTypeCenter FlexComponentJustifyContentType = "center" - FlexComponentJustifyContentTypeSpaceBetween FlexComponentJustifyContentType = "space-between" - FlexComponentJustifyContentTypeSpaceAround FlexComponentJustifyContentType = "space-around" - FlexComponentJustifyContentTypeSpaceEvenly FlexComponentJustifyContentType = "space-evenly" -) - -// FlexComponentAlignItemsType type -type FlexComponentAlignItemsType string - -// FlexComponentAlignItemsType constants -const ( - FlexComponentAlignItemsTypeFlexStart FlexComponentAlignItemsType = "flex-start" - FlexComponentAlignItemsTypeFlexEnd FlexComponentAlignItemsType = "flex-end" - FlexComponentAlignItemsTypeCenter FlexComponentAlignItemsType = "center" -) - -// FlexComponentAdjustModeType type -type FlexComponentAdjustModeType string - -// FlexComponentAdjustModeType constants -const ( - FlexComponentAdjustModeTypeShrinkToFit FlexComponentAdjustModeType = "shrink-to-fit" -) - -// FlexBoxBackgroundType type -type FlexBoxBackgroundType string - -// FlexBoxBackgroundType constants -const ( - FlexBoxBackgroundTypeLinearGradient FlexBoxBackgroundType = "linearGradient" -) - -// FlexContainer interface -type FlexContainer interface { - FlexContainer() -} - -// BubbleContainer type -type BubbleContainer struct { - Type FlexContainerType - Size FlexBubbleSizeType - Direction FlexBubbleDirectionType - Header *BoxComponent - Hero FlexComponent - Body *BoxComponent - Footer *BoxComponent - Styles *BubbleStyle -} - -// MarshalJSON method of BubbleContainer -func (c *BubbleContainer) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type FlexContainerType `json:"type"` - Size FlexBubbleSizeType `json:"size,omitempty"` - Direction FlexBubbleDirectionType `json:"direction,omitempty"` - Header *BoxComponent `json:"header,omitempty"` - Hero FlexComponent `json:"hero,omitempty"` - Body *BoxComponent `json:"body,omitempty"` - Footer *BoxComponent `json:"footer,omitempty"` - Styles *BubbleStyle `json:"styles,omitempty"` - }{ - Type: FlexContainerTypeBubble, - Size: c.Size, - Direction: c.Direction, - Header: c.Header, - Hero: c.Hero, - Body: c.Body, - Footer: c.Footer, - Styles: c.Styles, - }) -} - -// UnmarshalJSON method of BubbleContainer -func (c *BubbleContainer) UnmarshalJSON(b []byte) error { - type alias BubbleContainer - a := struct { - Hero json.RawMessage `json:"hero,omitempty"` - *alias - }{ - alias: (*alias)(c), - } - if err := json.Unmarshal(b, &a); err != nil { - return err - } - - if a.Hero == nil { - return nil - } - - var raw rawFlexComponent - if err := json.Unmarshal(a.Hero, &raw); err != nil { - return err - } - c.Hero = raw.Component - - return nil -} - -// CarouselContainer type -type CarouselContainer struct { - Type FlexContainerType - Contents []*BubbleContainer -} - -// MarshalJSON method of CarouselContainer -func (c *CarouselContainer) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type FlexContainerType `json:"type"` - Contents []*BubbleContainer `json:"contents"` - }{ - Type: FlexContainerTypeCarousel, - Contents: c.Contents, - }) -} - -// FlexContainer implements FlexContainer interface -func (*BubbleContainer) FlexContainer() {} - -// FlexContainer implements FlexContainer interface -func (*CarouselContainer) FlexContainer() {} - -// BubbleStyle type -type BubbleStyle struct { - Header *BlockStyle `json:"header,omitempty"` - Hero *BlockStyle `json:"hero,omitempty"` - Body *BlockStyle `json:"body,omitempty"` - Footer *BlockStyle `json:"footer,omitempty"` -} - -// BlockStyle type -type BlockStyle struct { - BackgroundColor string `json:"backgroundColor,omitempty"` - Separator bool `json:"separator,omitempty"` - SeparatorColor string `json:"separatorColor,omitempty"` -} - -// FlexComponent interface -type FlexComponent interface { - FlexComponent() -} - -// BoxComponent type -type BoxComponent struct { - Type FlexComponentType - Layout FlexBoxLayoutType - Position FlexComponentPositionType - Contents []FlexComponent - Flex *int - Spacing FlexComponentSpacingType - Margin FlexComponentMarginType - Width string - MaxWidth string - Height string - MaxHeight string - CornerRadius FlexComponentCornerRadiusType - BackgroundColor string - BorderColor string - BorderWidth string - Action TemplateAction - JustifyContent FlexComponentJustifyContentType - AlignItems FlexComponentAlignItemsType - Background *BoxBackground - OffsetTop FlexComponentOffsetType - OffsetBottom FlexComponentOffsetType - OffsetStart FlexComponentOffsetType - OffsetEnd FlexComponentOffsetType - PaddingAll FlexComponentPaddingType - PaddingTop FlexComponentPaddingType - PaddingBottom FlexComponentPaddingType - PaddingStart FlexComponentPaddingType - PaddingEnd FlexComponentPaddingType -} - -// MarshalJSON method of BoxComponent -func (c *BoxComponent) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type FlexComponentType `json:"type"` - Layout FlexBoxLayoutType `json:"layout"` - Position FlexComponentPositionType `json:"position,omitempty"` - Contents []FlexComponent `json:"contents"` - Flex *int `json:"flex,omitempty"` - Spacing FlexComponentSpacingType `json:"spacing,omitempty"` - Margin FlexComponentMarginType `json:"margin,omitempty"` - Width string `json:"width,omitempty"` - MaxWidth string `json:"maxWidth,omitempty"` - Height string `json:"height,omitempty"` - MaxHeight string `json:"maxHeight,omitempty"` - CornerRadius FlexComponentCornerRadiusType `json:"cornerRadius,omitempty"` - BackgroundColor string `json:"backgroundColor,omitempty"` - BorderColor string `json:"borderColor,omitempty"` - BorderWidth string `json:"borderWidth,omitempty"` - Action TemplateAction `json:"action,omitempty"` - JustifyContent FlexComponentJustifyContentType `json:"justifyContent,omitempty"` - AlignItems FlexComponentAlignItemsType `json:"alignItems,omitempty"` - Background *BoxBackground `json:"background,omitempty"` - OffsetTop FlexComponentOffsetType `json:"offsetTop,omitempty"` - OffsetBottom FlexComponentOffsetType `json:"offsetBottom,omitempty"` - OffsetStart FlexComponentOffsetType `json:"offsetStart,omitempty"` - OffsetEnd FlexComponentOffsetType `json:"offsetEnd,omitempty"` - PaddingAll FlexComponentPaddingType `json:"paddingAll,omitempty"` - PaddingTop FlexComponentPaddingType `json:"paddingTop,omitempty"` - PaddingBottom FlexComponentPaddingType `json:"paddingBottom,omitempty"` - PaddingStart FlexComponentPaddingType `json:"paddingStart,omitempty"` - PaddingEnd FlexComponentPaddingType `json:"paddingEnd,omitempty"` - }{ - Type: FlexComponentTypeBox, - Layout: c.Layout, - Position: c.Position, - Contents: c.Contents, - Flex: c.Flex, - Spacing: c.Spacing, - Margin: c.Margin, - Width: c.Width, - MaxWidth: c.MaxWidth, - Height: c.Height, - MaxHeight: c.MaxHeight, - CornerRadius: c.CornerRadius, - BackgroundColor: c.BackgroundColor, - BorderColor: c.BorderColor, - BorderWidth: c.BorderWidth, - Action: c.Action, - JustifyContent: c.JustifyContent, - AlignItems: c.AlignItems, - Background: c.Background, - OffsetTop: c.OffsetTop, - OffsetBottom: c.OffsetBottom, - OffsetStart: c.OffsetStart, - OffsetEnd: c.OffsetEnd, - PaddingAll: c.PaddingAll, - PaddingTop: c.PaddingTop, - PaddingBottom: c.PaddingBottom, - PaddingStart: c.PaddingStart, - PaddingEnd: c.PaddingEnd, - }) -} - -// BoxBackground type -type BoxBackground struct { - Type FlexBoxBackgroundType `json:"type,omitempty"` - Angle string `json:"angle,omitempty"` - StartColor string `json:"startColor,omitempty"` - EndColor string `json:"endColor,omitempty"` - CenterColor string `json:"centerColor,omitempty"` - CenterPosition string `json:"centerPosition,omitempty"` -} - -// ButtonComponent type -type ButtonComponent struct { - Type FlexComponentType - Action TemplateAction - Position FlexComponentPositionType - Flex *int - Margin FlexComponentMarginType - Height FlexButtonHeightType - Style FlexButtonStyleType - Color string - Gravity FlexComponentGravityType - AdjustMode FlexComponentAdjustModeType - OffsetTop FlexComponentOffsetType - OffsetBottom FlexComponentOffsetType - OffsetStart FlexComponentOffsetType - OffsetEnd FlexComponentOffsetType -} - -// MarshalJSON method of ButtonComponent -func (c *ButtonComponent) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type FlexComponentType `json:"type"` - Action TemplateAction `json:"action"` - Position FlexComponentPositionType `json:"position,omitempty"` - Flex *int `json:"flex,omitempty"` - Margin FlexComponentMarginType `json:"margin,omitempty"` - Height FlexButtonHeightType `json:"height,omitempty"` - Style FlexButtonStyleType `json:"style,omitempty"` - Color string `json:"color,omitempty"` - Gravity FlexComponentGravityType `json:"gravity,omitempty"` - AdjustMode FlexComponentAdjustModeType `json:"adjustMode,omitempty"` - OffsetTop FlexComponentOffsetType `json:"offsetTop,omitempty"` - OffsetBottom FlexComponentOffsetType `json:"offsetBottom,omitempty"` - OffsetStart FlexComponentOffsetType `json:"offsetStart,omitempty"` - OffsetEnd FlexComponentOffsetType `json:"offsetEnd,omitempty"` - }{ - Type: FlexComponentTypeButton, - Action: c.Action, - Position: c.Position, - Flex: c.Flex, - Margin: c.Margin, - Height: c.Height, - Style: c.Style, - Color: c.Color, - Gravity: c.Gravity, - AdjustMode: c.AdjustMode, - OffsetTop: c.OffsetTop, - OffsetBottom: c.OffsetBottom, - OffsetStart: c.OffsetStart, - OffsetEnd: c.OffsetEnd, - }) -} - -// FillerComponent type -type FillerComponent struct { - Type FlexComponentType - Flex *int -} - -// MarshalJSON method of FillerComponent -func (c *FillerComponent) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type FlexComponentType `json:"type"` - Flex *int `json:"flex,omitempty"` - }{ - Type: FlexComponentTypeFiller, - Flex: c.Flex, - }) -} - -// IconComponent type -type IconComponent struct { - Type FlexComponentType - URL string - Margin FlexComponentMarginType - Size FlexIconSizeType - AspectRatio FlexIconAspectRatioType -} - -// MarshalJSON method of IconComponent -func (c *IconComponent) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type FlexComponentType `json:"type"` - URL string `json:"url"` - Margin FlexComponentMarginType `json:"margin,omitempty"` - Size FlexIconSizeType `json:"size,omitempty"` - AspectRatio FlexIconAspectRatioType `json:"aspectRatio,omitempty"` - }{ - Type: FlexComponentTypeIcon, - URL: c.URL, - Margin: c.Margin, - Size: c.Size, - AspectRatio: c.AspectRatio, - }) -} - -// ImageComponent type -type ImageComponent struct { - Type FlexComponentType - URL string - Position FlexComponentPositionType - Flex *int - Margin FlexComponentMarginType - Align FlexComponentAlignType - Gravity FlexComponentGravityType - Size FlexImageSizeType - AspectRatio FlexImageAspectRatioType - AspectMode FlexImageAspectModeType - BackgroundColor string - Action TemplateAction - Animated bool - OffsetTop FlexComponentOffsetType - OffsetBottom FlexComponentOffsetType - OffsetStart FlexComponentOffsetType - OffsetEnd FlexComponentOffsetType -} - -// MarshalJSON method of ImageComponent -func (c *ImageComponent) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type FlexComponentType `json:"type"` - URL string `json:"url"` - Position FlexComponentPositionType `json:"position,omitempty"` - Flex *int `json:"flex,omitempty"` - Margin FlexComponentMarginType `json:"margin,omitempty"` - Align FlexComponentAlignType `json:"align,omitempty"` - Gravity FlexComponentGravityType `json:"gravity,omitempty"` - Size FlexImageSizeType `json:"size,omitempty"` - AspectRatio FlexImageAspectRatioType `json:"aspectRatio,omitempty"` - AspectMode FlexImageAspectModeType `json:"aspectMode,omitempty"` - BackgroundColor string `json:"backgroundColor,omitempty"` - Action TemplateAction `json:"action,omitempty"` - Animated bool `json:"animated,omitempty"` - OffsetTop FlexComponentOffsetType `json:"offsetTop,omitempty"` - OffsetBottom FlexComponentOffsetType `json:"offsetBottom,omitempty"` - OffsetStart FlexComponentOffsetType `json:"offsetStart,omitempty"` - OffsetEnd FlexComponentOffsetType `json:"offsetEnd,omitempty"` - }{ - Type: FlexComponentTypeImage, - URL: c.URL, - Position: c.Position, - Flex: c.Flex, - Margin: c.Margin, - Align: c.Align, - Gravity: c.Gravity, - Size: c.Size, - AspectRatio: c.AspectRatio, - AspectMode: c.AspectMode, - BackgroundColor: c.BackgroundColor, - Action: c.Action, - Animated: c.Animated, - OffsetTop: c.OffsetTop, - OffsetBottom: c.OffsetBottom, - OffsetStart: c.OffsetStart, - OffsetEnd: c.OffsetEnd, - }) -} - -// SeparatorComponent type -type SeparatorComponent struct { - Type FlexComponentType - Margin FlexComponentMarginType - Color string -} - -// MarshalJSON method of SeparatorComponent -func (c *SeparatorComponent) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type FlexComponentType `json:"type"` - Margin FlexComponentMarginType `json:"margin,omitempty"` - Color string `json:"color,omitempty"` - }{ - Type: FlexComponentTypeSeparator, - Margin: c.Margin, - Color: c.Color, - }) -} - -// SpacerComponent type -type SpacerComponent struct { - Type FlexComponentType - Size FlexSpacerSizeType -} - -// MarshalJSON method of SpacerComponent -func (c *SpacerComponent) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type FlexComponentType `json:"type"` - Size FlexSpacerSizeType `json:"size,omitempty"` - }{ - Type: FlexComponentTypeSpacer, - Size: c.Size, - }) -} - -// SpanComponent type -type SpanComponent struct { - Type FlexComponentType - Text string - Size FlexTextSizeType - Weight FlexTextWeightType - Color string - Style FlexTextStyleType - Decoration FlexTextDecorationType -} - -// MarshalJSON method of SpanComponent -func (c *SpanComponent) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type FlexComponentType `json:"type"` - Text string `json:"text,omitempty"` - Size FlexTextSizeType `json:"size,omitempty"` - Weight FlexTextWeightType `json:"weight,omitempty"` - Color string `json:"color,omitempty"` - Style FlexTextStyleType `json:"style,omitempty"` - Decoration FlexTextDecorationType `json:"decoration,omitempty"` - }{ - Type: FlexComponentTypeSpan, - Text: c.Text, - Size: c.Size, - Weight: c.Weight, - Color: c.Color, - Style: c.Style, - Decoration: c.Decoration, - }) -} - -// TextComponent type -type TextComponent struct { - Type FlexComponentType - Text string - Position FlexComponentPositionType - Contents []*SpanComponent - Flex *int - Margin FlexComponentMarginType - Size FlexTextSizeType - Align FlexComponentAlignType - Gravity FlexComponentGravityType - Wrap bool - LineSpacing string - Weight FlexTextWeightType - Color string - Action TemplateAction - Style FlexTextStyleType - Decoration FlexTextDecorationType - MaxLines *int - AdjustMode FlexComponentAdjustModeType - OffsetTop FlexComponentOffsetType - OffsetBottom FlexComponentOffsetType - OffsetStart FlexComponentOffsetType - OffsetEnd FlexComponentOffsetType -} - -// MarshalJSON method of TextComponent -func (c *TextComponent) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type FlexComponentType `json:"type"` - Text string `json:"text,omitempty"` - Position FlexComponentPositionType `json:"position,omitempty"` - Contents []*SpanComponent `json:"contents,omitempty"` - Flex *int `json:"flex,omitempty"` - Margin FlexComponentMarginType `json:"margin,omitempty"` - Size FlexTextSizeType `json:"size,omitempty"` - Align FlexComponentAlignType `json:"align,omitempty"` - Gravity FlexComponentGravityType `json:"gravity,omitempty"` - Wrap bool `json:"wrap,omitempty"` - LineSpacing string `json:"lineSpacing,omitempty"` - Weight FlexTextWeightType `json:"weight,omitempty"` - Color string `json:"color,omitempty"` - Action TemplateAction `json:"action,omitempty"` - Style FlexTextStyleType `json:"style,omitempty"` - Decoration FlexTextDecorationType `json:"decoration,omitempty"` - MaxLines *int `json:"maxLines,omitempty"` - AdjustMode FlexComponentAdjustModeType `json:"adjustMode,omitempty"` - OffsetTop FlexComponentOffsetType `json:"offsetTop,omitempty"` - OffsetBottom FlexComponentOffsetType `json:"offsetBottom,omitempty"` - OffsetStart FlexComponentOffsetType `json:"offsetStart,omitempty"` - OffsetEnd FlexComponentOffsetType `json:"offsetEnd,omitempty"` - }{ - Type: FlexComponentTypeText, - Text: c.Text, - Position: c.Position, - Contents: c.Contents, - Flex: c.Flex, - Margin: c.Margin, - Size: c.Size, - Align: c.Align, - Gravity: c.Gravity, - Wrap: c.Wrap, - LineSpacing: c.LineSpacing, - Weight: c.Weight, - Color: c.Color, - Action: c.Action, - Style: c.Style, - Decoration: c.Decoration, - MaxLines: c.MaxLines, - AdjustMode: c.AdjustMode, - OffsetTop: c.OffsetTop, - OffsetBottom: c.OffsetBottom, - OffsetStart: c.OffsetStart, - OffsetEnd: c.OffsetEnd, - }) -} - -// VideoComponent type -type VideoComponent struct { - Type FlexComponentType - URL string - PreviewURL string - AltContent FlexComponent - AspectRatio FlexVideoAspectRatioType - Action *URIAction -} - -// MarshalJSON method of VideoComponent -func (c *VideoComponent) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type FlexComponentType `json:"type"` - URL string `json:"url"` - PreviewURL string `json:"previewUrl"` - AltContent FlexComponent `json:"altContent"` - AspectRatio FlexVideoAspectRatioType `json:"aspectRatio,omitempty"` - Action *URIAction `json:"action,omitempty"` - }{ - Type: FlexComponentTypeVideo, - URL: c.URL, - PreviewURL: c.PreviewURL, - AltContent: c.AltContent, - AspectRatio: c.AspectRatio, - Action: c.Action, - }) -} - -// FlexComponent implements FlexComponent interface -func (*BoxComponent) FlexComponent() {} - -// FlexComponent implements FlexComponent interface -func (*ButtonComponent) FlexComponent() {} - -// FlexComponent implements FlexComponent interface -func (*FillerComponent) FlexComponent() {} - -// FlexComponent implements FlexComponent interface -func (*IconComponent) FlexComponent() {} - -// FlexComponent implements FlexComponent interface -func (*ImageComponent) FlexComponent() {} - -// FlexComponent implements FlexComponent interface -func (*SeparatorComponent) FlexComponent() {} - -// FlexComponent implements FlexComponent interface -func (*SpacerComponent) FlexComponent() {} - -// FlexComponent implements FlexComponent interface -func (*SpanComponent) FlexComponent() {} - -// FlexComponent implements FlexComponent interface -func (*TextComponent) FlexComponent() {} - -// FlexComponent implements FlexComponent interface -func (*VideoComponent) FlexComponent() {} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/flex_unmarshal.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/flex_unmarshal.go deleted file mode 100644 index 06f52d110..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/flex_unmarshal.go +++ /dev/null @@ -1,217 +0,0 @@ -// Copyright 2018 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "encoding/json" - "errors" -) - -// UnmarshalFlexMessageJSON function -func UnmarshalFlexMessageJSON(data []byte) (FlexContainer, error) { - raw := rawFlexContainer{} - if err := json.Unmarshal(data, &raw); err != nil { - return nil, err - } - return raw.Container, nil -} - -type rawFlexContainer struct { - Type FlexContainerType `json:"type"` - Container FlexContainer `json:"-"` -} - -func (c *rawFlexContainer) UnmarshalJSON(data []byte) error { - type alias rawFlexContainer - raw := alias{} - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - var container FlexContainer - switch raw.Type { - case FlexContainerTypeBubble: - container = &BubbleContainer{} - case FlexContainerTypeCarousel: - container = &CarouselContainer{} - default: - return errors.New("invalid container type") - } - if err := json.Unmarshal(data, container); err != nil { - return err - } - c.Type = raw.Type - c.Container = container - return nil -} - -type rawFlexComponent struct { - Type FlexComponentType `json:"type"` - Component FlexComponent `json:"-"` -} - -func (c *rawFlexComponent) UnmarshalJSON(data []byte) error { - type alias rawFlexComponent - raw := alias{} - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - var component FlexComponent - switch raw.Type { - case FlexComponentTypeBox: - component = &BoxComponent{} - case FlexComponentTypeButton: - component = &ButtonComponent{} - case FlexComponentTypeFiller: - component = &FillerComponent{} - case FlexComponentTypeIcon: - component = &IconComponent{} - case FlexComponentTypeImage: - component = &ImageComponent{} - case FlexComponentTypeSeparator: - component = &SeparatorComponent{} - case FlexComponentTypeSpacer: - component = &SpacerComponent{} - case FlexComponentTypeText: - component = &TextComponent{} - case FlexComponentTypeVideo: - component = &VideoComponent{} - default: - return errors.New("invalid flex component type") - } - if err := json.Unmarshal(data, component); err != nil { - return err - } - c.Type = raw.Type - c.Component = component - return nil -} - -type rawAction struct { - Type ActionType `json:"type"` - Action TemplateAction `json:"-"` -} - -func (c *rawAction) UnmarshalJSON(data []byte) error { - type alias rawAction - raw := alias{} - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - var action TemplateAction - switch raw.Type { - case ActionTypeURI: - action = &URIAction{} - case ActionTypeMessage: - action = &MessageAction{} - case ActionTypePostback: - action = &PostbackAction{} - case ActionTypeDatetimePicker: - action = &DatetimePickerAction{} - default: - return errors.New("invalid action type") - } - if err := json.Unmarshal(data, action); err != nil { - return err - } - c.Type = raw.Type - c.Action = action - return nil -} - -// UnmarshalJSON method for BoxComponent -func (c *BoxComponent) UnmarshalJSON(data []byte) error { - type alias BoxComponent - raw := struct { - Contents []rawFlexComponent `json:"contents"` - Action rawAction `json:"action"` - *alias - }{ - alias: (*alias)(c), - } - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - components := make([]FlexComponent, len(raw.Contents)) - for i, content := range raw.Contents { - components[i] = content.Component - } - c.Contents = components - c.Action = raw.Action.Action - return nil -} - -// UnmarshalJSON method for ButtonComponent -func (c *ButtonComponent) UnmarshalJSON(data []byte) error { - type alias ButtonComponent - raw := struct { - Action rawAction `json:"action"` - *alias - }{ - alias: (*alias)(c), - } - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - c.Action = raw.Action.Action - return nil -} - -// UnmarshalJSON method for ImageComponent -func (c *ImageComponent) UnmarshalJSON(data []byte) error { - type alias ImageComponent - raw := struct { - Action rawAction `json:"action"` - *alias - }{ - alias: (*alias)(c), - } - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - c.Action = raw.Action.Action - return nil -} - -// UnmarshalJSON method for TextComponent -func (c *TextComponent) UnmarshalJSON(data []byte) error { - type alias TextComponent - raw := struct { - Action rawAction `json:"action"` - *alias - }{ - alias: (*alias)(c), - } - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - c.Action = raw.Action.Action - return nil -} - -// UnmarshalJSON method for VideoComponent -func (c *VideoComponent) UnmarshalJSON(data []byte) error { - type alias VideoComponent - raw := struct { - AltContent rawFlexComponent `json:"altContent"` - *alias - }{ - alias: (*alias)(c), - } - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - c.AltContent = raw.AltContent.Component - return nil -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_bot_info.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_bot_info.go deleted file mode 100644 index ab4cb327a..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_bot_info.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2016 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "context" -) - -// ChatMode type -type ChatMode string - -// ChatMode constants -const ( - ChatModeChat ChatMode = "chat" - ChatModeBot ChatMode = "bot" -) - -// MarkAsReadMode type -type MarkAsReadMode string - -// MarkAsReadMode constants -const ( - MarkAsReadModeManual MarkAsReadMode = "manual" - MarkAsReadModeAuto MarkAsReadMode = "auto" -) - -// GetBotInfo method -func (client *Client) GetBotInfo() *GetBotInfoCall { - return &GetBotInfoCall{ - c: client, - endpoint: APIEndpointGetBotInfo, - } -} - -// WithContext method -func (call *GetBotInfoCall) WithContext(ctx context.Context) *GetBotInfoCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetBotInfoCall) Do() (*BotInfoResponse, error) { - res, err := call.c.get(call.ctx, call.c.endpointBase, call.endpoint, nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBotInfoResponse(res) -} - -// GetBotInfoCall type -type GetBotInfoCall struct { - c *Client - ctx context.Context - endpoint string -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_content.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_content.go deleted file mode 100644 index 8d641493e..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_content.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2016 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "context" - "fmt" -) - -// GetMessageContent method -func (client *Client) GetMessageContent(messageID string) *GetMessageContentCall { - return &GetMessageContentCall{ - c: client, - messageID: messageID, - } -} - -// GetMessageContentCall type -type GetMessageContentCall struct { - c *Client - ctx context.Context - - messageID string -} - -// WithContext method -func (call *GetMessageContentCall) WithContext(ctx context.Context) *GetMessageContentCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetMessageContentCall) Do() (*MessageContentResponse, error) { - endpoint := fmt.Sprintf(APIEndpointGetMessageContent, call.messageID) - res, err := call.c.get(call.ctx, call.c.endpointBaseData, endpoint, nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToMessageContentResponse(res) -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_count.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_count.go deleted file mode 100644 index 49b462f88..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_count.go +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2020 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "context" - "fmt" -) - -// GetGroupMemberCount method -func (client *Client) GetGroupMemberCount(groupID string) *GetGroupMemberCountCall { - return &GetGroupMemberCountCall{ - c: client, - groupID: groupID, - } -} - -// GetGroupMemberCountCall type -type GetGroupMemberCountCall struct { - c *Client - ctx context.Context - - groupID string -} - -// WithContext method -func (call *GetGroupMemberCountCall) WithContext(ctx context.Context) *GetGroupMemberCountCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetGroupMemberCountCall) Do() (*MemberCountResponse, error) { - endpoint := fmt.Sprintf(APIEndpointGetGroupMemberCount, call.groupID) - res, err := call.c.get(call.ctx, call.c.endpointBase, endpoint, nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToMemberCountResponse(res) -} - -// GetRoomMemberCount method -func (client *Client) GetRoomMemberCount(roomID string) *GetRoomMemberCountCall { - return &GetRoomMemberCountCall{ - c: client, - roomID: roomID, - } -} - -// GetRoomMemberCountCall type -type GetRoomMemberCountCall struct { - c *Client - ctx context.Context - - roomID string -} - -// WithContext method -func (call *GetRoomMemberCountCall) WithContext(ctx context.Context) *GetRoomMemberCountCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetRoomMemberCountCall) Do() (*MemberCountResponse, error) { - endpoint := fmt.Sprintf(APIEndpointGetRoomMemberCount, call.roomID) - res, err := call.c.get(call.ctx, call.c.endpointBase, endpoint, nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToMemberCountResponse(res) -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_follower_ids.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_follower_ids.go deleted file mode 100644 index 4b61fc307..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_follower_ids.go +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright 2016 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "context" - "net/url" -) - -// GetFollowerIDs method -func (client *Client) GetFollowerIDs(continuationToken string) *GetFollowerIDsCall { - return &GetFollowerIDsCall{ - c: client, - continuationToken: continuationToken, - } -} - -// GetFollowerIDsCall type -type GetFollowerIDsCall struct { - c *Client - ctx context.Context - - continuationToken string -} - -// WithContext method -func (call *GetFollowerIDsCall) WithContext(ctx context.Context) *GetFollowerIDsCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetFollowerIDsCall) Do() (*UserIDsResponse, error) { - var q url.Values - if call.continuationToken != "" { - q = url.Values{"start": []string{call.continuationToken}} - } - res, err := call.c.get(call.ctx, call.c.endpointBase, APIEndpointGetFollowerIDs, q) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToUserIDsResponse(res) -} - -// NewScanner returns Group IDs scanner. -func (call *GetFollowerIDsCall) NewScanner() *UserIDsScanner { - var ctx context.Context - if call.ctx != nil { - ctx = call.ctx - } else { - ctx = context.Background() - } - - c2 := &GetFollowerIDsCall{} - *c2 = *call - c2.ctx = ctx - - return &UserIDsScanner{ - caller: c2, - ctx: ctx, - } -} - -func (call *GetFollowerIDsCall) setContinuationToken(token string) { - call.continuationToken = token -} - -type userIDsCaller interface { - Do() (*UserIDsResponse, error) - setContinuationToken(string) -} - -// UserIDsScanner type -type UserIDsScanner struct { - caller userIDsCaller - ctx context.Context - start int - ids []string - next string - called bool - done bool - err error -} - -// Scan method -func (s *UserIDsScanner) Scan() bool { - if s.done { - return false - } - - select { - case <-s.ctx.Done(): - s.err = s.ctx.Err() - s.done = true - return false - default: - } - - s.start++ - if len(s.ids) > 0 && len(s.ids) > s.start { - return true - } - - if s.next == "" && s.called { - s.done = true - return false - } - - s.start = 0 - res, err := s.caller.Do() - if err != nil { - s.err = err - s.done = true - return false - } - - s.called = true - s.ids = res.UserIDs - s.next = res.Next - s.caller.setContinuationToken(s.next) - - return true -} - -// ID returns member id. -func (s *UserIDsScanner) ID() string { - if len(s.ids) == 0 { - return "" - } - return s.ids[s.start : s.start+1][0] -} - -// Err returns scan error. -func (s *UserIDsScanner) Err() error { - return s.err -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_ids.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_ids.go deleted file mode 100644 index 814b2b771..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_ids.go +++ /dev/null @@ -1,215 +0,0 @@ -// Copyright 2016 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "context" - "fmt" - "net/url" -) - -// GetGroupMemberIDs method -func (client *Client) GetGroupMemberIDs(groupID, continuationToken string) *GetGroupMemberIDsCall { - return &GetGroupMemberIDsCall{ - c: client, - groupID: groupID, - continuationToken: continuationToken, - } -} - -// GetGroupMemberIDsCall type -type GetGroupMemberIDsCall struct { - c *Client - ctx context.Context - - groupID string - continuationToken string -} - -// WithContext method -func (call *GetGroupMemberIDsCall) WithContext(ctx context.Context) *GetGroupMemberIDsCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetGroupMemberIDsCall) Do() (*MemberIDsResponse, error) { - endpoint := fmt.Sprintf(APIEndpointGetGroupMemberIDs, call.groupID) - var q url.Values - if call.continuationToken != "" { - q = url.Values{"start": []string{call.continuationToken}} - } - res, err := call.c.get(call.ctx, call.c.endpointBase, endpoint, q) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToMemberIDsResponse(res) -} - -// GetRoomMemberIDs method -func (client *Client) GetRoomMemberIDs(roomID, continuationToken string) *GetRoomMemberIDsCall { - return &GetRoomMemberIDsCall{ - c: client, - roomID: roomID, - continuationToken: continuationToken, - } -} - -// GetRoomMemberIDsCall type -type GetRoomMemberIDsCall struct { - c *Client - ctx context.Context - - roomID string - continuationToken string -} - -// WithContext method -func (call *GetRoomMemberIDsCall) WithContext(ctx context.Context) *GetRoomMemberIDsCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetRoomMemberIDsCall) Do() (*MemberIDsResponse, error) { - endpoint := fmt.Sprintf(APIEndpointGetRoomMemberIDs, call.roomID) - var q url.Values - if call.continuationToken != "" { - q = url.Values{"start": []string{call.continuationToken}} - } - res, err := call.c.get(call.ctx, call.c.endpointBase, endpoint, q) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToMemberIDsResponse(res) -} - -// NewScanner returns Group IDs scanner. -func (call *GetGroupMemberIDsCall) NewScanner() *IDsScanner { - var ctx context.Context - if call.ctx != nil { - ctx = call.ctx - } else { - ctx = context.Background() - } - - c2 := &GetGroupMemberIDsCall{} - *c2 = *call - c2.ctx = ctx - - return &IDsScanner{ - caller: c2, - ctx: ctx, - } -} - -func (call *GetGroupMemberIDsCall) setContinuationToken(token string) { - call.continuationToken = token -} - -// NewScanner returns Room IDs scanner. -func (call *GetRoomMemberIDsCall) NewScanner() *IDsScanner { - var ctx context.Context - if call.ctx != nil { - ctx = call.ctx - } else { - ctx = context.Background() - } - - c2 := &GetRoomMemberIDsCall{} - *c2 = *call - c2.ctx = ctx - - return &IDsScanner{ - caller: c2, - ctx: ctx, - } -} - -func (call *GetRoomMemberIDsCall) setContinuationToken(token string) { - call.continuationToken = token -} - -type memberIDsCaller interface { - Do() (*MemberIDsResponse, error) - setContinuationToken(string) -} - -// IDsScanner type -type IDsScanner struct { - caller memberIDsCaller - ctx context.Context - start int - ids []string - next string - called bool - done bool - err error -} - -// Scan method -func (s *IDsScanner) Scan() bool { - if s.done { - return false - } - - select { - case <-s.ctx.Done(): - s.err = s.ctx.Err() - s.done = true - return false - default: - } - - s.start++ - if len(s.ids) > 0 && len(s.ids) > s.start { - return true - } - - if s.next == "" && s.called { - s.done = true - return false - } - - s.start = 0 - res, err := s.caller.Do() - if err != nil { - s.err = err - s.done = true - return false - } - - s.called = true - s.ids = res.MemberIDs - s.next = res.Next - s.caller.setContinuationToken(s.next) - - return true -} - -// ID returns member id. -func (s *IDsScanner) ID() string { - if len(s.ids) == 0 { - return "" - } - return s.ids[s.start : s.start+1][0] -} - -// Err returns scan error. -func (s *IDsScanner) Err() error { - return s.err -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_profile.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_profile.go deleted file mode 100644 index 2d72f58ee..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_profile.go +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright 2016 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "context" - "fmt" -) - -// GetProfile method -func (client *Client) GetProfile(userID string) *GetProfileCall { - return &GetProfileCall{ - c: client, - userID: userID, - } -} - -// GetProfileCall type -type GetProfileCall struct { - c *Client - ctx context.Context - - userID string -} - -// WithContext method -func (call *GetProfileCall) WithContext(ctx context.Context) *GetProfileCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetProfileCall) Do() (*UserProfileResponse, error) { - endpoint := fmt.Sprintf(APIEndpointGetProfile, call.userID) - res, err := call.c.get(call.ctx, call.c.endpointBase, endpoint, nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToUserProfileResponse(res) -} - -// GetGroupMemberProfile method -func (client *Client) GetGroupMemberProfile(groupID, userID string) *GetGroupMemberProfileCall { - return &GetGroupMemberProfileCall{ - c: client, - groupID: groupID, - userID: userID, - } -} - -// GetGroupMemberProfileCall type -type GetGroupMemberProfileCall struct { - c *Client - ctx context.Context - - groupID string - userID string -} - -// WithContext method -func (call *GetGroupMemberProfileCall) WithContext(ctx context.Context) *GetGroupMemberProfileCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetGroupMemberProfileCall) Do() (*UserProfileResponse, error) { - endpoint := fmt.Sprintf(APIEndpointGetGroupMemberProfile, call.groupID, call.userID) - res, err := call.c.get(call.ctx, call.c.endpointBase, endpoint, nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToUserProfileResponse(res) -} - -// GetRoomMemberProfile method -func (client *Client) GetRoomMemberProfile(roomID, userID string) *GetRoomMemberProfileCall { - return &GetRoomMemberProfileCall{ - c: client, - roomID: roomID, - userID: userID, - } -} - -// GetRoomMemberProfileCall type -type GetRoomMemberProfileCall struct { - c *Client - ctx context.Context - - roomID string - userID string -} - -// WithContext method -func (call *GetRoomMemberProfileCall) WithContext(ctx context.Context) *GetRoomMemberProfileCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetRoomMemberProfileCall) Do() (*UserProfileResponse, error) { - endpoint := fmt.Sprintf(APIEndpointGetRoomMemberProfile, call.roomID, call.userID) - res, err := call.c.get(call.ctx, call.c.endpointBase, endpoint, nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToUserProfileResponse(res) -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_quota.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_quota.go deleted file mode 100644 index 45c5888a3..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_quota.go +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2016 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "context" -) - -// GetMessageQuota method -func (client *Client) GetMessageQuota() *GetMessageQuotaCall { - return &GetMessageQuotaCall{ - c: client, - endpoint: APIEndpointGetMessageQuota, - } -} - -// GetMessageQuotaConsumption method -func (client *Client) GetMessageQuotaConsumption() *GetMessageQuotaCall { - return &GetMessageQuotaCall{ - c: client, - endpoint: APIEndpointGetMessageQuotaConsumption, - } -} - -// GetMessageQuotaCall type -type GetMessageQuotaCall struct { - c *Client - ctx context.Context - endpoint string -} - -// WithContext method -func (call *GetMessageQuotaCall) WithContext(ctx context.Context) *GetMessageQuotaCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetMessageQuotaCall) Do() (*MessageQuotaResponse, error) { - res, err := call.c.get(call.ctx, call.c.endpointBase, call.endpoint, nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToMessageQuotaResponse(res) -} - -// GetMessageConsumption method -func (client *Client) GetMessageConsumption() *GetMessageConsumptionCall { - return &GetMessageConsumptionCall{ - c: client, - } -} - -// GetMessageConsumptionCall type -type GetMessageConsumptionCall struct { - c *Client - ctx context.Context -} - -// WithContext method -func (call *GetMessageConsumptionCall) WithContext(ctx context.Context) *GetMessageConsumptionCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetMessageConsumptionCall) Do() (*MessageConsumptionResponse, error) { - res, err := call.c.get(call.ctx, call.c.endpointBase, APIEndpointGetMessageConsumption, nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToMessageConsumptionResponse(res) -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_summary.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_summary.go deleted file mode 100644 index 67c234c77..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/get_summary.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2020 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "context" - "fmt" -) - -// GetGroupSummary method -func (client *Client) GetGroupSummary(groupID string) *GetGroupSummaryCall { - return &GetGroupSummaryCall{ - c: client, - groupID: groupID, - } -} - -// GetGroupSummaryCall type -type GetGroupSummaryCall struct { - c *Client - ctx context.Context - - groupID string -} - -// WithContext method -func (call *GetGroupSummaryCall) WithContext(ctx context.Context) *GetGroupSummaryCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetGroupSummaryCall) Do() (*GroupSummaryResponse, error) { - endpoint := fmt.Sprintf(APIEndpointGetGroupSummary, call.groupID) - res, err := call.c.get(call.ctx, call.c.endpointBase, endpoint, nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToGroupSummaryResponse(res) -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/imagemap.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/imagemap.go deleted file mode 100644 index 99ebc37ac..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/imagemap.go +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright 2016 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "encoding/json" -) - -// ImagemapActionType type -type ImagemapActionType string - -// ImagemapActionType constants -const ( - ImagemapActionTypeURI ImagemapActionType = "uri" - ImagemapActionTypeMessage ImagemapActionType = "message" -) - -// ImagemapBaseSize type -type ImagemapBaseSize struct { - Width int `json:"width"` - Height int `json:"height"` -} - -// ImagemapArea type -type ImagemapArea struct { - X int `json:"x"` - Y int `json:"y"` - Width int `json:"width"` - Height int `json:"height"` -} - -// ImagemapVideo type -type ImagemapVideo struct { - OriginalContentURL string `json:"originalContentUrl"` - PreviewImageURL string `json:"previewImageUrl"` - Area ImagemapArea `json:"area"` - ExternalLink *ImagemapVideoExternalLink `json:"externalLink,omitempty"` -} - -// ImagemapVideoExternalLink type -type ImagemapVideoExternalLink struct { - LinkURI string `json:"linkUri"` - Label string `json:"label"` -} - -// ImagemapAction type -type ImagemapAction interface { - json.Marshaler - ImagemapAction() -} - -// URIImagemapAction type -type URIImagemapAction struct { - Label string - LinkURL string - Area ImagemapArea -} - -// MarshalJSON method of URIImagemapAction -func (a *URIImagemapAction) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type ImagemapActionType `json:"type"` - Label string `json:"label,omitempty"` - LinkURL string `json:"linkUri"` - Area ImagemapArea `json:"area"` - }{ - Type: ImagemapActionTypeURI, - Label: a.Label, - LinkURL: a.LinkURL, - Area: a.Area, - }) -} - -// MessageImagemapAction type -type MessageImagemapAction struct { - Label string - Text string - Area ImagemapArea -} - -// MarshalJSON method of MessageImagemapAction -func (a *MessageImagemapAction) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type ImagemapActionType `json:"type"` - Label string `json:"label,omitempty"` - Text string `json:"text"` - Area ImagemapArea `json:"area"` - }{ - Type: ImagemapActionTypeMessage, - Label: a.Label, - Text: a.Text, - Area: a.Area, - }) -} - -// ImagemapAction implements ImagemapAction interface -func (a *URIImagemapAction) ImagemapAction() {} - -// ImagemapAction implements ImagemapAction interface -func (a *MessageImagemapAction) ImagemapAction() {} - -// NewURIImagemapAction function -func NewURIImagemapAction(label, linkURL string, area ImagemapArea) *URIImagemapAction { - return &URIImagemapAction{ - Label: label, - LinkURL: linkURL, - Area: area, - } -} - -// NewMessageImagemapAction function -func NewMessageImagemapAction(label, text string, area ImagemapArea) *MessageImagemapAction { - return &MessageImagemapAction{ - Label: label, - Text: text, - Area: area, - } -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/imageset.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/imageset.go deleted file mode 100644 index aac10774c..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/imageset.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2021 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -// ImageSet type -type ImageSet struct { - ID string `json:"id"` - Index int `json:"index"` - Total int `json:"total"` -} - -// NewImageSet function -func NewImageSet(ID string, index, total int) *ImageSet { - return &ImageSet{ - ID: ID, - Index: index, - Total: total, - } -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/insight.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/insight.go deleted file mode 100644 index eb7bbb188..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/insight.go +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright 2019 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "context" - "fmt" - "net/url" -) - -// InsightType type -type InsightType string - -// InsightType constants -const ( - InsightTypeMessageDelivery InsightType = "message/delivery" - InsightTypeUserInteractionStats InsightType = "message/event" - InsightTypeFollowers InsightType = "followers" - InsightTypeDemographic InsightType = "demographic" -) - -// GetNumberMessagesDeliveryCall type -type GetNumberMessagesDeliveryCall struct { - c *Client - ctx context.Context - - date string - insightType InsightType -} - -// GetNumberMessagesDelivery method -func (client *Client) GetNumberMessagesDelivery(date string) *GetNumberMessagesDeliveryCall { - return &GetNumberMessagesDeliveryCall{ - c: client, - date: date, - insightType: InsightTypeMessageDelivery, - } -} - -// WithContext method -func (call *GetNumberMessagesDeliveryCall) WithContext(ctx context.Context) *GetNumberMessagesDeliveryCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetNumberMessagesDeliveryCall) Do() (*MessagesNumberDeliveryResponse, error) { - endpoint := fmt.Sprintf(APIEndpointInsight, call.insightType) - q := url.Values{} - if call.date != "" { - q.Add("date", call.date) - } - res, err := call.c.get(call.ctx, call.c.endpointBase, endpoint, q) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToMessagesNumberDeliveryResponse(res) -} - -// GetNumberFollowersCall type -type GetNumberFollowersCall struct { - c *Client - ctx context.Context - - date string - insightType InsightType -} - -// GetNumberFollowers method -func (client *Client) GetNumberFollowers(date string) *GetNumberFollowersCall { - return &GetNumberFollowersCall{ - c: client, - date: date, - insightType: InsightTypeFollowers, - } -} - -// WithContext method -func (call *GetNumberFollowersCall) WithContext(ctx context.Context) *GetNumberFollowersCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetNumberFollowersCall) Do() (*MessagesNumberFollowersResponse, error) { - endpoint := fmt.Sprintf(APIEndpointInsight, call.insightType) - q := url.Values{} - if call.date != "" { - q.Add("date", call.date) - } - res, err := call.c.get(call.ctx, call.c.endpointBase, endpoint, q) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToMessagesNumberFollowersResponse(res) -} - -// GetFriendDemographicsCall type -type GetFriendDemographicsCall struct { - c *Client - ctx context.Context - - insightType InsightType -} - -// GetFriendDemographics method -func (client *Client) GetFriendDemographics() *GetFriendDemographicsCall { - return &GetFriendDemographicsCall{ - c: client, - insightType: InsightTypeDemographic, - } -} - -// WithContext method -func (call *GetFriendDemographicsCall) WithContext(ctx context.Context) *GetFriendDemographicsCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetFriendDemographicsCall) Do() (*MessagesFriendDemographicsResponse, error) { - endpoint := fmt.Sprintf(APIEndpointInsight, call.insightType) - var q url.Values - - res, err := call.c.get(call.ctx, call.c.endpointBase, endpoint, q) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToMessagesFriendDemographicsResponse(res) -} - -// GetUserInteractionStatsCall type -type GetUserInteractionStatsCall struct { - c *Client - ctx context.Context - - requestID string - insightType InsightType -} - -// GetUserInteractionStats method -func (client *Client) GetUserInteractionStats(requestID string) *GetUserInteractionStatsCall { - return &GetUserInteractionStatsCall{ - c: client, - requestID: requestID, - insightType: InsightTypeUserInteractionStats, - } -} - -// WithContext method -func (call *GetUserInteractionStatsCall) WithContext(ctx context.Context) *GetUserInteractionStatsCall { - call.ctx = ctx - return call -} - -// Do method, returns MessagesUserInteractionStatsResponse -func (call *GetUserInteractionStatsCall) Do() (*MessagesUserInteractionStatsResponse, error) { - endpoint := fmt.Sprintf(APIEndpointInsight, call.insightType) - q := url.Values{} - if call.requestID != "" { - q.Add("requestId", call.requestID) - } - res, err := call.c.get(call.ctx, call.c.endpointBase, endpoint, q) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToMessagesUserInteractionStatsResponse(res) -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/leave.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/leave.go deleted file mode 100644 index c6ae49ada..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/leave.go +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2016 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "context" - "fmt" -) - -// LeaveGroup method -func (client *Client) LeaveGroup(groupID string) *LeaveGroupCall { - return &LeaveGroupCall{ - c: client, - groupID: groupID, - } -} - -// LeaveGroupCall type -type LeaveGroupCall struct { - c *Client - ctx context.Context - - groupID string -} - -// WithContext method -func (call *LeaveGroupCall) WithContext(ctx context.Context) *LeaveGroupCall { - call.ctx = ctx - return call -} - -// Do method -func (call *LeaveGroupCall) Do() (*BasicResponse, error) { - endpoint := fmt.Sprintf(APIEndpointLeaveGroup, call.groupID) - res, err := call.c.post(call.ctx, endpoint, nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// LeaveRoom method -func (client *Client) LeaveRoom(roomID string) *LeaveRoomCall { - return &LeaveRoomCall{ - c: client, - roomID: roomID, - } -} - -// LeaveRoomCall type -type LeaveRoomCall struct { - c *Client - ctx context.Context - - roomID string -} - -// WithContext method -func (call *LeaveRoomCall) WithContext(ctx context.Context) *LeaveRoomCall { - call.ctx = ctx - return call -} - -// Do method -func (call *LeaveRoomCall) Do() (*BasicResponse, error) { - endpoint := fmt.Sprintf(APIEndpointLeaveRoom, call.roomID) - res, err := call.c.post(call.ctx, endpoint, nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/liff.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/liff.go deleted file mode 100644 index b252bb66c..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/liff.go +++ /dev/null @@ -1,208 +0,0 @@ -// Copyright 2018 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "bytes" - "context" - "encoding/json" - "fmt" - "io" -) - -// LIFFViewType type -type LIFFViewType string - -// LIFFViewType constants -const ( - LIFFViewTypeCompact LIFFViewType = "compact" - LIFFViewTypeTall LIFFViewType = "tall" - LIFFViewTypeFull LIFFViewType = "full" -) - -// LIFFApp type -type LIFFApp struct { - LIFFID string `json:"liffId"` - View View `json:"view"` -} - -// ViewRequest type -type ViewRequest struct { - View View `json:"view"` -} - -// View type -type View struct { - Type LIFFViewType `json:"type"` - URL string `json:"url"` -} - -// GetLIFF method -func (client *Client) GetLIFF() *GetLIFFAllCall { - return &GetLIFFAllCall{ - c: client, - } -} - -// GetLIFFAllCall type -type GetLIFFAllCall struct { - c *Client - ctx context.Context -} - -// WithContext method -func (call *GetLIFFAllCall) WithContext(ctx context.Context) *GetLIFFAllCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetLIFFAllCall) Do() (*LIFFAppsResponse, error) { - res, err := call.c.get(call.ctx, call.c.endpointBase, APIEndpointGetAllLIFFApps, nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToLIFFResponse(res) -} - -// AddLIFF method -func (client *Client) AddLIFF(view View) *AddLIFFCall { - return &AddLIFFCall{ - c: client, - view: view, - } -} - -// AddLIFFCall type -type AddLIFFCall struct { - c *Client - ctx context.Context - - view View -} - -// WithContext method -func (call *AddLIFFCall) WithContext(ctx context.Context) *AddLIFFCall { - call.ctx = ctx - return call -} - -func (call *AddLIFFCall) encodeJSON(w io.Writer) error { - enc := json.NewEncoder(w) - return enc.Encode(&struct { - View View `json:"view"` - }{ - View: call.view, - }) -} - -// Do method -func (call *AddLIFFCall) Do() (*LIFFIDResponse, error) { - var buf bytes.Buffer - if err := call.encodeJSON(&buf); err != nil { - return nil, err - } - res, err := call.c.post(call.ctx, APIEndpointAddLIFFApp, &buf) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToLIFFIDResponse(res) -} - -// UpdateLIFF method -func (client *Client) UpdateLIFF(liffID string, view View) *UpdateLIFFCall { - return &UpdateLIFFCall{ - c: client, - liffID: liffID, - view: view, - } -} - -// UpdateLIFFCall type -type UpdateLIFFCall struct { - c *Client - ctx context.Context - - liffID string - view View -} - -// WithContext method -func (call *UpdateLIFFCall) WithContext(ctx context.Context) *UpdateLIFFCall { - call.ctx = ctx - return call -} - -func (call *UpdateLIFFCall) encodeJSON(w io.Writer) error { - enc := json.NewEncoder(w) - return enc.Encode(&struct { - Type LIFFViewType `json:"type"` - URL string `json:"url"` - }{ - Type: call.view.Type, - URL: call.view.URL, - }) -} - -// Do method -func (call *UpdateLIFFCall) Do() (*BasicResponse, error) { - var buf bytes.Buffer - if err := call.encodeJSON(&buf); err != nil { - return nil, err - } - - endpoint := fmt.Sprintf(APIEndpointUpdateLIFFApp, call.liffID) - res, err := call.c.put(call.ctx, endpoint, &buf) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// DeleteLIFF method -func (client *Client) DeleteLIFF(liffID string) *DeleteLIFFCall { - return &DeleteLIFFCall{ - c: client, - liffID: liffID, - } -} - -// DeleteLIFFCall type -type DeleteLIFFCall struct { - c *Client - ctx context.Context - - liffID string -} - -// WithContext method -func (call *DeleteLIFFCall) WithContext(ctx context.Context) *DeleteLIFFCall { - call.ctx = ctx - return call -} - -// Do method -func (call *DeleteLIFFCall) Do() (*BasicResponse, error) { - endpoint := fmt.Sprintf(APIEndpointDeleteLIFFApp, call.liffID) - res, err := call.c.delete(call.ctx, endpoint) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/mention.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/mention.go deleted file mode 100644 index 78bfac991..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/mention.go +++ /dev/null @@ -1,13 +0,0 @@ -package linebot - -// Mention type -type Mention struct { - Mentionees []*Mentionee `json:"mentionees"` -} - -// Mentionee type -type Mentionee struct { - Index int `json:"index"` - Length int `json:"length"` - UserID string `json:"userId,omitempty"` -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/message.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/message.go deleted file mode 100644 index 663800d5b..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/message.go +++ /dev/null @@ -1,648 +0,0 @@ -// Copyright 2016 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "encoding/json" -) - -// MessageType type -type MessageType string - -// MessageType constants -const ( - MessageTypeText MessageType = "text" - MessageTypeImage MessageType = "image" - MessageTypeVideo MessageType = "video" - MessageTypeAudio MessageType = "audio" - MessageTypeFile MessageType = "file" - MessageTypeLocation MessageType = "location" - MessageTypeSticker MessageType = "sticker" - MessageTypeTemplate MessageType = "template" - MessageTypeImagemap MessageType = "imagemap" - MessageTypeFlex MessageType = "flex" -) - -// Message interface -type Message interface { - Message() - Type() MessageType -} - -// SendingMessage interface -type SendingMessage interface { - Message - WithQuickReplies(*QuickReplyItems) SendingMessage - WithSender(*Sender) SendingMessage - AddEmoji(emoji *Emoji) SendingMessage -} - -// TextMessage type -type TextMessage struct { - ID string - Text string - Emojis []*Emoji - - quickReplyItems *QuickReplyItems - sender *Sender - messageType MessageType - - Mention *Mention -} - -// MarshalJSON method of TextMessage -func (m *TextMessage) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type MessageType `json:"type"` - Text string `json:"text"` - QuickReply *QuickReplyItems `json:"quickReply,omitempty"` - Sender *Sender `json:"sender,omitempty"` - Emojis []*Emoji `json:"emojis,omitempty"` - }{ - Type: m.messageType, - Text: m.Text, - QuickReply: m.quickReplyItems, - Sender: m.sender, - Emojis: m.Emojis, - }) -} - -// WithQuickReplies method of TextMessage -func (m *TextMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { - m.quickReplyItems = items - return m -} - -// WithSender method of TextMessage -func (m *TextMessage) WithSender(sender *Sender) SendingMessage { - m.sender = sender - return m -} - -// AddEmoji method of TextMessage -func (m *TextMessage) AddEmoji(emoji *Emoji) SendingMessage { - m.Emojis = append(m.Emojis, emoji) - return m -} - -// ImageMessage type -type ImageMessage struct { - ID string - OriginalContentURL string - PreviewImageURL string - ContentProvider *ContentProvider - ImageSet *ImageSet - - quickReplyItems *QuickReplyItems - sender *Sender - messageType MessageType -} - -// MarshalJSON method of ImageMessage -func (m *ImageMessage) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type MessageType `json:"type"` - OriginalContentURL string `json:"originalContentUrl"` - PreviewImageURL string `json:"previewImageUrl"` - ContentProvider *ContentProvider `json:"contentProvider,omitempty"` - ImageSet *ImageSet `json:"imageSet,omitempty"` - QuickReply *QuickReplyItems `json:"quickReply,omitempty"` - Sender *Sender `json:"sender,omitempty"` - }{ - Type: m.messageType, - OriginalContentURL: m.OriginalContentURL, - PreviewImageURL: m.PreviewImageURL, - ContentProvider: m.ContentProvider, - ImageSet: m.ImageSet, - QuickReply: m.quickReplyItems, - Sender: m.sender, - }) -} - -// WithQuickReplies method of ImageMessage -func (m *ImageMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { - m.quickReplyItems = items - return m -} - -// WithSender method of ImageMessage -func (m *ImageMessage) WithSender(sender *Sender) SendingMessage { - m.sender = sender - return m -} - -// AddEmoji method of ImageMessage -func (m *ImageMessage) AddEmoji(*Emoji) SendingMessage { - return m -} - -// VideoMessage type -type VideoMessage struct { - ID string - OriginalContentURL string - PreviewImageURL string - Duration int - ContentProvider *ContentProvider - - quickReplyItems *QuickReplyItems - sender *Sender - messageType MessageType -} - -// MarshalJSON method of VideoMessage -func (m *VideoMessage) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type MessageType `json:"type"` - OriginalContentURL string `json:"originalContentUrl"` - PreviewImageURL string `json:"previewImageUrl"` - Duration int `json:"duration,omitempty"` - QuickReply *QuickReplyItems `json:"quickReply,omitempty"` - Sender *Sender `json:"sender,omitempty"` - }{ - Type: m.messageType, - OriginalContentURL: m.OriginalContentURL, - PreviewImageURL: m.PreviewImageURL, - Duration: m.Duration, - QuickReply: m.quickReplyItems, - Sender: m.sender, - }) -} - -// WithQuickReplies method of VideoMessage -func (m *VideoMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { - m.quickReplyItems = items - return m -} - -// WithSender method of VideoMessage -func (m *VideoMessage) WithSender(sender *Sender) SendingMessage { - m.sender = sender - return m -} - -// AddEmoji method of VideoMessage -func (m *VideoMessage) AddEmoji(*Emoji) SendingMessage { - return m -} - -// AudioMessage type -type AudioMessage struct { - ID string - OriginalContentURL string - Duration int - ContentProvider *ContentProvider - - quickReplyItems *QuickReplyItems - sender *Sender - messageType MessageType -} - -// MarshalJSON method of AudioMessage -func (m *AudioMessage) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type MessageType `json:"type"` - OriginalContentURL string `json:"originalContentUrl"` - Duration int `json:"duration"` - QuickReply *QuickReplyItems `json:"quickReply,omitempty"` - Sender *Sender `json:"sender,omitempty"` - }{ - Type: m.messageType, - OriginalContentURL: m.OriginalContentURL, - Duration: m.Duration, - QuickReply: m.quickReplyItems, - Sender: m.sender, - }) -} - -// WithQuickReplies method of AudioMessage -func (m *AudioMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { - m.quickReplyItems = items - return m -} - -// WithSender method of AudioMessage -func (m *AudioMessage) WithSender(sender *Sender) SendingMessage { - m.sender = sender - return m -} - -// AddEmoji method of AudioMessage -func (m *AudioMessage) AddEmoji(*Emoji) SendingMessage { - return m -} - -// FileMessage type -type FileMessage struct { - ID string - FileName string - FileSize int - messageType MessageType -} - -// LocationMessage type -type LocationMessage struct { - ID string - Title string - Address string - Latitude float64 - Longitude float64 - - quickReplyItems *QuickReplyItems - sender *Sender - messageType MessageType -} - -// MarshalJSON method of LocationMessage -func (m *LocationMessage) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type MessageType `json:"type"` - Title string `json:"title"` - Address string `json:"address"` - Latitude float64 `json:"latitude"` - Longitude float64 `json:"longitude"` - QuickReply *QuickReplyItems `json:"quickReply,omitempty"` - Sender *Sender `json:"sender,omitempty"` - }{ - Type: m.messageType, - Title: m.Title, - Address: m.Address, - Latitude: m.Latitude, - Longitude: m.Longitude, - QuickReply: m.quickReplyItems, - Sender: m.sender, - }) -} - -// WithQuickReplies method of LocationMessage -func (m *LocationMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { - m.quickReplyItems = items - return m -} - -// WithSender method of LocationMessage -func (m *LocationMessage) WithSender(sender *Sender) SendingMessage { - m.sender = sender - return m -} - -// AddEmoji method of LocationMessage -func (m *LocationMessage) AddEmoji(*Emoji) SendingMessage { - return m -} - -// StickerMessage type -type StickerMessage struct { - ID string - PackageID string - StickerID string - StickerResourceType StickerResourceType - Keywords []string - Text string - - quickReplyItems *QuickReplyItems - sender *Sender - messageType MessageType -} - -// MarshalJSON method of StickerMessage -func (m *StickerMessage) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type MessageType `json:"type"` - PackageID string `json:"packageId"` - StickerID string `json:"stickerId"` - StickerResourceType StickerResourceType `json:"stickerResourceType,omitempty"` - Keywords []string `json:"keywords,omitempty"` - QuickReply *QuickReplyItems `json:"quickReply,omitempty"` - Sender *Sender `json:"sender,omitempty"` - Text string `json:"text,omitempty"` - }{ - Type: m.messageType, - PackageID: m.PackageID, - StickerID: m.StickerID, - StickerResourceType: m.StickerResourceType, - Keywords: m.Keywords, - QuickReply: m.quickReplyItems, - Sender: m.sender, - Text: m.Text, - }) -} - -// WithQuickReplies method of StickerMessage -func (m *StickerMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { - m.quickReplyItems = items - return m -} - -// WithSender method of StickerMessage -func (m *StickerMessage) WithSender(sender *Sender) SendingMessage { - m.sender = sender - return m -} - -// AddEmoji method of StickerMessage -func (m *StickerMessage) AddEmoji(*Emoji) SendingMessage { - return m -} - -// TemplateMessage type -type TemplateMessage struct { - AltText string - Template Template - - quickReplyItems *QuickReplyItems - sender *Sender - messageType MessageType -} - -// MarshalJSON method of TemplateMessage -func (m *TemplateMessage) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type MessageType `json:"type"` - AltText string `json:"altText"` - Template Template `json:"template"` - QuickReply *QuickReplyItems `json:"quickReply,omitempty"` - Sender *Sender `json:"sender,omitempty"` - }{ - Type: m.messageType, - AltText: m.AltText, - Template: m.Template, - QuickReply: m.quickReplyItems, - Sender: m.sender, - }) -} - -// WithQuickReplies method of TemplateMessage -func (m *TemplateMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { - m.quickReplyItems = items - return m -} - -// WithSender method of TemplateMessage -func (m *TemplateMessage) WithSender(sender *Sender) SendingMessage { - m.sender = sender - return m -} - -// AddEmoji method of TemplateMessage -func (m *TemplateMessage) AddEmoji(*Emoji) SendingMessage { - return m -} - -// ImagemapMessage type -type ImagemapMessage struct { - BaseURL string - AltText string - BaseSize ImagemapBaseSize - Actions []ImagemapAction - Video *ImagemapVideo - - quickReplyItems *QuickReplyItems - sender *Sender - messageType MessageType -} - -// MarshalJSON method of ImagemapMessage -func (m *ImagemapMessage) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type MessageType `json:"type"` - BaseURL string `json:"baseUrl"` - AltText string `json:"altText"` - BaseSize ImagemapBaseSize `json:"baseSize"` - Actions []ImagemapAction `json:"actions"` - Video *ImagemapVideo `json:"video,omitempty"` - QuickReply *QuickReplyItems `json:"quickReply,omitempty"` - Sender *Sender `json:"sender,omitempty"` - }{ - Type: m.messageType, - BaseURL: m.BaseURL, - AltText: m.AltText, - BaseSize: m.BaseSize, - Actions: m.Actions, - Video: m.Video, - QuickReply: m.quickReplyItems, - Sender: m.sender, - }) -} - -// WithVideo method -func (m *ImagemapMessage) WithVideo(video *ImagemapVideo) *ImagemapMessage { - m.Video = video - return m -} - -// WithQuickReplies method of ImagemapMessage -func (m *ImagemapMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { - m.quickReplyItems = items - return m -} - -// WithSender method of ImagemapMessage -func (m *ImagemapMessage) WithSender(sender *Sender) SendingMessage { - m.sender = sender - return m -} - -// AddEmoji method of ImagemapMessage -func (m *ImagemapMessage) AddEmoji(*Emoji) SendingMessage { - return m -} - -// FlexMessage type -type FlexMessage struct { - AltText string - Contents FlexContainer - - quickReplyItems *QuickReplyItems - sender *Sender - messageType MessageType -} - -// MarshalJSON method of FlexMessage -func (m *FlexMessage) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type MessageType `json:"type"` - AltText string `json:"altText"` - Contents interface{} `json:"contents"` - QuickReply *QuickReplyItems `json:"quickReply,omitempty"` - Sender *Sender `json:"sender,omitempty"` - }{ - Type: m.messageType, - AltText: m.AltText, - Contents: m.Contents, - QuickReply: m.quickReplyItems, - Sender: m.sender, - }) -} - -// WithQuickReplies method of FlexMessage -func (m *FlexMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage { - m.quickReplyItems = items - return m -} - -// WithSender method of FlexMessage -func (m *FlexMessage) WithSender(sender *Sender) SendingMessage { - m.sender = sender - return m -} - -// AddEmoji method of FlexMessage -func (m *FlexMessage) AddEmoji(*Emoji) SendingMessage { - return m -} - -// Message implements Message interface -func (*FileMessage) Message() {} - -// Message implements Message interface -func (*TextMessage) Message() {} - -// Message implements Message interface -func (*ImageMessage) Message() {} - -// Message implements Message interface -func (*VideoMessage) Message() {} - -// Message implements Message interface -func (*AudioMessage) Message() {} - -// Message implements Message interface -func (*LocationMessage) Message() {} - -// Message implements Message interface -func (*StickerMessage) Message() {} - -// Message implements Message interface -func (*TemplateMessage) Message() {} - -// Message implements Message interface -func (*ImagemapMessage) Message() {} - -// Message implements Message interface -func (*FlexMessage) Message() {} - -// Type implements Message interface -func (m *FileMessage) Type() MessageType { return m.messageType } - -// Type implements Message interface -func (m *TextMessage) Type() MessageType { return m.messageType } - -// Type implements Message interface -func (m *ImageMessage) Type() MessageType { return m.messageType } - -// Type implements Message interface -func (m *VideoMessage) Type() MessageType { return m.messageType } - -// Type implements Message interface -func (m *AudioMessage) Type() MessageType { return m.messageType } - -// Type implements Message interface -func (m *LocationMessage) Type() MessageType { return m.messageType } - -// Type implements Message interface -func (m *StickerMessage) Type() MessageType { return m.messageType } - -// Type implements Message interface -func (m *TemplateMessage) Type() MessageType { return m.messageType } - -// Type implements Message interface -func (m *ImagemapMessage) Type() MessageType { return m.messageType } - -// Type implements Message interface -func (m *FlexMessage) Type() MessageType { return m.messageType } - -// NewTextMessage function -func NewTextMessage(content string) *TextMessage { - return &TextMessage{ - Text: content, - messageType: MessageTypeText, - } -} - -// NewImageMessage function -func NewImageMessage(originalContentURL, previewImageURL string) *ImageMessage { - return &ImageMessage{ - OriginalContentURL: originalContentURL, - PreviewImageURL: previewImageURL, - messageType: MessageTypeImage, - } -} - -// NewVideoMessage function -func NewVideoMessage(originalContentURL, previewImageURL string) *VideoMessage { - return &VideoMessage{ - OriginalContentURL: originalContentURL, - PreviewImageURL: previewImageURL, - messageType: MessageTypeVideo, - } -} - -// NewAudioMessage function -func NewAudioMessage(originalContentURL string, duration int) *AudioMessage { - return &AudioMessage{ - OriginalContentURL: originalContentURL, - Duration: duration, - messageType: MessageTypeAudio, - } -} - -// NewLocationMessage function -func NewLocationMessage(title, address string, latitude, longitude float64) *LocationMessage { - return &LocationMessage{ - Title: title, - Address: address, - Latitude: latitude, - Longitude: longitude, - messageType: MessageTypeLocation, - } -} - -// NewStickerMessage function -func NewStickerMessage(packageID, stickerID string) *StickerMessage { - return &StickerMessage{ - PackageID: packageID, - StickerID: stickerID, - messageType: MessageTypeSticker, - } -} - -// NewTemplateMessage function -func NewTemplateMessage(altText string, template Template) *TemplateMessage { - return &TemplateMessage{ - AltText: altText, - Template: template, - messageType: MessageTypeTemplate, - } -} - -// NewImagemapMessage function -func NewImagemapMessage(baseURL, altText string, baseSize ImagemapBaseSize, actions ...ImagemapAction) *ImagemapMessage { - return &ImagemapMessage{ - BaseURL: baseURL, - AltText: altText, - BaseSize: baseSize, - Actions: actions, - messageType: MessageTypeImagemap, - } -} - -// NewFlexMessage function -func NewFlexMessage(altText string, contents FlexContainer) *FlexMessage { - return &FlexMessage{ - AltText: altText, - Contents: contents, - messageType: MessageTypeFlex, - } -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/oauth.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/oauth.go deleted file mode 100644 index cc373daae..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/oauth.go +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2016 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "context" - "net/url" - "strings" -) - -// IssueAccessToken method -func (client *Client) IssueAccessToken(channelID, channelSecret string) *IssueAccessTokenCall { - return &IssueAccessTokenCall{ - c: client, - channelID: channelID, - channelSecret: channelSecret, - } -} - -// IssueAccessTokenCall type -type IssueAccessTokenCall struct { - c *Client - ctx context.Context - - channelID string - channelSecret string -} - -// WithContext method -func (call *IssueAccessTokenCall) WithContext(ctx context.Context) *IssueAccessTokenCall { - call.ctx = ctx - return call -} - -// Do method -func (call *IssueAccessTokenCall) Do() (*AccessTokenResponse, error) { - vs := url.Values{} - vs.Set("grant_type", "client_credentials") - vs.Set("client_id", call.channelID) - vs.Set("client_secret", call.channelSecret) - body := strings.NewReader(vs.Encode()) - - res, err := call.c.postForm(call.ctx, APIEndpointIssueAccessToken, body) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToAccessTokenResponse(res) -} - -// RevokeAccessToken method -func (client *Client) RevokeAccessToken(accessToken string) *RevokeAccessTokenCall { - return &RevokeAccessTokenCall{ - c: client, - accessToken: accessToken, - } -} - -// RevokeAccessTokenCall type -type RevokeAccessTokenCall struct { - c *Client - ctx context.Context - - accessToken string -} - -// WithContext method -func (call *RevokeAccessTokenCall) WithContext(ctx context.Context) *RevokeAccessTokenCall { - call.ctx = ctx - return call -} - -// Do method -func (call *RevokeAccessTokenCall) Do() (*BasicResponse, error) { - vs := url.Values{} - vs.Set("access_token", call.accessToken) - body := strings.NewReader(vs.Encode()) - - res, err := call.c.postForm(call.ctx, APIEndpointRevokeAccessToken, body) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/oauth2.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/oauth2.go deleted file mode 100644 index 0f019aa5b..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/oauth2.go +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright 2020 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "context" - "net/url" - "strings" -) - -const clientAssertionTypeJWT = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" - -// IssueAccessTokenV2 method -func (client *Client) IssueAccessTokenV2(clientAssertion string) *IssueAccessTokenV2Call { - return &IssueAccessTokenV2Call{ - c: client, - clientAssertion: clientAssertion, - } -} - -// IssueAccessTokenV2Call type -type IssueAccessTokenV2Call struct { - c *Client - ctx context.Context - - clientAssertion string -} - -// WithContext method -func (call *IssueAccessTokenV2Call) WithContext(ctx context.Context) *IssueAccessTokenV2Call { - call.ctx = ctx - return call -} - -// Do method -func (call *IssueAccessTokenV2Call) Do() (*AccessTokenResponse, error) { - vs := url.Values{} - vs.Set("grant_type", "client_credentials") - vs.Set("client_assertion_type", clientAssertionTypeJWT) - vs.Set("client_assertion", call.clientAssertion) - body := strings.NewReader(vs.Encode()) - - res, err := call.c.postForm(call.ctx, APIEndpointIssueAccessTokenV2, body) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToAccessTokenResponse(res) -} - -// GetAccessTokensV2 method -func (client *Client) GetAccessTokensV2(clientAssertion string) *GetAccessTokensV2Call { - return &GetAccessTokensV2Call{ - c: client, - clientAssertion: clientAssertion, - } -} - -// GetAccessTokensV2Call type -type GetAccessTokensV2Call struct { - c *Client - ctx context.Context - - clientAssertion string -} - -// WithContext method -func (call *GetAccessTokensV2Call) WithContext(ctx context.Context) *GetAccessTokensV2Call { - call.ctx = ctx - return call -} - -// Do method -func (call *GetAccessTokensV2Call) Do() (*AccessTokensResponse, error) { - vs := url.Values{} - vs.Set("client_assertion_type", clientAssertionTypeJWT) - vs.Set("client_assertion", call.clientAssertion) - - res, err := call.c.get(call.ctx, call.c.endpointBase, APIEndpointGetAccessTokensV2, vs) - // body := strings.NewReader(vs.Encode()) - // res, err := call.c.postForm(call.ctx, APIEndpointGetAccessTokensV2, body) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToAccessTokensResponse(res) -} - -// RevokeAccessTokenV2 method -func (client *Client) RevokeAccessTokenV2(channelID, channelSecret, accessToken string) *RevokeAccessTokenV2Call { - return &RevokeAccessTokenV2Call{ - c: client, - accessToken: accessToken, - channelID: channelID, - channelSecret: channelSecret, - } -} - -// RevokeAccessTokenV2Call type -type RevokeAccessTokenV2Call struct { - c *Client - ctx context.Context - - accessToken string - channelID string - channelSecret string -} - -// WithContext method -func (call *RevokeAccessTokenV2Call) WithContext(ctx context.Context) *RevokeAccessTokenV2Call { - call.ctx = ctx - return call -} - -// Do method -func (call *RevokeAccessTokenV2Call) Do() (*BasicResponse, error) { - vs := url.Values{} - vs.Set("access_token", call.accessToken) - vs.Set("client_id", call.channelID) - vs.Set("client_secret", call.channelSecret) - body := strings.NewReader(vs.Encode()) - - res, err := call.c.postForm(call.ctx, APIEndpointRevokeAccessTokenV2, body) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/progress.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/progress.go deleted file mode 100644 index 13ecaa970..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/progress.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2020 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "context" - "fmt" - "net/url" -) - -// ProgressType type -type ProgressType string - -// ProgressType constants -const ( - ProgressTypeNarrowcast ProgressType = "narrowcast" -) - -// GetProgressNarrowcastMessages method -func (client *Client) GetProgressNarrowcastMessages(requestID string) *GetProgressMessagesCall { - return &GetProgressMessagesCall{ - c: client, - requestID: requestID, - progressType: ProgressTypeNarrowcast, - } -} - -// GetProgressMessagesCall type -type GetProgressMessagesCall struct { - c *Client - ctx context.Context - - requestID string - progressType ProgressType -} - -// WithContext method -func (call *GetProgressMessagesCall) WithContext(ctx context.Context) *GetProgressMessagesCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetProgressMessagesCall) Do() (*MessagesProgressResponse, error) { - endpoint := fmt.Sprintf(APIEndpointGetMessageProgress, call.progressType) - var q url.Values - if call.requestID != "" { - q = url.Values{"requestId": []string{call.requestID}} - } - res, err := call.c.get(call.ctx, call.c.endpointBase, endpoint, q) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToMessagesProgressResponse(res) -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/quick_reply.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/quick_reply.go deleted file mode 100644 index a7fb83512..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/quick_reply.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2018 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "encoding/json" -) - -// QuickReplyItems struct -type QuickReplyItems struct { - Items []*QuickReplyButton `json:"items"` -} - -// NewQuickReplyItems function -func NewQuickReplyItems(buttons ...*QuickReplyButton) *QuickReplyItems { - return &QuickReplyItems{ - Items: buttons, - } -} - -// QuickReplyButton type -type QuickReplyButton struct { - ImageURL string - Action QuickReplyAction -} - -// MarshalJSON method of QuickReplyButton -func (b *QuickReplyButton) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type string `json:"type"` - ImageURL string `json:"imageUrl,omitempty"` - Action QuickReplyAction `json:"action"` - }{ - Type: "action", - ImageURL: b.ImageURL, - Action: b.Action, - }) -} - -// NewQuickReplyButton function -func NewQuickReplyButton(imageURL string, action QuickReplyAction) *QuickReplyButton { - return &QuickReplyButton{ - ImageURL: imageURL, - Action: action, - } -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/raw.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/raw.go deleted file mode 100644 index f542af801..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/raw.go +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2021 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "context" - "io" - "net/http" -) - -// NewRawCall method -func (client *Client) NewRawCall(method string, endpoint string) (*RawCall, error) { - req, err := http.NewRequest(method, client.url(client.endpointBase, endpoint), nil) - if err != nil { - return nil, err - } - return &RawCall{ - c: client, - req: req, - }, nil -} - -// NewRawCallWithBody method -func (client *Client) NewRawCallWithBody(method string, endpoint string, body io.Reader) (*RawCall, error) { - req, err := http.NewRequest(method, client.url(client.endpointBase, endpoint), body) - if err != nil { - return nil, err - } - return &RawCall{ - c: client, - req: req, - }, nil -} - -// RawCall type -type RawCall struct { - c *Client - ctx context.Context - - req *http.Request -} - -// AddHeader method -func (call *RawCall) AddHeader(key string, value string) { - call.req.Header.Add(key, value) -} - -// WithContext method -func (call *RawCall) WithContext(ctx context.Context) *RawCall { - call.ctx = ctx - return call -} - -// Do method. Callee must close response object. -func (call *RawCall) Do() (*http.Response, error) { - return call.c.do(call.ctx, call.req) -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/recipient.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/recipient.go deleted file mode 100644 index db17e3e90..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/recipient.go +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2020 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import "encoding/json" - -// Recipient interface -type Recipient interface { - Recipient() -} - -// AudienceObject type is created to be used with specific recipient objects -type AudienceObject struct { - Type string `json:"type"` - GroupID int `json:"audienceGroupId"` -} - -// NewAudienceObject function -func NewAudienceObject(groupID int) *AudienceObject { - return &AudienceObject{ - Type: "audience", - GroupID: groupID, - } -} - -// Recipient implements Recipient interface -func (*AudienceObject) Recipient() {} - -// RedeliveryObject type is created to be used with specific recipient objects -type RedeliveryObject struct { - Type string `json:"type"` - RequestID string `json:"requestId"` -} - -// NewRedeliveryObject function -func NewRedeliveryObject(requestID string) *RedeliveryObject { - return &RedeliveryObject{ - Type: "redelivery", - RequestID: requestID, - } -} - -// Recipient implements Recipient interface -func (*RedeliveryObject) Recipient() {} - -// RecipientOperator struct -type RecipientOperator struct { - ConditionAnd []Recipient `json:"and,omitempty"` - ConditionOr []Recipient `json:"or,omitempty"` - ConditionNot Recipient `json:"not,omitempty"` -} - -// RecipientOperatorAnd method -func RecipientOperatorAnd(conditions ...Recipient) *RecipientOperator { - return &RecipientOperator{ - ConditionAnd: conditions, - } -} - -// RecipientOperatorOr method -func RecipientOperatorOr(conditions ...Recipient) *RecipientOperator { - return &RecipientOperator{ - ConditionOr: conditions, - } -} - -// RecipientOperatorNot method -func RecipientOperatorNot(condition Recipient) *RecipientOperator { - return &RecipientOperator{ - ConditionNot: condition, - } -} - -// MarshalJSON method of Operator -func (o *RecipientOperator) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type string `json:"type"` - ConditionAnd []Recipient `json:"and,omitempty"` - ConditionOr []Recipient `json:"or,omitempty"` - ConditionNot Recipient `json:"not,omitempty"` - }{ - Type: "operator", - ConditionAnd: o.ConditionAnd, - ConditionOr: o.ConditionOr, - ConditionNot: o.ConditionNot, - }) -} - -// Recipient implements Recipient interface -func (*RecipientOperator) Recipient() {} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/response.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/response.go deleted file mode 100644 index efb9f1343..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/response.go +++ /dev/null @@ -1,884 +0,0 @@ -// Copyright 2016 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "bytes" - "encoding/json" - "io" - "io/ioutil" - "net/http" - "time" -) - -// BasicResponse type -type BasicResponse struct { - RequestID string -} - -type errorResponseDetail struct { - Message string `json:"message"` - Property string `json:"property"` -} - -// ErrorResponse type -type ErrorResponse struct { - Message string `json:"message"` - Details []errorResponseDetail `json:"details"` - // OAuth Errors - Error string `json:"error"` - ErrorDescription string `json:"error_description"` -} - -// UserProfileResponse type -type UserProfileResponse struct { - UserID string `json:"userId"` - DisplayName string `json:"displayName"` - PictureURL string `json:"pictureUrl"` - StatusMessage string `json:"statusMessage"` - Language string `json:"language"` -} - -// UserIDsResponse type -type UserIDsResponse struct { - UserIDs []string `json:"userIds"` - Next string `json:"next"` -} - -// GroupSummaryResponse type -type GroupSummaryResponse struct { - GroupID string `json:"groupId"` - GroupName string `json:"groupName"` - PictureURL string `json:"pictureUrl"` -} - -// MemberIDsResponse type -type MemberIDsResponse struct { - MemberIDs []string `json:"memberIds"` - Next string `json:"next"` -} - -// MemberCountResponse type -type MemberCountResponse struct { - Count int `json:"count"` -} - -// MessageContentResponse type -type MessageContentResponse struct { - Content io.ReadCloser - ContentLength int64 - ContentType string -} - -// MessagesNumberResponse type -type MessagesNumberResponse struct { - Status string - Success int64 -} - -// MessageQuotaResponse type -type MessageQuotaResponse struct { - Type string - Value int64 - TotalUsage int64 `json:"totalUsage"` -} - -// MessageConsumptionResponse type -type MessageConsumptionResponse struct { - TotalUsage int64 -} - -// BotInfoResponse type -type BotInfoResponse struct { - UserID string `json:"userId"` - BasicID string `json:"basicId"` - PremiumID string `json:"premiumId"` - DisplayName string `json:"displayName"` - PictureURL string `json:"pictureUrl"` - ChatMode ChatMode `json:"chatMode"` - MarkAsReadMode MarkAsReadMode `json:"markAsReadMode"` -} - -// MessagesNumberDeliveryResponse type -type MessagesNumberDeliveryResponse struct { - Status string `json:"status"` - Broadcast int64 `json:"broadcast"` - Targeting int64 `json:"targeting"` - AutoResponse int64 `json:"autoResponse"` - WelcomeResponse int64 `json:"welcomeResponse"` - Chat int64 `json:"chat"` - APIBroadcast int64 `json:"apiBroadcast"` - APIPush int64 `json:"apiPush"` - APIMulticast int64 `json:"apiMulticast"` - APINarrowcast int64 `json:"apiNarrowcast"` - APIReply int64 `json:"apiReply"` -} - -// MessagesNumberFollowersResponse type -type MessagesNumberFollowersResponse struct { - Status string `json:"status"` - Followers int64 `json:"followers"` - TargetedReaches int64 `json:"targetedReaches"` - Blocks int64 `json:"blocks"` -} - -// MessagesProgressResponse type -type MessagesProgressResponse struct { - Phase string `json:"phase"` - SuccessCount int64 `json:"successCount"` - FailureCount int64 `json:"failureCount"` - TargetCount int64 `json:"targetCount"` - FailedDescription string `json:"failedDescription"` - ErrorCode int `json:"errorCode"` - AcceptedTime string `json:"acceptedTime"` - CompletedTime string `json:"completedTime,omitempty"` -} - -// MessagesFriendDemographicsResponse type -type MessagesFriendDemographicsResponse struct { - Available bool `json:"available"` - Genders []GenderDetail `json:"genders"` - Ages []AgeDetail `json:"ages"` - Areas []AreasDetail `json:"areas"` - AppTypes []AppTypeDetail `json:"appTypes"` - SubscriptionPeriods []SubscriptionPeriodDetail `json:"subscriptionPeriods"` -} - -// GenderDetail type -type GenderDetail struct { - Gender string `json:"gender"` - Percentage float64 `json:"percentage"` -} - -// AgeDetail type -type AgeDetail struct { - Age string `json:"age"` - Percentage float64 `json:"percentage"` -} - -// AreasDetail type -type AreasDetail struct { - Area string `json:"area"` - Percentage float64 `json:"percentage"` -} - -// AppTypeDetail type -type AppTypeDetail struct { - AppType string `json:"appType"` - Percentage float64 `json:"percentage"` -} - -// SubscriptionPeriodDetail type -type SubscriptionPeriodDetail struct { - SubscriptionPeriod string `json:"subscriptionPeriod"` - Percentage float64 `json:"percentage"` -} - -// MessagesUserInteractionStatsResponse type -type MessagesUserInteractionStatsResponse struct { - Overview OverviewDetail `json:"overview"` - Messages []MessageDetail `json:"messages"` - Clicks []ClickDetail `json:"clicks"` -} - -// OverviewDetail type -type OverviewDetail struct { - RequestID string `json:"requestId"` - Timestamp int64 `json:"timestamp"` - Delivered int64 `json:"delivered"` - UniqueImpression int64 `json:"uniqueImpression"` - UniqueClick int64 `json:"uniqueClick"` - UniqueMediaPlayed int64 `json:"uniqueMediaPlayed"` - UniqueMediaPlayed100Percent int64 `json:"uniqueMediaPlayed100Percent"` -} - -// MessageDetail type -type MessageDetail struct { - Seq int64 `json:"seq"` - Impression int64 `json:"impression"` - MediaPlayed int64 `json:"mediaPlayed"` - MediaPlayed25Percent int64 `json:"mediaPlayed25Percent"` - MediaPlayed50Percent int64 `json:"mediaPlayed50Percent"` - MediaPlayed75Percent int64 `json:"mediaPlayed75Percent"` - MediaPlayed100Percent int64 `json:"mediaPlayed100Percent"` - UniqueMediaPlayed int64 `json:"uniqueMediaPlayed"` - UniqueMediaPlayed25Percent int64 `json:"uniqueMediaPlayed25Percent"` - UniqueMediaPlayed50Percent int64 `json:"uniqueMediaPlayed50Percent"` - UniqueMediaPlayed75Percent int64 `json:"uniqueMediaPlayed75Percent"` - UniqueMediaPlayed100Percent int64 `json:"uniqueMediaPlayed100Percent"` -} - -// ClickDetail type -type ClickDetail struct { - Seq int64 `json:"seq"` - URL string `json:"url"` - Click int64 `json:"click"` - UniqueClick int64 `json:"uniqueClick"` - UniqueClickOfRequest int64 `json:"uniqueClickOfRequest"` -} - -// RichMenuIDResponse type -type RichMenuIDResponse struct { - RichMenuID string `json:"richMenuId"` -} - -// RichMenuResponse type -type RichMenuResponse struct { - RichMenuID string `json:"richMenuId"` - Size RichMenuSize `json:"size"` - Selected bool `json:"selected"` - Name string `json:"name"` - ChatBarText string `json:"chatBarText"` - Areas []AreaDetail `json:"areas"` -} - -// RichMenuAliasResponse type -type RichMenuAliasResponse struct { - RichMenuAliasID string `json:"richMenuAliasId"` - RichMenuID string `json:"richMenuId"` -} - -// LIFFAppsResponse type -type LIFFAppsResponse struct { - Apps []LIFFApp `json:"apps"` -} - -// LIFFIDResponse type -type LIFFIDResponse struct { - LIFFID string `json:"liffId"` -} - -// LinkTokenResponse type -type LinkTokenResponse struct { - LinkToken string `json:"linkToken"` -} - -// WebhookInfoResponse type -type WebhookInfoResponse struct { - Endpoint string `json:"endpoint"` - Active bool `json:"active"` -} - -// UploadAudienceGroupResponse type -type UploadAudienceGroupResponse struct { - RequestID string `json:"-"` - AcceptedRequestID string `json:"-"` - AudienceGroupID int `json:"audienceGroupId,omitempty"` - CreateRoute string `json:"createRoute,omitempty"` - Type string `json:"type,omitempty"` - Description string `json:"description,omitempty"` - Created int64 `json:"created,omitempty"` - Permission string `json:"permission,omitempty"` - ExpireTimestamp int64 `json:"expireTimestamp,omitempty"` - IsIfaAudience bool `json:"isIfaAudience,omitempty"` -} - -// ClickAudienceGroupResponse type -type ClickAudienceGroupResponse struct { - XRequestID string `json:"-"` // from header X-Line-Request-Id - AcceptedRequestID string `json:"-"` - AudienceGroupID int `json:"audienceGroupId,omitempty"` - CreateRoute string `json:"createRoute,omitempty"` - Type string `json:"type,omitempty"` - Description string `json:"description,omitempty"` - Created int64 `json:"created,omitempty"` - Permission string `json:"permission,omitempty"` - ExpireTimestamp int64 `json:"expireTimestamp,omitempty"` - IsIfaAudience bool `json:"isIfaAudience,omitempty"` - RequestID string `json:"requestId,omitempty"` - ClickURL string `json:"clickUrl,omitempty"` -} - -// IMPAudienceGroupResponse type -type IMPAudienceGroupResponse struct { - XRequestID string `json:"-"` - AcceptedRequestID string `json:"-"` - AudienceGroupID int `json:"audienceGroupId,omitempty"` - CreateRoute string `json:"createRoute,omitempty"` - Type string `json:"type,omitempty"` - Description string `json:"description,omitempty"` - Created int64 `json:"created,omitempty"` - Permission string `json:"permission,omitempty"` - ExpireTimestamp int64 `json:"expireTimestamp,omitempty"` - IsIfaAudience bool `json:"isIfaAudience,omitempty"` - RequestID string `json:"requestId,omitempty"` -} - -// AudienceGroup type -type AudienceGroup struct { - AudienceGroupID int `json:"audienceGroupId,omitempty"` - CreateRoute string `json:"createRoute,omitempty"` - Type string `json:"type,omitempty"` - Description string `json:"description,omitempty"` - Status string `json:"status,omitempty"` - AudienceCount int `json:"audienceCount,omitempty"` - Created int64 `json:"created,omitempty"` - Permission string `json:"permission,omitempty"` - IsIfaAudience bool `json:"isIfaAudience,omitempty"` - RequestID string `json:"requestId,omitempty"` - ClickURL string `json:"clickUrl,omitempty"` - FailedType string `json:"failedType,omitempty"` - Activated int64 `json:"activated,omitempty"` - InactivatedTimestamp int64 `json:"inactivatedTimestamp,omitempty"` - ExpireTimestamp int64 `json:"expireTimestamp,omitempty"` -} - -// Job type -type Job struct { - AudienceGroupJobID int `json:"audienceGroupJobId,omitempty"` - AudienceGroupID int `json:"audienceGroupId,omitempty"` - Description string `json:"description,omitempty"` - Type string `json:"type,omitempty"` - Status string `json:"status,omitempty"` - FailedType string `json:"failedType,omitempty"` - AudienceCount int64 `json:"audienceCount,omitempty"` - Created int64 `json:"created,omitempty"` - JobStatus string `json:"jobStatus,omitempty"` -} - -// AdAccount type -type AdAccount struct { - Name string `json:"name,omitempty"` -} - -// GetAudienceGroupResponse type -type GetAudienceGroupResponse struct { - RequestID string `json:"-"` - AcceptedRequestID string `json:"-"` - AudienceGroup AudienceGroup `json:"audienceGroup,omitempty"` - Jobs []Job `json:"jobs,omitempty"` - AdAccount *AdAccount `json:"adaccount,omitempty"` -} - -// ListAudienceGroupResponse type -type ListAudienceGroupResponse struct { - RequestID string `json:"-"` - AcceptedRequestID string `json:"-"` - AudienceGroups []AudienceGroup `json:"audienceGroups,omitempty"` - HasNextPage bool `json:"hasNextPage,omitempty"` - TotalCount int `json:"totalCount,omitempty"` - ReadWriteAudienceGroupTotalCount int `json:"readWriteAudienceGroupTotalCount,omitempty"` - Page int `json:"page,omitempty"` - Size int `json:"size,omitempty"` -} - -// GetAudienceGroupAuthorityLevelResponse type -type GetAudienceGroupAuthorityLevelResponse struct { - RequestID string `json:"-"` - AcceptedRequestID string `json:"-"` - AuthorityLevel AudienceAuthorityLevelType `json:"authorityLevel,omitempty"` -} - -// isSuccess checks if status code is 2xx: The action was successfully received, -// understood, and accepted. -func isSuccess(code int) bool { - return code/100 == 2 -} - -// AccessTokenResponse type -type AccessTokenResponse struct { - AccessToken string `json:"access_token"` - ExpiresIn int64 `json:"expires_in"` - TokenType string `json:"token_type"` - KeyID string `json:"key_id"` -} - -// AccessTokensResponse type -type AccessTokensResponse struct { - KeyIDs []string `json:"kids"` -} - -// TestWebhookResponse type -type TestWebhookResponse struct { - Success bool `json:"success"` - Timestamp time.Time `json:"timestamp"` - StatusCode int `json:"statusCode"` - Reason string `json:"reason"` - Detail string `json:"detail"` -} - -func checkResponse(res *http.Response) error { - if isSuccess(res.StatusCode) { - return nil - } - decoder := json.NewDecoder(res.Body) - result := ErrorResponse{} - if err := decoder.Decode(&result); err != nil { - return &APIError{ - Code: res.StatusCode, - } - } - return &APIError{ - Code: res.StatusCode, - Response: &result, - } -} - -func decodeToBasicResponse(res *http.Response) (*BasicResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := BasicResponse{ - RequestID: res.Header.Get("X-Line-Request-Id"), - } - if err := decoder.Decode(&result); err != nil { - if err == io.EOF { - return &result, nil - } - return nil, err - } - return &result, nil -} - -func decodeToUserProfileResponse(res *http.Response) (*UserProfileResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := UserProfileResponse{} - if err := decoder.Decode(&result); err != nil { - return nil, err - } - return &result, nil -} - -func decodeToUserIDsResponse(res *http.Response) (*UserIDsResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := &UserIDsResponse{} - if err := decoder.Decode(result); err != nil { - return nil, err - } - return result, nil -} - -func decodeToGroupSummaryResponse(res *http.Response) (*GroupSummaryResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := &GroupSummaryResponse{} - if err := decoder.Decode(result); err != nil { - return nil, err - } - return result, nil -} - -func decodeToMemberIDsResponse(res *http.Response) (*MemberIDsResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := &MemberIDsResponse{} - if err := decoder.Decode(result); err != nil { - return nil, err - } - return result, nil -} - -func decodeToMemberCountResponse(res *http.Response) (*MemberCountResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := &MemberCountResponse{} - if err := decoder.Decode(result); err != nil { - return nil, err - } - return result, nil -} - -func decodeToMessageContentResponse(res *http.Response) (*MessageContentResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - var buf bytes.Buffer - if _, err := io.Copy(&buf, res.Body); err != nil { - return nil, err - } - result := MessageContentResponse{ - Content: ioutil.NopCloser(&buf), - ContentType: res.Header.Get("Content-Type"), - ContentLength: res.ContentLength, - } - return &result, nil -} - -func decodeToMessageQuotaResponse(res *http.Response) (*MessageQuotaResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := &MessageQuotaResponse{} - if err := decoder.Decode(result); err != nil { - return nil, err - } - return result, nil -} - -func decodeToMessageConsumptionResponse(res *http.Response) (*MessageConsumptionResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := &MessageConsumptionResponse{} - if err := decoder.Decode(result); err != nil { - return nil, err - } - return result, nil -} - -func decodeToBotInfoResponse(res *http.Response) (*BotInfoResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := &BotInfoResponse{} - if err := decoder.Decode(result); err != nil { - return nil, err - } - return result, nil -} - -func decodeToRichMenuResponse(res *http.Response) (*RichMenuResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := RichMenuResponse{} - if err := decoder.Decode(&result); err != nil { - return nil, err - } - return &result, nil -} - -func decodeToRichMenuListResponse(res *http.Response) ([]*RichMenuResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := struct { - RichMenus []*RichMenuResponse `json:"richmenus"` - }{} - if err := decoder.Decode(&result); err != nil { - return nil, err - } - return result.RichMenus, nil -} - -func decodeToRichMenuIDResponse(res *http.Response) (*RichMenuIDResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := RichMenuIDResponse{} - if err := decoder.Decode(&result); err != nil { - return nil, err - } - return &result, nil -} - -func decodeToRichMenuAliasResponse(res *http.Response) (*RichMenuAliasResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := RichMenuAliasResponse{} - if err := decoder.Decode(&result); err != nil { - return nil, err - } - return &result, nil -} - -func decodeToRichMenuAliasListResponse(res *http.Response) ([]*RichMenuAliasResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := struct { - Aliases []*RichMenuAliasResponse `json:"aliases"` - }{} - if err := decoder.Decode(&result); err != nil { - return nil, err - } - return result.Aliases, nil -} - -func decodeToLIFFResponse(res *http.Response) (*LIFFAppsResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := &LIFFAppsResponse{} - if err := decoder.Decode(result); err != nil { - return nil, err - } - return result, nil -} - -func decodeToLIFFIDResponse(res *http.Response) (*LIFFIDResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := LIFFIDResponse{} - if err := decoder.Decode(&result); err != nil { - return nil, err - } - return &result, nil -} - -func decodeToLinkTokenResponse(res *http.Response) (*LinkTokenResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := LinkTokenResponse{} - if err := decoder.Decode(&result); err != nil { - return nil, err - } - return &result, nil -} - -func decodeToWebhookInfoResponse(res *http.Response) (*WebhookInfoResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := WebhookInfoResponse{} - if err := decoder.Decode(&result); err != nil { - return nil, err - } - return &result, nil -} - -func decodeToMessagesNumberResponse(res *http.Response) (*MessagesNumberResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := MessagesNumberResponse{} - if err := decoder.Decode(&result); err != nil { - return nil, err - } - return &result, nil -} - -func decodeToMessagesNumberDeliveryResponse(res *http.Response) (*MessagesNumberDeliveryResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := MessagesNumberDeliveryResponse{} - if err := decoder.Decode(&result); err != nil { - return nil, err - } - return &result, nil -} - -func decodeToMessagesNumberFollowersResponse(res *http.Response) (*MessagesNumberFollowersResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := MessagesNumberFollowersResponse{} - if err := decoder.Decode(&result); err != nil { - return nil, err - } - return &result, nil -} - -func decodeToMessagesFriendDemographicsResponse(res *http.Response) (*MessagesFriendDemographicsResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := MessagesFriendDemographicsResponse{} - if err := decoder.Decode(&result); err != nil { - return nil, err - } - return &result, nil -} - -func decodeToMessagesUserInteractionStatsResponse(res *http.Response) (*MessagesUserInteractionStatsResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := MessagesUserInteractionStatsResponse{} - if err := decoder.Decode(&result); err != nil { - return nil, err - } - return &result, nil -} - -func decodeToMessagesProgressResponse(res *http.Response) (*MessagesProgressResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := MessagesProgressResponse{} - if err := decoder.Decode(&result); err != nil { - return nil, err - } - return &result, nil -} - -func decodeToAccessTokenResponse(res *http.Response) (*AccessTokenResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := AccessTokenResponse{} - if err := decoder.Decode(&result); err != nil { - return nil, err - } - return &result, nil -} - -func decodeToAccessTokensResponse(res *http.Response) (*AccessTokensResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := AccessTokensResponse{} - if err := decoder.Decode(&result); err != nil { - return nil, err - } - return &result, nil -} - -func decodeToTestWebhookResponse(res *http.Response) (*TestWebhookResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := TestWebhookResponse{} - if err := decoder.Decode(&result); err != nil { - return nil, err - } - return &result, nil -} - -func decodeToAudienceGroupResponse(res *http.Response) (*UploadAudienceGroupResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := UploadAudienceGroupResponse{ - RequestID: res.Header.Get("X-Line-Request-Id"), - AcceptedRequestID: res.Header.Get("X-Line-Accepted-Request-Id"), - } - if err := decoder.Decode(&result); err != nil { - if err == io.EOF { - return &result, nil - } - return nil, err - } - return &result, nil -} - -func decodeToClickAudienceGroupResponse(res *http.Response) (*ClickAudienceGroupResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := ClickAudienceGroupResponse{ - XRequestID: res.Header.Get("X-Line-Request-Id"), - AcceptedRequestID: res.Header.Get("X-Line-Accepted-Request-Id"), - } - if err := decoder.Decode(&result); err != nil { - if err == io.EOF { - return &result, nil - } - return nil, err - } - return &result, nil -} - -func decodeToIMPAudienceGroupResponse(res *http.Response) (*IMPAudienceGroupResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := IMPAudienceGroupResponse{ - XRequestID: res.Header.Get("X-Line-Request-Id"), - AcceptedRequestID: res.Header.Get("X-Line-Accepted-Request-Id"), - } - if err := decoder.Decode(&result); err != nil { - if err == io.EOF { - return &result, nil - } - return nil, err - } - return &result, nil -} - -func decodeToGetAudienceGroupResponse(res *http.Response) (*GetAudienceGroupResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := GetAudienceGroupResponse{ - RequestID: res.Header.Get("X-Line-Request-Id"), - AcceptedRequestID: res.Header.Get("X-Line-Accepted-Request-Id"), - } - if err := decoder.Decode(&result); err != nil { - if err == io.EOF { - return &result, nil - } - return nil, err - } - return &result, nil -} - -func decodeToListAudienceGroupResponse(res *http.Response) (*ListAudienceGroupResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := ListAudienceGroupResponse{ - RequestID: res.Header.Get("X-Line-Request-Id"), - AcceptedRequestID: res.Header.Get("X-Line-Accepted-Request-Id"), - } - if err := decoder.Decode(&result); err != nil { - if err == io.EOF { - return &result, nil - } - return nil, err - } - return &result, nil -} - -func decodeToGetAudienceGroupAuthorityLevelResponse(res *http.Response) (*GetAudienceGroupAuthorityLevelResponse, error) { - if err := checkResponse(res); err != nil { - return nil, err - } - decoder := json.NewDecoder(res.Body) - result := GetAudienceGroupAuthorityLevelResponse{ - RequestID: res.Header.Get("X-Line-Request-Id"), - AcceptedRequestID: res.Header.Get("X-Line-Accepted-Request-Id"), - } - if err := decoder.Decode(&result); err != nil { - if err == io.EOF { - return &result, nil - } - return nil, err - } - return &result, nil -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/richmenu.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/richmenu.go deleted file mode 100644 index 1c4c4067a..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/richmenu.go +++ /dev/null @@ -1,880 +0,0 @@ -// Copyright 2016 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "bytes" - "context" - "encoding/json" - "fmt" - "io" - "net/http" - "os" -) - -// RichMenuActionType type -type RichMenuActionType string - -// RichMenuActionType constants -const ( - RichMenuActionTypeURI RichMenuActionType = "uri" - RichMenuActionTypeMessage RichMenuActionType = "message" - RichMenuActionTypePostback RichMenuActionType = "postback" - RichMenuActionTypeDatetimePicker RichMenuActionType = "datetimepicker" - RichMenuActionTypeRichMenuSwitch RichMenuActionType = "richmenuswitch" -) - -// RichMenuSize type -type RichMenuSize struct { - Width int `json:"width"` - Height int `json:"height"` -} - -// RichMenuBounds type -type RichMenuBounds struct { - X int `json:"x"` - Y int `json:"y"` - Width int `json:"width"` - Height int `json:"height"` -} - -// RichMenuAction with type -type RichMenuAction struct { - Type RichMenuActionType `json:"type"` - URI string `json:"uri,omitempty"` - Text string `json:"text,omitempty"` - DisplayText string `json:"displayText,omitempty"` - Label string `json:"label,omitempty"` - Data string `json:"data,omitempty"` - Mode string `json:"mode,omitempty"` - Initial string `json:"initial,omitempty"` - Max string `json:"max,omitempty"` - Min string `json:"min,omitempty"` - RichMenuAliasID string `json:"richMenuAliasId,omitempty"` -} - -// AreaDetail type for areas array -type AreaDetail struct { - Bounds RichMenuBounds `json:"bounds"` - Action RichMenuAction `json:"action"` -} - -// RichMenu type -type RichMenu struct { - Size RichMenuSize - Selected bool - Name string - ChatBarText string - Areas []AreaDetail -} - -/* -{ - "richmenus": [ - { - "richMenuId": "{richMenuId}", - "size": { - "width": 2500, - "height": 1686 - }, - "selected": false, - "areas": [ - { - "bounds": { - "x": 0, - "y": 0, - "width": 2500, - "height": 1686 - }, - "action": { - "type": "postback", - "data": "action=buy&itemid=123", - "label":"Buy", - "displayText":"Buy" - } - } - ] - } - ] -} -*/ - -// GetRichMenu method -func (client *Client) GetRichMenu(richMenuID string) *GetRichMenuCall { - return &GetRichMenuCall{ - c: client, - richMenuID: richMenuID, - } -} - -// GetRichMenuCall type -type GetRichMenuCall struct { - c *Client - ctx context.Context - - richMenuID string -} - -// WithContext method -func (call *GetRichMenuCall) WithContext(ctx context.Context) *GetRichMenuCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetRichMenuCall) Do() (*RichMenuResponse, error) { - endpoint := fmt.Sprintf(APIEndpointGetRichMenu, call.richMenuID) - res, err := call.c.get(call.ctx, call.c.endpointBase, endpoint, nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToRichMenuResponse(res) -} - -// GetUserRichMenu method -func (client *Client) GetUserRichMenu(userID string) *GetUserRichMenuCall { - return &GetUserRichMenuCall{ - c: client, - userID: userID, - } -} - -// GetUserRichMenuCall type -type GetUserRichMenuCall struct { - c *Client - ctx context.Context - - userID string -} - -// WithContext method -func (call *GetUserRichMenuCall) WithContext(ctx context.Context) *GetUserRichMenuCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetUserRichMenuCall) Do() (*RichMenuResponse, error) { - endpoint := fmt.Sprintf(APIEndpointGetUserRichMenu, call.userID) - res, err := call.c.get(call.ctx, call.c.endpointBase, endpoint, nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToRichMenuResponse(res) -} - -// CreateRichMenu method -func (client *Client) CreateRichMenu(richMenu RichMenu) *CreateRichMenuCall { - return &CreateRichMenuCall{ - c: client, - richMenu: richMenu, - } -} - -// CreateRichMenuCall type -type CreateRichMenuCall struct { - c *Client - ctx context.Context - - richMenu RichMenu -} - -// WithContext method -func (call *CreateRichMenuCall) WithContext(ctx context.Context) *CreateRichMenuCall { - call.ctx = ctx - return call -} - -func (call *CreateRichMenuCall) encodeJSON(w io.Writer) error { - enc := json.NewEncoder(w) - return enc.Encode(&struct { - Size RichMenuSize `json:"size"` - Selected bool `json:"selected"` - Name string `json:"name"` - ChatBarText string `json:"chatBarText"` - Areas []AreaDetail `json:"areas"` - }{ - Size: call.richMenu.Size, - Selected: call.richMenu.Selected, - Name: call.richMenu.Name, - ChatBarText: call.richMenu.ChatBarText, - Areas: call.richMenu.Areas, - }) -} - -// Do method -func (call *CreateRichMenuCall) Do() (*RichMenuIDResponse, error) { - var buf bytes.Buffer - if err := call.encodeJSON(&buf); err != nil { - return nil, err - } - res, err := call.c.post(call.ctx, APIEndpointCreateRichMenu, &buf) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToRichMenuIDResponse(res) -} - -// DeleteRichMenu method -func (client *Client) DeleteRichMenu(richMenuID string) *DeleteRichMenuCall { - return &DeleteRichMenuCall{ - c: client, - richMenuID: richMenuID, - } -} - -// DeleteRichMenuCall type -type DeleteRichMenuCall struct { - c *Client - ctx context.Context - - richMenuID string -} - -// WithContext method -func (call *DeleteRichMenuCall) WithContext(ctx context.Context) *DeleteRichMenuCall { - call.ctx = ctx - return call -} - -// Do method -func (call *DeleteRichMenuCall) Do() (*BasicResponse, error) { - endpoint := fmt.Sprintf(APIEndpointDeleteRichMenu, call.richMenuID) - res, err := call.c.delete(call.ctx, endpoint) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// LinkUserRichMenu method -func (client *Client) LinkUserRichMenu(userID, richMenuID string) *LinkUserRichMenuCall { - return &LinkUserRichMenuCall{ - c: client, - userID: userID, - richMenuID: richMenuID, - } -} - -// LinkUserRichMenuCall type -type LinkUserRichMenuCall struct { - c *Client - ctx context.Context - - userID string - richMenuID string -} - -// WithContext method -func (call *LinkUserRichMenuCall) WithContext(ctx context.Context) *LinkUserRichMenuCall { - call.ctx = ctx - return call -} - -// Do method -func (call *LinkUserRichMenuCall) Do() (*BasicResponse, error) { - endpoint := fmt.Sprintf(APIEndpointLinkUserRichMenu, call.userID, call.richMenuID) - res, err := call.c.post(call.ctx, endpoint, nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// UnlinkUserRichMenu method -func (client *Client) UnlinkUserRichMenu(userID string) *UnlinkUserRichMenuCall { - return &UnlinkUserRichMenuCall{ - c: client, - userID: userID, - } -} - -// UnlinkUserRichMenuCall type -type UnlinkUserRichMenuCall struct { - c *Client - ctx context.Context - - userID string -} - -// WithContext method -func (call *UnlinkUserRichMenuCall) WithContext(ctx context.Context) *UnlinkUserRichMenuCall { - call.ctx = ctx - return call -} - -// Do method -func (call *UnlinkUserRichMenuCall) Do() (*BasicResponse, error) { - endpoint := fmt.Sprintf(APIEndpointUnlinkUserRichMenu, call.userID) - res, err := call.c.delete(call.ctx, endpoint) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// SetDefaultRichMenu method -func (client *Client) SetDefaultRichMenu(richMenuID string) *SetDefaultRichMenuCall { - return &SetDefaultRichMenuCall{ - c: client, - richMenuID: richMenuID, - } -} - -// SetDefaultRichMenuCall type -type SetDefaultRichMenuCall struct { - c *Client - ctx context.Context - - richMenuID string -} - -// WithContext method -func (call *SetDefaultRichMenuCall) WithContext(ctx context.Context) *SetDefaultRichMenuCall { - call.ctx = ctx - return call -} - -// Do method -func (call *SetDefaultRichMenuCall) Do() (*BasicResponse, error) { - endpoint := fmt.Sprintf(APIEndpointSetDefaultRichMenu, call.richMenuID) - res, err := call.c.post(call.ctx, endpoint, nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// CancelDefaultRichMenu method -func (client *Client) CancelDefaultRichMenu() *CancelDefaultRichMenuCall { - return &CancelDefaultRichMenuCall{ - c: client, - } -} - -// CancelDefaultRichMenuCall type -type CancelDefaultRichMenuCall struct { - c *Client - ctx context.Context -} - -// WithContext method -func (call *CancelDefaultRichMenuCall) WithContext(ctx context.Context) *CancelDefaultRichMenuCall { - call.ctx = ctx - return call -} - -// Do method -func (call *CancelDefaultRichMenuCall) Do() (*BasicResponse, error) { - res, err := call.c.delete(call.ctx, APIEndpointDefaultRichMenu) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// GetDefaultRichMenu method -func (client *Client) GetDefaultRichMenu() *GetDefaultRichMenuCall { - return &GetDefaultRichMenuCall{ - c: client, - } -} - -// GetDefaultRichMenuCall type -type GetDefaultRichMenuCall struct { - c *Client - ctx context.Context -} - -// WithContext method -func (call *GetDefaultRichMenuCall) WithContext(ctx context.Context) *GetDefaultRichMenuCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetDefaultRichMenuCall) Do() (*RichMenuIDResponse, error) { - res, err := call.c.get(call.ctx, call.c.endpointBase, APIEndpointDefaultRichMenu, nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToRichMenuIDResponse(res) -} - -// GetRichMenuList method -func (client *Client) GetRichMenuList() *GetRichMenuListCall { - return &GetRichMenuListCall{ - c: client, - } -} - -// GetRichMenuListCall type -type GetRichMenuListCall struct { - c *Client - ctx context.Context -} - -// WithContext method -func (call *GetRichMenuListCall) WithContext(ctx context.Context) *GetRichMenuListCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetRichMenuListCall) Do() ([]*RichMenuResponse, error) { - res, err := call.c.get(call.ctx, call.c.endpointBase, APIEndpointListRichMenu, nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToRichMenuListResponse(res) -} - -// DownloadRichMenuImage method -func (client *Client) DownloadRichMenuImage(richMenuID string) *DownloadRichMenuImageCall { - return &DownloadRichMenuImageCall{ - c: client, - richMenuID: richMenuID, - } -} - -// DownloadRichMenuImageCall type -type DownloadRichMenuImageCall struct { - c *Client - ctx context.Context - - richMenuID string -} - -// WithContext method -func (call *DownloadRichMenuImageCall) WithContext(ctx context.Context) *DownloadRichMenuImageCall { - call.ctx = ctx - return call -} - -// Do method -func (call *DownloadRichMenuImageCall) Do() (*MessageContentResponse, error) { - endpoint := fmt.Sprintf(APIEndpointDownloadRichMenuImage, call.richMenuID) - res, err := call.c.get(call.ctx, call.c.endpointBaseData, endpoint, nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToMessageContentResponse(res) -} - -// UploadRichMenuImage method -func (client *Client) UploadRichMenuImage(richMenuID, imgPath string) *UploadRichMenuImageCall { - return &UploadRichMenuImageCall{ - c: client, - richMenuID: richMenuID, - imgPath: imgPath, - } -} - -// UploadRichMenuImageCall type -type UploadRichMenuImageCall struct { - c *Client - ctx context.Context - - richMenuID string - imgPath string -} - -// WithContext method -func (call *UploadRichMenuImageCall) WithContext(ctx context.Context) *UploadRichMenuImageCall { - call.ctx = ctx - return call -} - -// Do method -func (call *UploadRichMenuImageCall) Do() (*BasicResponse, error) { - body, err := os.Open(call.imgPath) - if err != nil { - return nil, err - } - defer body.Close() - fi, err := body.Stat() - if err != nil { - return nil, err - } - buf := make([]byte, 512) - n, err := body.Read(buf) // n, in case the file size < 512 - if err != nil && err != io.EOF { - return nil, err - } - body.Seek(0, 0) - endpoint := fmt.Sprintf(APIEndpointUploadRichMenuImage, call.richMenuID) - req, err := http.NewRequest("POST", call.c.url(call.c.endpointBaseData, endpoint), body) - if err != nil { - return nil, err - } - req.Header.Set("Content-Type", http.DetectContentType(buf[:n])) - req.ContentLength = fi.Size() - res, err := call.c.do(call.ctx, req) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// BulkLinkRichMenu method -func (client *Client) BulkLinkRichMenu(richMenuID string, userIDs ...string) *BulkLinkRichMenuCall { - return &BulkLinkRichMenuCall{ - c: client, - userIDs: userIDs, - richMenuID: richMenuID, - } -} - -// BulkLinkRichMenuCall type -type BulkLinkRichMenuCall struct { - c *Client - ctx context.Context - - userIDs []string - richMenuID string -} - -// WithContext method -func (call *BulkLinkRichMenuCall) WithContext(ctx context.Context) *BulkLinkRichMenuCall { - call.ctx = ctx - return call -} - -func (call *BulkLinkRichMenuCall) encodeJSON(w io.Writer) error { - enc := json.NewEncoder(w) - return enc.Encode(&struct { - RichMenuID string `json:"richMenuId"` - UserIDs []string `json:"userIds"` - }{ - RichMenuID: call.richMenuID, - UserIDs: call.userIDs, - }) -} - -// Do method -func (call *BulkLinkRichMenuCall) Do() (*BasicResponse, error) { - var buf bytes.Buffer - if err := call.encodeJSON(&buf); err != nil { - return nil, err - } - res, err := call.c.post(call.ctx, APIEndpointBulkLinkRichMenu, &buf) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// BulkUnlinkRichMenu method -func (client *Client) BulkUnlinkRichMenu(userIDs ...string) *BulkUnlinkRichMenuCall { - return &BulkUnlinkRichMenuCall{ - c: client, - userIDs: userIDs, - } -} - -// BulkUnlinkRichMenuCall type -type BulkUnlinkRichMenuCall struct { - c *Client - ctx context.Context - - userIDs []string -} - -// WithContext method -func (call *BulkUnlinkRichMenuCall) WithContext(ctx context.Context) *BulkUnlinkRichMenuCall { - call.ctx = ctx - return call -} - -func (call *BulkUnlinkRichMenuCall) encodeJSON(w io.Writer) error { - enc := json.NewEncoder(w) - return enc.Encode(&struct { - UserIDs []string `json:"userIds"` - }{ - UserIDs: call.userIDs, - }) -} - -// Do method -func (call *BulkUnlinkRichMenuCall) Do() (*BasicResponse, error) { - var buf bytes.Buffer - if err := call.encodeJSON(&buf); err != nil { - return nil, err - } - res, err := call.c.post(call.ctx, APIEndpointBulkUnlinkRichMenu, &buf) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// CreateRichMenuAlias method -func (client *Client) CreateRichMenuAlias(richMenuAliasID, richMenuID string) *CreateRichMenuAliasCall { - return &CreateRichMenuAliasCall{ - c: client, - richMenuAliasID: richMenuAliasID, - richMenuID: richMenuID, - } -} - -// CreateRichMenuAliasCall type -type CreateRichMenuAliasCall struct { - c *Client - ctx context.Context - - richMenuAliasID string - richMenuID string -} - -// WithContext method -func (call *CreateRichMenuAliasCall) WithContext(ctx context.Context) *CreateRichMenuAliasCall { - call.ctx = ctx - return call -} - -func (call *CreateRichMenuAliasCall) encodeJSON(w io.Writer) error { - enc := json.NewEncoder(w) - return enc.Encode(&struct { - RichMenuAliasID string `json:"richMenuAliasId"` - RichMenuID string `json:"richMenuId"` - }{ - RichMenuAliasID: call.richMenuAliasID, - RichMenuID: call.richMenuID, - }) -} - -// Do method -func (call *CreateRichMenuAliasCall) Do() (*BasicResponse, error) { - var buf bytes.Buffer - if err := call.encodeJSON(&buf); err != nil { - return nil, err - } - res, err := call.c.post(call.ctx, APIEndpointCreateRichMenuAlias, &buf) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// UpdateRichMenuAlias method -func (client *Client) UpdateRichMenuAlias(richMenuAliasID, richMenuID string) *UpdateRichMenuAliasCall { - return &UpdateRichMenuAliasCall{ - c: client, - richMenuAliasID: richMenuAliasID, - richMenuID: richMenuID, - } -} - -// UpdateRichMenuAliasCall type -type UpdateRichMenuAliasCall struct { - c *Client - ctx context.Context - - richMenuAliasID string - richMenuID string -} - -// WithContext method -func (call *UpdateRichMenuAliasCall) WithContext(ctx context.Context) *UpdateRichMenuAliasCall { - call.ctx = ctx - return call -} - -func (call *UpdateRichMenuAliasCall) encodeJSON(w io.Writer) error { - enc := json.NewEncoder(w) - return enc.Encode(&struct { - RichMenuID string `json:"richMenuId"` - }{ - RichMenuID: call.richMenuID, - }) -} - -// Do method -func (call *UpdateRichMenuAliasCall) Do() (*BasicResponse, error) { - var buf bytes.Buffer - if err := call.encodeJSON(&buf); err != nil { - return nil, err - } - endpoint := fmt.Sprintf(APIEndpointUpdateRichMenuAlias, call.richMenuAliasID) - res, err := call.c.post(call.ctx, endpoint, &buf) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// DeleteRichMenuAlias method -func (client *Client) DeleteRichMenuAlias(richMenuAliasID string) *DeleteRichMenuAliasCall { - return &DeleteRichMenuAliasCall{ - c: client, - richMenuAliasID: richMenuAliasID, - } -} - -// DeleteRichMenuAliasCall type -type DeleteRichMenuAliasCall struct { - c *Client - ctx context.Context - - richMenuAliasID string -} - -// WithContext method -func (call *DeleteRichMenuAliasCall) WithContext(ctx context.Context) *DeleteRichMenuAliasCall { - call.ctx = ctx - return call -} - -// Do method -func (call *DeleteRichMenuAliasCall) Do() (*BasicResponse, error) { - endpoint := fmt.Sprintf(APIEndpointDeleteRichMenuAlias, call.richMenuAliasID) - res, err := call.c.delete(call.ctx, endpoint) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// GetRichMenuAlias method -func (client *Client) GetRichMenuAlias(richMenuAliasID string) *GetRichMenuAliasCall { - return &GetRichMenuAliasCall{ - c: client, - richMenuAliasID: richMenuAliasID, - } -} - -// GetRichMenuAliasCall type -type GetRichMenuAliasCall struct { - c *Client - ctx context.Context - - richMenuAliasID string -} - -// WithContext method -func (call *GetRichMenuAliasCall) WithContext(ctx context.Context) *GetRichMenuAliasCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetRichMenuAliasCall) Do() (*RichMenuAliasResponse, error) { - endpoint := fmt.Sprintf(APIEndpointGetRichMenuAlias, call.richMenuAliasID) - res, err := call.c.get(call.ctx, call.c.endpointBase, endpoint, nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToRichMenuAliasResponse(res) -} - -// GetRichMenuAliasList method -func (client *Client) GetRichMenuAliasList() *GetRichMenuAliasListCall { - return &GetRichMenuAliasListCall{ - c: client, - } -} - -// GetRichMenuAliasListCall type -type GetRichMenuAliasListCall struct { - c *Client - ctx context.Context -} - -// WithContext method -func (call *GetRichMenuAliasListCall) WithContext(ctx context.Context) *GetRichMenuAliasListCall { - call.ctx = ctx - return call -} - -// Do method -func (call *GetRichMenuAliasListCall) Do() ([]*RichMenuAliasResponse, error) { - res, err := call.c.get(call.ctx, call.c.endpointBase, APIEndpointListRichMenuAlias, nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToRichMenuAliasListResponse(res) -} - -// ValidateRichMenuObject method -func (client *Client) ValidateRichMenuObject(richMenu RichMenu) *ValidateRichMenuObjectCall { - return &ValidateRichMenuObjectCall{ - c: client, - richMenu: richMenu, - } -} - -// ValidateRichMenuObjectCall type -type ValidateRichMenuObjectCall struct { - c *Client - ctx context.Context - - richMenu RichMenu -} - -// WithContext method -func (call *ValidateRichMenuObjectCall) WithContext(ctx context.Context) *ValidateRichMenuObjectCall { - call.ctx = ctx - return call -} - -func (call *ValidateRichMenuObjectCall) encodeJSON(w io.Writer) error { - enc := json.NewEncoder(w) - return enc.Encode(&struct { - Size RichMenuSize `json:"size"` - Selected bool `json:"selected"` - Name string `json:"name"` - ChatBarText string `json:"chatBarText"` - Areas []AreaDetail `json:"areas"` - }{ - Size: call.richMenu.Size, - Selected: call.richMenu.Selected, - Name: call.richMenu.Name, - ChatBarText: call.richMenu.ChatBarText, - Areas: call.richMenu.Areas, - }) -} - -// Do method -func (call *ValidateRichMenuObjectCall) Do() (*BasicResponse, error) { - var buf bytes.Buffer - if err := call.encodeJSON(&buf); err != nil { - return nil, err - } - res, err := call.c.post(call.ctx, APIEndpointValidateRichMenuObject, &buf) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/send_message.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/send_message.go deleted file mode 100644 index e72183281..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/send_message.go +++ /dev/null @@ -1,357 +0,0 @@ -// Copyright 2016 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "bytes" - "context" - "encoding/json" - "io" -) - -// PushMessage method -func (client *Client) PushMessage(to string, messages ...SendingMessage) *PushMessageCall { - return &PushMessageCall{ - c: client, - to: to, - messages: messages, - notificationDisabled: false, - } -} - -// PushMessageCall type -type PushMessageCall struct { - c *Client - ctx context.Context - - to string - messages []SendingMessage - notificationDisabled bool -} - -// WithContext method -func (call *PushMessageCall) WithContext(ctx context.Context) *PushMessageCall { - call.ctx = ctx - return call -} - -// WithNotificationDisabled method will disable push notification -func (call *PushMessageCall) WithNotificationDisabled() *PushMessageCall { - call.notificationDisabled = true - return call -} - -// WithRetryKey method will set retry key string (UUID) on PushMessage. -func (call *PushMessageCall) WithRetryKey(retryKey string) *PushMessageCall { - call.c.setRetryKey(retryKey) - return call -} - -func (call *PushMessageCall) encodeJSON(w io.Writer) error { - enc := json.NewEncoder(w) - return enc.Encode(&struct { - To string `json:"to"` - Messages []SendingMessage `json:"messages"` - NotificationDisabled bool `json:"notificationDisabled,omitempty"` - }{ - To: call.to, - Messages: call.messages, - NotificationDisabled: call.notificationDisabled, - }) -} - -// Do method -func (call *PushMessageCall) Do() (*BasicResponse, error) { - var buf bytes.Buffer - if err := call.encodeJSON(&buf); err != nil { - return nil, err - } - res, err := call.c.post(call.ctx, APIEndpointPushMessage, &buf) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// ReplyMessage method -func (client *Client) ReplyMessage(replyToken string, messages ...SendingMessage) *ReplyMessageCall { - return &ReplyMessageCall{ - c: client, - replyToken: replyToken, - messages: messages, - notificationDisabled: false, - } -} - -// ReplyMessageCall type -type ReplyMessageCall struct { - c *Client - ctx context.Context - - replyToken string - messages []SendingMessage - notificationDisabled bool -} - -// WithContext method -func (call *ReplyMessageCall) WithContext(ctx context.Context) *ReplyMessageCall { - call.ctx = ctx - return call -} - -// WithNotificationDisabled method will disable push notification -func (call *ReplyMessageCall) WithNotificationDisabled() *ReplyMessageCall { - call.notificationDisabled = true - return call -} - -func (call *ReplyMessageCall) encodeJSON(w io.Writer) error { - enc := json.NewEncoder(w) - return enc.Encode(&struct { - ReplyToken string `json:"replyToken"` - Messages []SendingMessage `json:"messages"` - NotificationDisabled bool `json:"notificationDisabled,omitempty"` - }{ - ReplyToken: call.replyToken, - Messages: call.messages, - NotificationDisabled: call.notificationDisabled, - }) -} - -// Do method -func (call *ReplyMessageCall) Do() (*BasicResponse, error) { - var buf bytes.Buffer - if err := call.encodeJSON(&buf); err != nil { - return nil, err - } - res, err := call.c.post(call.ctx, APIEndpointReplyMessage, &buf) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// Multicast method -func (client *Client) Multicast(to []string, messages ...SendingMessage) *MulticastCall { - return &MulticastCall{ - c: client, - to: to, - messages: messages, - notificationDisabled: false, - } -} - -// MulticastCall type -type MulticastCall struct { - c *Client - ctx context.Context - - to []string - messages []SendingMessage - notificationDisabled bool -} - -// WithContext method -func (call *MulticastCall) WithContext(ctx context.Context) *MulticastCall { - call.ctx = ctx - return call -} - -// WithNotificationDisabled method will disable push notification -func (call *MulticastCall) WithNotificationDisabled() *MulticastCall { - call.notificationDisabled = true - return call -} - -// WithRetryKey method will set retry key string (UUID) on Multicast. -func (call *MulticastCall) WithRetryKey(retryKey string) *MulticastCall { - call.c.setRetryKey(retryKey) - return call -} - -func (call *MulticastCall) encodeJSON(w io.Writer) error { - enc := json.NewEncoder(w) - return enc.Encode(&struct { - To []string `json:"to"` - Messages []SendingMessage `json:"messages"` - NotificationDisabled bool `json:"notificationDisabled,omitempty"` - }{ - To: call.to, - Messages: call.messages, - NotificationDisabled: call.notificationDisabled, - }) -} - -// Do method -func (call *MulticastCall) Do() (*BasicResponse, error) { - var buf bytes.Buffer - if err := call.encodeJSON(&buf); err != nil { - return nil, err - } - res, err := call.c.post(call.ctx, APIEndpointMulticast, &buf) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// BroadcastMessage method -func (client *Client) BroadcastMessage(messages ...SendingMessage) *BroadcastMessageCall { - return &BroadcastMessageCall{ - c: client, - messages: messages, - } -} - -// BroadcastMessageCall type -type BroadcastMessageCall struct { - c *Client - ctx context.Context - - messages []SendingMessage -} - -// WithContext method -func (call *BroadcastMessageCall) WithContext(ctx context.Context) *BroadcastMessageCall { - call.ctx = ctx - return call -} - -// WithRetryKey method will set retry key string (UUID) on BroadcastMessage. -func (call *BroadcastMessageCall) WithRetryKey(retryKey string) *BroadcastMessageCall { - call.c.setRetryKey(retryKey) - return call -} - -func (call *BroadcastMessageCall) encodeJSON(w io.Writer) error { - enc := json.NewEncoder(w) - return enc.Encode(&struct { - Messages []SendingMessage `json:"messages"` - }{ - Messages: call.messages, - }) -} - -// Do method -func (call *BroadcastMessageCall) Do() (*BasicResponse, error) { - var buf bytes.Buffer - if err := call.encodeJSON(&buf); err != nil { - return nil, err - } - res, err := call.c.post(call.ctx, APIEndpointBroadcastMessage, &buf) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// Narrowcast method -func (client *Client) Narrowcast(messages ...SendingMessage) *NarrowcastCall { - return &NarrowcastCall{ - c: client, - messages: messages, - } -} - -// NarrowcastCall type -type NarrowcastCall struct { - c *Client - ctx context.Context - - messages []SendingMessage - recipient Recipient - filter *Filter - limit *NarrowcastMessageLimit -} - -// Filter type -type Filter struct { - Demographic DemographicFilter `json:"demographic"` -} - -// NarrowcastMessageLimit type -type NarrowcastMessageLimit struct { - Max int `json:"max"` - UpToRemainingQuota bool `json:"upToRemainingQuota,omitempty"` -} - -// WithContext method -func (call *NarrowcastCall) WithContext(ctx context.Context) *NarrowcastCall { - call.ctx = ctx - return call -} - -// WithRecipient method will send to specific recipient objects -func (call *NarrowcastCall) WithRecipient(recipient Recipient) *NarrowcastCall { - call.recipient = recipient - return call -} - -// WithDemographic method will send to specific recipients filter by demographic -func (call *NarrowcastCall) WithDemographic(demographic DemographicFilter) *NarrowcastCall { - call.filter = &Filter{Demographic: demographic} - return call -} - -// WithLimitMax method will set maximum number of recipients -func (call *NarrowcastCall) WithLimitMax(max int) *NarrowcastCall { - call.limit = &NarrowcastMessageLimit{Max: max} - return call -} - -// WithLimitMaxUpToRemainingQuota method will set maximum number of recipients but not over remaining quota. -func (call *NarrowcastCall) WithLimitMaxUpToRemainingQuota(max int, upToRemainingQuota bool) *NarrowcastCall { - call.limit = &NarrowcastMessageLimit{Max: max, UpToRemainingQuota: upToRemainingQuota} - return call -} - -// WithRetryKey method will set retry key string (UUID) on narrowcast. -func (call *NarrowcastCall) WithRetryKey(retryKey string) *NarrowcastCall { - call.c.setRetryKey(retryKey) - return call -} - -func (call *NarrowcastCall) encodeJSON(w io.Writer) error { - enc := json.NewEncoder(w) - return enc.Encode(&struct { - Messages []SendingMessage `json:"messages"` - Recipient Recipient `json:"recipient,omitempty"` - Filter *Filter `json:"filter,omitempty"` - Limit *NarrowcastMessageLimit `json:"limit,omitempty"` - }{ - Messages: call.messages, - Recipient: call.recipient, - Filter: call.filter, - Limit: call.limit, - }) -} - -// Do method -func (call *NarrowcastCall) Do() (*BasicResponse, error) { - var buf bytes.Buffer - if err := call.encodeJSON(&buf); err != nil { - return nil, err - } - res, err := call.c.post(call.ctx, APIEndpointNarrowcast, &buf) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/sender.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/sender.go deleted file mode 100644 index a50f58a0a..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/sender.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2020 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "encoding/json" -) - -// Sender type -type Sender struct { - Name string - IconURL string -} - -// MarshalJSON method of QuickReplyButton -func (s *Sender) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Name string `json:"name,omitempty"` - IconURL string `json:"iconUrl,omitempty"` - }{ - Name: s.Name, - IconURL: s.IconURL, - }) -} - -// NewSender function -func NewSender(name, iconURL string) *Sender { - return &Sender{ - Name: name, - IconURL: iconURL, - } -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/template.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/template.go deleted file mode 100644 index 326b8bf26..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/template.go +++ /dev/null @@ -1,261 +0,0 @@ -// Copyright 2016 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "encoding/json" -) - -// TemplateType type -type TemplateType string - -// TemplateType constants -const ( - TemplateTypeButtons TemplateType = "buttons" - TemplateTypeConfirm TemplateType = "confirm" - TemplateTypeCarousel TemplateType = "carousel" - TemplateTypeImageCarousel TemplateType = "image_carousel" -) - -// ImageAspectRatioType type -type ImageAspectRatioType string - -// ImageAspectRatioType constants -const ( - ImageAspectRatioTypeRectangle ImageAspectRatioType = "rectangle" - ImageAspectRatioTypeSquare ImageAspectRatioType = "square" -) - -// ImageSizeType type -type ImageSizeType string - -// ImageSizeType constants -const ( - ImageSizeTypeCover ImageSizeType = "cover" - ImageSizeTypeContain ImageSizeType = "contain" -) - -// Template interface -type Template interface { - json.Marshaler - Template() -} - -// ButtonsTemplate type -type ButtonsTemplate struct { - ThumbnailImageURL string - ImageAspectRatio ImageAspectRatioType - ImageSize ImageSizeType - ImageBackgroundColor string - Title string - Text string - Actions []TemplateAction - DefaultAction TemplateAction -} - -// MarshalJSON method of ButtonsTemplate -func (t *ButtonsTemplate) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type TemplateType `json:"type"` - ThumbnailImageURL string `json:"thumbnailImageUrl,omitempty"` - ImageAspectRatio ImageAspectRatioType `json:"imageAspectRatio,omitempty"` - ImageSize ImageSizeType `json:"imageSize,omitempty"` - ImageBackgroundColor string `json:"imageBackgroundColor,omitempty"` - Title string `json:"title,omitempty"` - Text string `json:"text"` - Actions []TemplateAction `json:"actions"` - DefaultAction TemplateAction `json:"defaultAction,omitempty"` - }{ - Type: TemplateTypeButtons, - ThumbnailImageURL: t.ThumbnailImageURL, - ImageAspectRatio: t.ImageAspectRatio, - ImageSize: t.ImageSize, - ImageBackgroundColor: t.ImageBackgroundColor, - Title: t.Title, - Text: t.Text, - Actions: t.Actions, - DefaultAction: t.DefaultAction, - }) -} - -// WithImageOptions method, ButtonsTemplate can set imageAspectRatio, imageSize and imageBackgroundColor -func (t *ButtonsTemplate) WithImageOptions(imageAspectRatio ImageAspectRatioType, imageSize ImageSizeType, imageBackgroundColor string) *ButtonsTemplate { - t.ImageAspectRatio = imageAspectRatio - t.ImageSize = imageSize - t.ImageBackgroundColor = imageBackgroundColor - return t -} - -// WithDefaultAction method, ButtonsTemplate can set defaultAction -func (t *ButtonsTemplate) WithDefaultAction(defaultAction TemplateAction) *ButtonsTemplate { - t.DefaultAction = defaultAction - return t -} - -// ConfirmTemplate type -type ConfirmTemplate struct { - Text string - Actions []TemplateAction -} - -// MarshalJSON method of ConfirmTemplate -func (t *ConfirmTemplate) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type TemplateType `json:"type"` - Text string `json:"text"` - Actions []TemplateAction `json:"actions"` - }{ - Type: TemplateTypeConfirm, - Text: t.Text, - Actions: t.Actions, - }) -} - -// CarouselTemplate type -type CarouselTemplate struct { - Columns []*CarouselColumn - ImageAspectRatio ImageAspectRatioType - ImageSize ImageSizeType -} - -// CarouselColumn type -type CarouselColumn struct { - ThumbnailImageURL string `json:"thumbnailImageUrl,omitempty"` - ImageBackgroundColor string `json:"imageBackgroundColor,omitempty"` - Title string `json:"title,omitempty"` - Text string `json:"text"` - Actions []TemplateAction `json:"actions"` - DefaultAction TemplateAction `json:"defaultAction,omitempty"` -} - -// MarshalJSON method of CarouselTemplate -func (t *CarouselTemplate) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type TemplateType `json:"type"` - Columns []*CarouselColumn `json:"columns"` - ImageAspectRatio ImageAspectRatioType `json:"imageAspectRatio,omitempty"` - ImageSize ImageSizeType `json:"imageSize,omitempty"` - }{ - Type: TemplateTypeCarousel, - Columns: t.Columns, - ImageAspectRatio: t.ImageAspectRatio, - ImageSize: t.ImageSize, - }) -} - -// WithImageOptions method, CarouselTemplate can set imageAspectRatio and imageSize -func (t *CarouselTemplate) WithImageOptions(imageAspectRatio ImageAspectRatioType, imageSize ImageSizeType) *CarouselTemplate { - t.ImageAspectRatio = imageAspectRatio - t.ImageSize = imageSize - return t -} - -// WithImageOptions method, CarouselColumn can set imageBackgroundColor -func (t *CarouselColumn) WithImageOptions(imageBackgroundColor string) *CarouselColumn { - t.ImageBackgroundColor = imageBackgroundColor - return t -} - -// WithDefaultAction method, CarouselColumn can set defaultAction -func (t *CarouselColumn) WithDefaultAction(defaultAction TemplateAction) *CarouselColumn { - t.DefaultAction = defaultAction - return t -} - -// ImageCarouselTemplate type -type ImageCarouselTemplate struct { - Columns []*ImageCarouselColumn -} - -// ImageCarouselColumn type -type ImageCarouselColumn struct { - ImageURL string `json:"imageUrl"` - Action TemplateAction `json:"action"` -} - -// MarshalJSON method of ImageCarouselTemplate -func (t *ImageCarouselTemplate) MarshalJSON() ([]byte, error) { - return json.Marshal(&struct { - Type TemplateType `json:"type"` - Columns []*ImageCarouselColumn `json:"columns"` - }{ - Type: TemplateTypeImageCarousel, - Columns: t.Columns, - }) -} - -// Template implements Template interface -func (*ConfirmTemplate) Template() {} - -// Template implements Template interface -func (*ButtonsTemplate) Template() {} - -// Template implements Template interface -func (*CarouselTemplate) Template() {} - -// Template implements Template interface -func (*ImageCarouselTemplate) Template() {} - -// NewConfirmTemplate function -func NewConfirmTemplate(text string, left, right TemplateAction) *ConfirmTemplate { - return &ConfirmTemplate{ - Text: text, - Actions: []TemplateAction{left, right}, - } -} - -// NewButtonsTemplate function -// `thumbnailImageURL` and `title` are optional. they can be empty. -func NewButtonsTemplate(thumbnailImageURL, title, text string, actions ...TemplateAction) *ButtonsTemplate { - return &ButtonsTemplate{ - ThumbnailImageURL: thumbnailImageURL, - Title: title, - Text: text, - Actions: actions, - } -} - -// NewCarouselTemplate function -func NewCarouselTemplate(columns ...*CarouselColumn) *CarouselTemplate { - return &CarouselTemplate{ - Columns: columns, - } -} - -// NewCarouselColumn function -// `thumbnailImageURL` and `title` are optional. they can be empty. -func NewCarouselColumn(thumbnailImageURL, title, text string, actions ...TemplateAction) *CarouselColumn { - return &CarouselColumn{ - ThumbnailImageURL: thumbnailImageURL, - Title: title, - Text: text, - Actions: actions, - } -} - -// NewImageCarouselTemplate function -func NewImageCarouselTemplate(columns ...*ImageCarouselColumn) *ImageCarouselTemplate { - return &ImageCarouselTemplate{ - Columns: columns, - } -} - -// NewImageCarouselColumn function -func NewImageCarouselColumn(imageURL string, action TemplateAction) *ImageCarouselColumn { - return &ImageCarouselColumn{ - ImageURL: imageURL, - Action: action, - } -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/validate_message.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/validate_message.go deleted file mode 100644 index a19585228..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/validate_message.go +++ /dev/null @@ -1,247 +0,0 @@ -// Copyright 2022 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "bytes" - "context" - "encoding/json" - "io" -) - -// ValidatePushMessage method -func (client *Client) ValidatePushMessage(messages ...SendingMessage) *ValidatePushMessageCall { - return &ValidatePushMessageCall{ - c: client, - messages: messages, - } -} - -// ValidatePushMessageCall type -type ValidatePushMessageCall struct { - c *Client - ctx context.Context - - messages []SendingMessage -} - -// WithContext method -func (call *ValidatePushMessageCall) WithContext(ctx context.Context) *ValidatePushMessageCall { - call.ctx = ctx - return call -} - -func (call *ValidatePushMessageCall) encodeJSON(w io.Writer) error { - enc := json.NewEncoder(w) - return enc.Encode(&struct { - Messages []SendingMessage `json:"messages"` - }{ - Messages: call.messages, - }) -} - -// Do method -func (call *ValidatePushMessageCall) Do() (*BasicResponse, error) { - var buf bytes.Buffer - if err := call.encodeJSON(&buf); err != nil { - return nil, err - } - res, err := call.c.post(call.ctx, APIEndpointValidatePushMessage, &buf) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// ValidateReplyMessage method -func (client *Client) ValidateReplyMessage(messages ...SendingMessage) *ValidateReplyMessageCall { - return &ValidateReplyMessageCall{ - c: client, - messages: messages, - } -} - -// ValidateReplyMessageCall type -type ValidateReplyMessageCall struct { - c *Client - ctx context.Context - - messages []SendingMessage -} - -// WithContext method -func (call *ValidateReplyMessageCall) WithContext(ctx context.Context) *ValidateReplyMessageCall { - call.ctx = ctx - return call -} - -func (call *ValidateReplyMessageCall) encodeJSON(w io.Writer) error { - enc := json.NewEncoder(w) - return enc.Encode(&struct { - Messages []SendingMessage `json:"messages"` - }{ - Messages: call.messages, - }) -} - -// Do method -func (call *ValidateReplyMessageCall) Do() (*BasicResponse, error) { - var buf bytes.Buffer - if err := call.encodeJSON(&buf); err != nil { - return nil, err - } - res, err := call.c.post(call.ctx, APIEndpointValidateReplyMessage, &buf) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// ValidateMulticastMessage method -func (client *Client) ValidateMulticastMessage(messages ...SendingMessage) *ValidateMulticastMessageCall { - return &ValidateMulticastMessageCall{ - c: client, - messages: messages, - } -} - -// ValidateMulticastMessageCall type -type ValidateMulticastMessageCall struct { - c *Client - ctx context.Context - - messages []SendingMessage -} - -// WithContext method -func (call *ValidateMulticastMessageCall) WithContext(ctx context.Context) *ValidateMulticastMessageCall { - call.ctx = ctx - return call -} - -func (call *ValidateMulticastMessageCall) encodeJSON(w io.Writer) error { - enc := json.NewEncoder(w) - return enc.Encode(&struct { - Messages []SendingMessage `json:"messages"` - }{ - Messages: call.messages, - }) -} - -// Do method -func (call *ValidateMulticastMessageCall) Do() (*BasicResponse, error) { - var buf bytes.Buffer - if err := call.encodeJSON(&buf); err != nil { - return nil, err - } - res, err := call.c.post(call.ctx, APIEndpointValidateMulticastMessage, &buf) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// ValidateBroadcastMessage method -func (client *Client) ValidateBroadcastMessage(messages ...SendingMessage) *ValidateBroadcastMessageCall { - return &ValidateBroadcastMessageCall{ - c: client, - messages: messages, - } -} - -// ValidateBroadcastMessageCall type -type ValidateBroadcastMessageCall struct { - c *Client - ctx context.Context - - messages []SendingMessage -} - -// WithContext method -func (call *ValidateBroadcastMessageCall) WithContext(ctx context.Context) *ValidateBroadcastMessageCall { - call.ctx = ctx - return call -} - -func (call *ValidateBroadcastMessageCall) encodeJSON(w io.Writer) error { - enc := json.NewEncoder(w) - return enc.Encode(&struct { - Messages []SendingMessage `json:"messages"` - }{ - Messages: call.messages, - }) -} - -// Do method -func (call *ValidateBroadcastMessageCall) Do() (*BasicResponse, error) { - var buf bytes.Buffer - if err := call.encodeJSON(&buf); err != nil { - return nil, err - } - res, err := call.c.post(call.ctx, APIEndpointValidateBroadcastMessage, &buf) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// ValidateNarrowcastMessage method -func (client *Client) ValidateNarrowcastMessage(messages ...SendingMessage) *ValidateNarrowcastMessageCall { - return &ValidateNarrowcastMessageCall{ - c: client, - messages: messages, - } -} - -// ValidateNarrowcastMessageCall type -type ValidateNarrowcastMessageCall struct { - c *Client - ctx context.Context - - messages []SendingMessage -} - -// WithContext method -func (call *ValidateNarrowcastMessageCall) WithContext(ctx context.Context) *ValidateNarrowcastMessageCall { - call.ctx = ctx - return call -} - -func (call *ValidateNarrowcastMessageCall) encodeJSON(w io.Writer) error { - enc := json.NewEncoder(w) - return enc.Encode(&struct { - Messages []SendingMessage `json:"messages"` - }{ - Messages: call.messages, - }) -} - -// Do method -func (call *ValidateNarrowcastMessageCall) Do() (*BasicResponse, error) { - var buf bytes.Buffer - if err := call.encodeJSON(&buf); err != nil { - return nil, err - } - res, err := call.c.post(call.ctx, APIEndpointValidateNarrowcastMessage, &buf) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/version.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/version.go deleted file mode 100644 index fd5e70612..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/version.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2016 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. -// -// Don't edit this file directly. This file is generated by script/tag.sh . - -package linebot - -const version = "7.18.0" diff --git a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/webhook.go b/vendor/github.com/line/line-bot-sdk-go/v7/linebot/webhook.go deleted file mode 100644 index af4abdfdb..000000000 --- a/vendor/github.com/line/line-bot-sdk-go/v7/linebot/webhook.go +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright 2016 LINE Corporation -// -// LINE Corporation licenses this file to you under the Apache License, -// version 2.0 (the "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations -// under the License. - -package linebot - -import ( - "bytes" - "context" - "crypto/hmac" - "crypto/sha256" - "encoding/base64" - "encoding/json" - "io" - "io/ioutil" - "net/http" -) - -// ParseRequest method -func (client *Client) ParseRequest(r *http.Request) ([]*Event, error) { - return ParseRequest(client.channelSecret, r) -} - -// ParseRequest func -func ParseRequest(channelSecret string, r *http.Request) ([]*Event, error) { - defer r.Body.Close() - body, err := ioutil.ReadAll(r.Body) - if err != nil { - return nil, err - } - if !validateSignature(channelSecret, r.Header.Get("X-Line-Signature"), body) { - return nil, ErrInvalidSignature - } - - request := &struct { - Events []*Event `json:"events"` - }{} - if err = json.Unmarshal(body, request); err != nil { - return nil, err - } - return request.Events, nil -} - -func validateSignature(channelSecret, signature string, body []byte) bool { - decoded, err := base64.StdEncoding.DecodeString(signature) - if err != nil { - return false - } - hash := hmac.New(sha256.New, []byte(channelSecret)) - - _, err = hash.Write(body) - if err != nil { - return false - } - - return hmac.Equal(decoded, hash.Sum(nil)) -} - -// GetWebhookInfo method -func (client *Client) GetWebhookInfo() *GetWebhookInfo { - return &GetWebhookInfo{ - c: client, - endpoint: APIEndpointGetWebhookInfo, - } -} - -// GetWebhookInfo type -type GetWebhookInfo struct { - c *Client - ctx context.Context - endpoint string -} - -// WithContext method -func (call *GetWebhookInfo) WithContext(ctx context.Context) *GetWebhookInfo { - call.ctx = ctx - return call -} - -// Do method -func (call *GetWebhookInfo) Do() (*WebhookInfoResponse, error) { - res, err := call.c.get(call.ctx, call.c.endpointBase, call.endpoint, nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToWebhookInfoResponse(res) -} - -// TestWebhook type -type TestWebhook struct { - c *Client - ctx context.Context - endpoint string -} - -// SetWebhookEndpointURLCall type -type SetWebhookEndpointURLCall struct { - c *Client - ctx context.Context - - endpoint string -} - -// SetWebhookEndpointURL method -func (client *Client) SetWebhookEndpointURL(webhookEndpoint string) *SetWebhookEndpointURLCall { - return &SetWebhookEndpointURLCall{ - c: client, - endpoint: webhookEndpoint, - } -} - -// WithContext method -func (call *SetWebhookEndpointURLCall) WithContext(ctx context.Context) *SetWebhookEndpointURLCall { - call.ctx = ctx - return call -} - -func (call *SetWebhookEndpointURLCall) encodeJSON(w io.Writer) error { - enc := json.NewEncoder(w) - return enc.Encode(&struct { - Endpoint string `json:"endpoint"` - }{ - Endpoint: call.endpoint, - }) -} - -// Do method -func (call *SetWebhookEndpointURLCall) Do() (*BasicResponse, error) { - var buf bytes.Buffer - if err := call.encodeJSON(&buf); err != nil { - return nil, err - } - res, err := call.c.put(call.ctx, APIEndpointSetWebhookEndpoint, &buf) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToBasicResponse(res) -} - -// TestWebhook method -func (client *Client) TestWebhook() *TestWebhook { - return &TestWebhook{ - c: client, - endpoint: APIEndpointTestWebhook, - } -} - -// WithContext method -func (call *TestWebhook) WithContext(ctx context.Context) *TestWebhook { - call.ctx = ctx - return call -} - -// Do method -func (call *TestWebhook) Do() (*TestWebhookResponse, error) { - res, err := call.c.get(call.ctx, call.c.endpointBase, call.endpoint, nil) - if err != nil { - return nil, err - } - defer closeResponse(res) - return decodeToTestWebhookResponse(res) -} diff --git a/vendor/modules.txt b/vendor/modules.txt deleted file mode 100644 index 6e4f8b01d..000000000 --- a/vendor/modules.txt +++ /dev/null @@ -1,3 +0,0 @@ -# github.com/line/line-bot-sdk-go/v7 v7.18.0 -## explicit; go 1.19 -github.com/line/line-bot-sdk-go/v7/linebot