diff --git a/.github/workflows/generate-clients.yml b/.github/workflows/generate-clients.yml new file mode 100644 index 00000000..9bf8b8c8 --- /dev/null +++ b/.github/workflows/generate-clients.yml @@ -0,0 +1,49 @@ +name: Generate clients from LINE OpenAPI + +on: + workflow_dispatch: + inputs: + version: + type: string + required: true + description: "Version" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - name: Update submodules + run: git submodule update --remote --recursive + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "2.7" + - run: echo "OPENAPI_GENERATOR_VERSION=6.6.0" >> $GITHUB_ENV + - run: echo "GEM_VERSION=${{ inputs.version }}" >> $GITHUB_ENV + - uses: actions/cache@v3 + id: openapi-generator-cache + env: + cache-name: openapi-generator-cache + with: + path: ~/bin/openapitools + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.OPENAPI_GENERATOR_VERSION }} + - if: steps.openapi-generator-cache.outputs.cache-hit != 'true' + run: | + mkdir -p ~/bin/openapitools + curl https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/bin/utils/openapi-generator-cli.sh > ~/bin/openapitools/openapi-generator-cli + chmod u+x ~/bin/openapitools/openapi-generator-cli + echo "~/bin/openapitools/" >> $GITHUB_PATH + - run: bin/generate-clients + - run: sed -i -r "s/[0-9]+\.[0-9]+\.[0-9]+/${{ env.GEM_VERSION }}/" lib/line/client/version.rb + - run: | + git config user.name github-actions + git config user.email github-actions@github.com + git checkout -b generate-clients-v$GEM_VERSION + git add . + git commit -m "Generate clients: v$GEM_VERSION" + git push origin generate-clients-v$GEM_VERSION + gh pr create -B ${{ github.ref_name }} --title "Generate clients: v$GEM_VERSION" --body "" --label "auto-generated code" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 0cb6eeb0..02614d19 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,15 @@ /pkg/ /spec/reports/ /tmp/ + +# OpenAPI Generator +/lib/clients/*/spec/ +/lib/clients/*/.gitlab-ci.yml +/lib/clients/*/.openapi-generator-ignore +/lib/clients/*/.rspec +/lib/clients/*/.rubocop.yml +/lib/clients/*/.travis.yml +/lib/clients/*/Gemfile +/lib/clients/*/git_push.sh +/lib/clients/*/line_client_*.gemspec +/lib/clients/*/Rakefile diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..f5edc7a3 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "line-openapi"] + path = line-openapi + url = https://github.com/line/line-openapi diff --git a/.rubocop.yml b/.rubocop.yml index 3d52540b..37573378 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,7 +1,7 @@ AllCops: - TargetRubyVersion: 2.4 + TargetRubyVersion: 2.7 Exclude: - - 'examples/**/*' + - 'lib/clients/**/*' NewCops: disable Gemspec/RequiredRubyVersion: diff --git a/Gemfile b/Gemfile index 0f92d58a..c684fb85 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,5 @@ source 'https://rubygems.org' gemspec group :development, :test do - # ref: http://docs.rubocop.org/en/latest/installation/ gem 'rubocop', '~> 1.56.0', require: false - gem 'yard', '~> 0.9.20' end diff --git a/README.md b/README.md index 2e50642f..a6022b9b 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,33 @@ # LINE Messaging API SDK for Ruby -[![Gem-version](https://img.shields.io/gem/v/line-bot-api.svg)](https://rubygems.org/gems/line-bot-api) [![Build Status](https://travis-ci.org/line/line-bot-sdk-ruby.svg?branch=master)](https://travis-ci.org/line/line-bot-sdk-ruby) +[![Gem version](https://img.shields.io/gem/v/line-bot-api.svg)](https://rubygems.org/gems/line-bot-api) [![Build status](https://github.com/line/line-bot-sdk-ruby/actions/workflows/pull_request.yml/badge.svg)](https://github.com/line/line-bot-sdk-ruby/actions/workflows/pull_request.yml) - -## Introduction -The LINE Messaging API SDK for Ruby makes it easy to develop bots using LINE Messaging API, and you can create a sample bot within minutes. +Using the LINE Messaging API SDK for Ruby, you can easily use the Messaging API and other APIs provided by the LINE Platform to build your own applications. ## Documentation -See the official API documentation for more information +For documentation on each client, such as the Messaging API, see the README in each directory: -- English: https://developers.line.biz/en/docs/messaging-api/overview/ -- Japanese: https://developers.line.biz/ja/docs/messaging-api/overview/ +- [LINE::Client::ChannelAccessToken](lib/clients/channel-access-token/README.md) +- [LINE::Client::Insight](lib/clients/insight/README.md) +- [LINE::Client::Liff](lib/clients/liff/README.md) +- [LINE::Client::ManageAudience](lib/clients/manage-audience/README.md) +- [LINE::Client::MessagingApi](lib/clients/messaging-api/README.md) +- [LINE::Client::Module](lib/clients/module/README.md) +- [LINE::Client::ModuleAttach](lib/clients/module-attach/README.md) +- [LINE::Client::Shop](lib/clients/shop/README.md) +- [LINE::Client::Webhook](lib/clients/webhook/README.md) -Also, generated documentation by YARD is available. +You can also refer to the documentation generated by YARD: - https://rubydoc.info/gems/line-bot-api +For more information on the APIs provided by the LINE Platform, see the [LINE Developers site](https://developers.line.biz/en/). + +## Requirements + +- Ruby 2.7.0 or later + ## Installation Add this line to your application's Gemfile: @@ -27,92 +38,63 @@ gem 'line-bot-api' And then execute: -```sh -bundle -``` + $ bundle install Or install it yourself as: -```sh -gem install line-bot-api -``` - -## Synopsis + $ gem install line-bot-api -Usage: +## Usage ```ruby -# app.rb -require 'sinatra' -require 'line/bot' - -def client - @client ||= Line::Bot::Client.new { |config| - config.channel_id = ENV["LINE_CHANNEL_ID"] - config.channel_secret = ENV["LINE_CHANNEL_SECRET"] - config.channel_token = ENV["LINE_CHANNEL_TOKEN"] - } +LINE::Client::MessagingApi.configure do |config| + config.access_token = 'YOUR_BEARER_TOKEN' end -post '/callback' do - body = request.body.read - - signature = request.env['HTTP_X_LINE_SIGNATURE'] - unless client.validate_signature(body, signature) - error 400 do 'Bad Request' end - end - - events = client.parse_events_from(body) - events.each do |event| - case event - when Line::Bot::Event::Message - case event.type - when Line::Bot::Event::MessageType::Text - message = { - type: 'text', - text: event.message['text'] - } - client.reply_message(event['replyToken'], message) - when Line::Bot::Event::MessageType::Image, Line::Bot::Event::MessageType::Video - response = client.get_message_content(event.message['id']) - tf = Tempfile.open("content") - tf.write(response.body) - end - end - end - - # Don't forget to return a successful response - "OK" -end +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +result = api_instance.get_webhook_endpoint +result.endpoint # "https://example.com/test" +result.active # true ``` -## Help and media -FAQ: https://developers.line.biz/en/faq/ - -Community Q&A: https://www.line-community.me/questions +For more information on how to use this library, see the [Documentation](#documentation). -News: https://developers.line.biz/en/news/ +## Related sites -Twitter: @LINE_DEV +| Site | URL | +| ------------- | ----------------------------------------------- | +| FAQ | https://developers.line.biz/en/faq/ | +| Community Q&A | https://www.line-community.me/questions | +| News | https://developers.line.biz/en/news/ | +| Twitter | [@LINE_DEV_EN](https://twitter.com/LINE_DEV_EN) | ## Versioning -This project respects semantic versioning. -See https://semver.org/ +The versioning policy for this project follows Semantic Versioning: + +- [Semantic Versioning](https://semver.org/) + +## Breaking changes + +The LINE SDK development team has decided to generate codes based on the [LINE OpenAPI](https://github.com/line/line-openapi) specification. As a result, the version 2 series of the LINE Messaging API SDK for Ruby is not compatible with the version 1 series. + +We plan to maintain only the version 2 series from now on. The 1 series can still be used, but we recommend using the 2 series to take advantage of the latest features. ## Contributing -Please check [CONTRIBUTING](CONTRIBUTING.md) before making a contribution. + +Bug reports and pull requests are welcome on GitHub at https://github.com/line/line-bot-sdk-ruby. See [CONTRIBUTING](CONTRIBUTING.md) before you make a contribution. ## License + ``` 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. diff --git a/bin/generate-clients b/bin/generate-clients new file mode 100755 index 00000000..30bae2c9 --- /dev/null +++ b/bin/generate-clients @@ -0,0 +1,31 @@ +#!/usr/bin/env ruby + +require_relative '../lib/line/client/version' + +clients = [ + 'channel-access-token', + 'insight', + 'liff', + 'manage-audience', + 'messaging-api', + 'module-attach', + 'module', + 'shop', + 'webhook' +] + +def to_pascal_case(str) + str.split('-').map(&:capitalize).join +end + +clients.each do |client| + command = "openapi-generator generate \ + -i line-openapi/#{client}.yml \ + -g ruby \ + -t src/main/resources/ruby-client \ + -o lib/clients/#{client} \ + --additional-properties=moduleName=LINE::Client::#{to_pascal_case(client)} \ + --additional-properties=gemVersion=#{ENV.fetch('GEM_VERSION')} \ + --http-user-agent LINE-BotSDK-Ruby/#{ENV.fetch('GEM_VERSION')}" + system(command, exception: true) +end diff --git a/examples/echobot/Gemfile b/examples/echobot/Gemfile index 81b0cd5b..34d662d5 100644 --- a/examples/echobot/Gemfile +++ b/examples/echobot/Gemfile @@ -1,8 +1,7 @@ # frozen_string_literal: true -source "https://rubygems.org" - -git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } +source 'https://rubygems.org' +gem 'line-bot-api', path: '../../' +gem 'puma' gem 'sinatra' -gem 'line-bot-api' diff --git a/examples/echobot/Gemfile.lock b/examples/echobot/Gemfile.lock new file mode 100644 index 00000000..8c277d50 --- /dev/null +++ b/examples/echobot/Gemfile.lock @@ -0,0 +1,40 @@ +PATH + remote: ../.. + specs: + line-bot-api (2.0.0) + typhoeus (~> 1.0, >= 1.0.1) + +GEM + remote: https://rubygems.org/ + specs: + ethon (0.16.0) + ffi (>= 1.15.0) + ffi (1.15.5) + mustermann (3.0.0) + ruby2_keywords (~> 0.0.1) + nio4r (2.5.9) + puma (6.3.1) + nio4r (~> 2.0) + rack (2.2.8) + rack-protection (3.1.0) + rack (~> 2.2, >= 2.2.4) + ruby2_keywords (0.0.5) + sinatra (3.1.0) + mustermann (~> 3.0) + rack (~> 2.2, >= 2.2.4) + rack-protection (= 3.1.0) + tilt (~> 2.0) + tilt (2.2.0) + typhoeus (1.4.0) + ethon (>= 0.9.0) + +PLATFORMS + x86_64-darwin-20 + +DEPENDENCIES + line-bot-api! + puma + sinatra + +BUNDLED WITH + 2.3.3 diff --git a/examples/echobot/README.md b/examples/echobot/README.md index 25603d27..d42ee357 100644 --- a/examples/echobot/README.md +++ b/examples/echobot/README.md @@ -1,16 +1,33 @@ # Echo Bot -An example LINE bot just to echo messages +A simple bot application that uses the LINE Messaging API SDK for Ruby to return text messages sent by a user. -## Getting started +## Usage -```ruby +```bash $ export LINE_CHANNEL_SECRET=YOUR_CHANNEL_SECRET -$ export LINE_CHANNEL_TOKEN=YOUR_CHANNEL_ACCESS_TOKEN $ bundle install $ bundle exec ruby app.rb ``` +## Contributing + +Bug reports and pull requests are welcome on GitHub at https://github.com/line/line-bot-sdk-ruby. See [CONTRIBUTING](../../CONTRIBUTING.md) before you make a contribution. + +## License + +``` +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. ``` -https://your.base.url:4567/callback -``` \ No newline at end of file diff --git a/examples/echobot/app.rb b/examples/echobot/app.rb index a87a8d5c..840cb5ae 100644 --- a/examples/echobot/app.rb +++ b/examples/echobot/app.rb @@ -1,36 +1,49 @@ -require 'sinatra' # gem 'sinatra' -require 'line/bot' # gem 'line-bot-api' +require 'sinatra' +require 'line-bot-api' + +before do + LINE::Client::MessagingApi.configure do |config| + config.access_token = ENV.fetch('LINE_CHANNEL_TOKEN') + end +end def client - @client ||= Line::Bot::Client.new { |config| - config.channel_secret = ENV["LINE_CHANNEL_SECRET"] - config.channel_token = ENV["LINE_CHANNEL_TOKEN"] - } + LINE::Client::MessagingApi::MessagingApiApi.new end post '/callback' do - body = request.body.read + body = request.body.read + signature = request.env['HTTP_X_LINE_SIGNATURE'] + channel_secret = ENV.fetch('LINE_CHANNEL_SECRET') - signature = request.env['HTTP_X_LINE_SIGNATURE'] - unless client.validate_signature(body, signature) - halt 400, {'Content-Type' => 'text/plain'}, 'Bad Request' + unless LINE::Client::Webhook.validate_signature(body, signature, channel_secret) + halt 400 end - events = client.parse_events_from(body) + events = LINE::Client::Webhook.parse_events_from(body) events.each do |event| case event - when Line::Bot::Event::Message - case event.type - when Line::Bot::Event::MessageType::Text - message = { - type: 'text', - text: event.message['text'] - } - client.reply_message(event['replyToken'], message) + when LINE::Client::Webhook::MessageEvent + case event.message['type'] + when 'text' + request = LINE::Client::MessagingApi::ReplyMessageRequest.new( + reply_token: event.reply_token, + messages: [ + { + type: 'text', + text: event.message['text'] + } + ] + ) + begin + client.reply_message(request) + rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi#reply_message: #{e}" + end end end end - "OK" + 'OK' end diff --git a/examples/kitchensink/Gemfile b/examples/kitchensink/Gemfile new file mode 100644 index 00000000..34d662d5 --- /dev/null +++ b/examples/kitchensink/Gemfile @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +source 'https://rubygems.org' + +gem 'line-bot-api', path: '../../' +gem 'puma' +gem 'sinatra' diff --git a/examples/kitchensink/Gemfile.lock b/examples/kitchensink/Gemfile.lock new file mode 100644 index 00000000..af54fb38 --- /dev/null +++ b/examples/kitchensink/Gemfile.lock @@ -0,0 +1,40 @@ +PATH + remote: ../.. + specs: + line-bot-api (2.0.0) + typhoeus (~> 1.0, >= 1.0.1) + +GEM + remote: https://rubygems.org/ + specs: + ethon (0.16.0) + ffi (>= 1.15.0) + ffi (1.16.3) + mustermann (3.0.0) + ruby2_keywords (~> 0.0.1) + nio4r (2.5.9) + puma (6.4.0) + nio4r (~> 2.0) + rack (2.2.8) + rack-protection (3.1.0) + rack (~> 2.2, >= 2.2.4) + ruby2_keywords (0.0.5) + sinatra (3.1.0) + mustermann (~> 3.0) + rack (~> 2.2, >= 2.2.4) + rack-protection (= 3.1.0) + tilt (~> 2.0) + tilt (2.3.0) + typhoeus (1.4.0) + ethon (>= 0.9.0) + +PLATFORMS + arm64-darwin-22 + +DEPENDENCIES + line-bot-api! + puma + sinatra + +BUNDLED WITH + 2.4.17 diff --git a/examples/kitchensink/README.md b/examples/kitchensink/README.md index 0edcf56b..6f83bbb7 100644 --- a/examples/kitchensink/README.md +++ b/examples/kitchensink/README.md @@ -4,7 +4,7 @@ A kitchen-sink LINE bot example ## Getting started -```ruby +```bash $ export LINE_CHANNEL_SECRET=YOUR_CHANNEL_SECRET $ export LINE_CHANNEL_TOKEN=YOUR_CHANNEL_ACCESS_TOKEN $ bundle install diff --git a/examples/kitchensink/app.rb b/examples/kitchensink/app.rb index fb381c26..091086c3 100644 --- a/examples/kitchensink/app.rb +++ b/examples/kitchensink/app.rb @@ -1,5 +1,5 @@ require 'sinatra' # gem 'sinatra' -require 'line/bot' # gem 'line-bot-api' +require 'line-bot-api' THUMBNAIL_URL = 'https://via.placeholder.com/1024x1024' HORIZONTAL_THUMBNAIL_URL = 'https://via.placeholder.com/1024x768' @@ -7,80 +7,91 @@ set :app_base_url, ENV['APP_BASE_URL'] -def client - @client ||= Line::Bot::Client.new do |config| - config.channel_id = ENV["LINE_CHANNEL_ID"] - config.channel_secret = ENV["LINE_CHANNEL_SECRET"] - config.channel_token = ENV["LINE_CHANNEL_TOKEN"] - config.http_options = { - open_timeout: 5, - read_timeout: 5, - } +before do + LINE::Client::MessagingApi.configure do |config| + config.access_token = ENV.fetch('LINE_CHANNEL_TOKEN') + end + LINE::Client::Insight.configure do |config| + config.access_token = ENV.fetch('LINE_CHANNEL_TOKEN') end end +channel_secret = ENV.fetch('LINE_CHANNEL_SECRET') + +def client + @client ||= LINE::Client::MessagingApi::MessagingApiApi.new +end + +def blob_client + @blob_client ||= LINE::Client::MessagingApi::MessagingApiBlobApi.new +end + +def insight_client + @insight_client ||= LINE::Client::Insight::InsightApi.new +end + def reply_text(event, texts) texts = [texts] if texts.is_a?(String) - client.reply_message( - event['replyToken'], - texts.map { |text| {type: 'text', text: text} } - ) + client.reply_message(LINE::Client::MessagingApi::ReplyMessageRequest.new( + reply_token: event.reply_token, + messages: texts.map { |text| {type: 'text', text: text} } + )) end def broadcast(messages) - client.broadcast(messages) + client.broadcast_with_http_info(LINE::Client::MessagingApi::BroadcastRequest.new( + messages: messages + )) end def reply_content(event, messages) - res = client.reply_message( - event['replyToken'], - messages - ) - logger.warn res.read_body unless Net::HTTPOK === res - res + client.reply_message(LINE::Client::MessagingApi::ReplyMessageRequest.new( + reply_token: event.reply_token, + messages: messages + )) end post '/callback' do body = request.body.read signature = request.env['HTTP_X_LINE_SIGNATURE'] - unless client.validate_signature(body, signature) - halt 400, {'Content-Type' => 'text/plain'}, 'Bad Request' + unless LINE::Client::Webhook.validate_signature(body, signature, channel_secret) + halt 400 end - events = client.parse_events_from(body) + events = LINE::Client::Webhook.parse_events_from(body) events.each do |event| case event - when Line::Bot::Event::Message + when LINE::Client::Webhook::MessageEvent handle_message(event) - when Line::Bot::Event::Follow + when LINE::Client::Webhook::FollowEvent reply_text(event, "[FOLLOW]\nThank you for following") - when Line::Bot::Event::Unfollow + when Line::Client::Webhook::UnfollowEvent logger.info "[UNFOLLOW]\n#{body}" - when Line::Bot::Event::Join + when Line::Client::Webhook::JoinEvent reply_text(event, "[JOIN]\n#{event['source']['type']}") - when Line::Bot::Event::Leave + when Line::Client::Webhook::LeaveEvent logger.info "[LEAVE]\n#{body}" - when Line::Bot::Event::Postback + when Line::Client::Webhook::PostbackEvent message = "[POSTBACK]\n#{event['postback']['data']} (#{JSON.generate(event['postback']['params'])})" reply_text(event, message) - when Line::Bot::Event::Beacon + when Line::Client::Webhook::BeaconEvent reply_text(event, "[BEACON]\n#{JSON.generate(event['beacon'])}") - when Line::Bot::Event::Things + when Line::Client::Webhook::ThingsEvent reply_text(event, "[THINGS]\n#{JSON.generate(event['things'])}") - when Line::Bot::Event::VideoPlayComplete + when Line::Client::Webhook::VideoPlayCompleteEvent reply_text(event, "[VIDEOPLAYCOMPLETE]\n#{JSON.generate(event['videoPlayComplete'])}") - when Line::Bot::Event::Unsend + when Line::Client::Webhook::UnsendEvent handle_unsend(event) else @@ -92,51 +103,46 @@ def reply_content(event, messages) end def handle_message(event) - case event.type - when Line::Bot::Event::MessageType::Image + logger.info "Received message: #{event.message['type']}" + + case event.message['type'] + when 'image' message_id = event.message['id'] - response = client.get_message_content(message_id) - tf = Tempfile.open("content") - tf.write(response.body) - reply_text(event, "[MessageType::IMAGE]\nid:#{message_id}\nreceived #{tf.size} bytes data") - when Line::Bot::Event::MessageType::Video + response = blob_client.get_message_content(message_id) + reply_text(event, "[MessageType::IMAGE]\nid:#{message_id}\nreceived #{response.size} bytes data") + when 'video' message_id = event.message['id'] - response = client.get_message_content(message_id) - tf = Tempfile.open("content") - tf.write(response.body) - reply_text(event, "[MessageType::VIDEO]\nid:#{message_id}\nreceived #{tf.size} bytes data") - when Line::Bot::Event::MessageType::Audio + response = blob_client.get_message_content(message_id) + reply_text(event, "[MessageType::VIDEO]\nid:#{message_id}\nreceived #{response.size} bytes data") + when 'audio' message_id = event.message['id'] - response = client.get_message_content(message_id) + response = blob_client.get_message_content(message_id) tf = Tempfile.open("content") tf.write(response.body) reply_text(event, "[MessageType::AUDIO]\nid:#{message_id}\nreceived #{tf.size} bytes data") - when Line::Bot::Event::MessageType::File + when 'file' message_id = event.message['id'] - response = client.get_message_content(message_id) - tf = Tempfile.open("content") - tf.write(response.body) - reply_text(event, "[MessageType::FILE]\nid:#{message_id}\nfileName:#{event.message['fileName']}\nfileSize:#{event.message['fileSize']}\nreceived #{tf.size} bytes data") - when Line::Bot::Event::MessageType::Sticker + response = blob_client.get_message_content(message_id) + reply_text(event, "[MessageType::FILE]\nid:#{message_id}\nfileName:#{event.message['fileName']}\nfileSize:#{event.message['fileSize']}\nreceived #{response.size} bytes data") + when 'sticker' handle_sticker(event) - when Line::Bot::Event::MessageType::Location + when 'location' handle_location(event) - when Line::Bot::Event::MessageType::Text + when 'text' case event.message['text'] when 'profile' - if event['source']['type'] == 'user' - profile = client.get_profile(event['source']['userId']) - profile = JSON.parse(profile.read_body) + if event.source['type'] == 'user' + profile = client.get_profile(event.source['user_id']) reply_text(event, [ - "Display name\n#{profile['displayName']}", - "Status message\n#{profile['statusMessage']}" + "Display name\n#{profile.display_name}", + "Status message\n#{profile.status_message}" ]) else reply_text(event, "Bot can't use profile API without user ID") end when 'emoji' - reply_content(event, { + reply_content(event, [{ type: 'text', text: 'Look at this: $ It\'s a LINE emoji!', emojis: [ @@ -146,10 +152,10 @@ def handle_message(event) emojiId: '001' } ] - }) + }]) when 'buttons' - reply_content(event, { + reply_content(event, [{ type: 'template', altText: 'Buttons alt text', template: { @@ -164,10 +170,10 @@ def handle_message(event) { label: 'Send message', type: 'message', text: 'This is message' } ] } - }) + }]) when 'confirm' - reply_content(event, { + reply_content(event, [{ type: 'template', altText: 'Confirm alt text', template: { @@ -178,10 +184,10 @@ def handle_message(event) { label: 'No', type: 'message', text: 'No!' }, ], } - }) + }]) when 'carousel' - reply_content(event, { + reply_content(event, [{ type: 'template', altText: 'Carousel alt text', template: { @@ -231,10 +237,10 @@ def handle_message(event) } ] } - }) + }]) when 'image carousel' - reply_content(event, { + reply_content(event, [{ type: 'template', altText: 'Image carousel alt text', template: { @@ -266,10 +272,10 @@ def handle_message(event) } ] } - }) + }]) when 'imagemap' - reply_content(event, { + reply_content(event, [{ type: 'imagemap', baseUrl: THUMBNAIL_URL, altText: 'Imagemap alt text', @@ -280,12 +286,12 @@ def handle_message(event) { area: { x: 0, y: 512, width: 512, height: 512 }, type: 'uri', linkUri: 'https://store.line.me/family/play/en' }, { area: { x: 512, y: 512, width: 512, height: 512 }, type: 'message', text: 'Fortune!' }, ] - }) + }]) when 'imagemap video' video_url = File.join(settings.app_base_url.to_s, 'imagemap/video.mp4') preview_url = File.join(settings.app_base_url.to_s, 'imagemap/preview.jpg') - reply_content(event, { + reply_content(event, [{ type: 'imagemap', baseUrl: THUMBNAIL_URL, altText: 'Imagemap alt text', @@ -310,10 +316,10 @@ def handle_message(event) { area: { x: 0, y: 512, width: 512, height: 512 }, type: 'uri', linkUri: 'https://store.line.me/family/play/en' }, { area: { x: 512, y: 512, width: 512, height: 512 }, type: 'message', text: 'Fortune!' }, ] - }) + }]) when 'flex' - reply_content(event, { + reply_content(event, [{ type: "flex", altText: "this is a flex message", contents: { @@ -357,10 +363,10 @@ def handle_message(event) ] } } - }) + }]) when 'flex carousel' - reply_content(event, { + reply_content(event, [{ type: "flex", altText: "this is a flex carousel", contents: { @@ -432,10 +438,10 @@ def handle_message(event) } ] } - }) + }]) when 'quickreply' - reply_content(event, { + reply_content(event, [{ type: 'text', text: '[QUICK REPLY]', quickReply: { @@ -503,61 +509,22 @@ def handle_message(event) }, ], }, - }) - - when 'flex1' - reply_content(event, { - "type": "bubble", - "size": "nano", - "hero": { - "type": "image", - "url": THUMBNAIL_URL, - "size": "full", - "aspectRatio": "4:3", - "action": { - "type": "uri", - "uri": "http://linecorp.com/" - } - }, - "body": { - "type": "box", - "layout": "vertical", - "contents": [ - { - "type": "text", - "text": "hello", - "contents": [ - { - "type": "span", - "text": "hello", - "color": "#FF0000" - }, - { - "type": "span", - "text": "world", - "color": "#0000FF" - } - ] - } - ], - "paddingAll": "10px" - }, - }) + }]) when 'bye' - case event['source']['type'] + case event.source['type'] when 'user' reply_text(event, "[BYE]\nBot can't leave from 1:1 chat") when 'group' reply_text(event, "[BYE]\nLeaving group") - client.leave_group(event['source']['groupId']) + client.leave_group(event.source['group_id']) when 'room' reply_text(event, "[BYE]\nLeaving room") - client.leave_room(event['source']['roomId']) + client.leave_room(event.source['room_id']) end when 'stats' - response = broadcast({ + data, status_code, headers = broadcast([{ type: 'template', altText: 'stats', template: { @@ -572,14 +539,15 @@ def handle_message(event) { label: 'Send message', type: 'message', text: 'This is message' } ] } - }) - request_id = response.header["X-Line-Request-Id"] + }]) + logger.info "data=#{data} status=#{status_code} headers=#{headers}" + request_id = headers["X-Line-Request-Id"] reply_text(event, "RequestId: #{request_id}") when /\Astats\s+(?.+)/ request_id = Regexp.last_match[:request_id] - stats = client.get_user_interaction_statistics(request_id) - reply_text(event, "[STATS]\n#{stats.body}") + stats = insight_client.get_message_event(request_id) + reply_text(event, "[STATS]\n#{stats}") else reply_text(event, "[ECHO]\n#{event.message['text']}") @@ -593,17 +561,20 @@ def handle_message(event) def handle_sticker(event) # Message API available stickers - # https://developers.line.me/media/messaging-api/sticker_list.pdf - msgapi_available = event.message['packageId'].to_i <= 4 + # https://developers.line.biz/en/docs/messaging-api/sticker-list/ + msgapi_available = [ + 446, 789, 1070, 6136, 6325, 6359, 6362, 6370, + 6632, 8515, 8522, 8525, 11537, 11538, 11539 + ].include?(event.message['package_id'].to_i) messages = [{ type: 'text', - text: "[STICKER]\npackageId: #{event.message['packageId']}\nstickerId: #{event.message['stickerId']}" + text: "[STICKER]\npackageId: #{event.message['package_id']}\nstickerId: #{event.message['sticker_id']}" }] if msgapi_available messages.push( type: 'sticker', - packageId: event.message['packageId'], - stickerId: event.message['stickerId'] + packageId: event.message['package_id'], + stickerId: event.message['sticker_id'] ) end reply_content(event, messages) @@ -611,13 +582,13 @@ def handle_sticker(event) def handle_location(event) message = event.message - reply_content(event, { + reply_content(event, [{ type: 'location', title: message['title'] || message['address'], address: message['address'], latitude: message['latitude'], longitude: message['longitude'] - }) + }]) end def handle_unsend(event) diff --git a/examples/kitchensink/hello.py b/examples/kitchensink/hello.py new file mode 100644 index 00000000..642bac36 --- /dev/null +++ b/examples/kitchensink/hello.py @@ -0,0 +1,7 @@ +import json + +src = """ +{P"THIS": "IS", "A": "JSON", "FILE": "!"} +""" +# decode json +data = json.loads(src) diff --git a/examples/rich_menu/Gemfile b/examples/rich_menu/Gemfile index 0c6c379d..a019a2b3 100644 --- a/examples/rich_menu/Gemfile +++ b/examples/rich_menu/Gemfile @@ -2,6 +2,4 @@ source "https://rubygems.org" -git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } - -gem 'line-bot-api' +gem 'line-bot-api', path: '../../' diff --git a/examples/rich_menu/Gemfile.lock b/examples/rich_menu/Gemfile.lock new file mode 100644 index 00000000..9e28605a --- /dev/null +++ b/examples/rich_menu/Gemfile.lock @@ -0,0 +1,23 @@ +PATH + remote: ../.. + specs: + line-bot-api (2.0.0) + typhoeus (~> 1.0, >= 1.0.1) + +GEM + remote: https://rubygems.org/ + specs: + ethon (0.16.0) + ffi (>= 1.15.0) + ffi (1.16.3) + typhoeus (1.4.0) + ethon (>= 0.9.0) + +PLATFORMS + arm64-darwin-22 + +DEPENDENCIES + line-bot-api! + +BUNDLED WITH + 2.4.17 diff --git a/examples/rich_menu/README.md b/examples/rich_menu/README.md index 5eefd387..912037b9 100644 --- a/examples/rich_menu/README.md +++ b/examples/rich_menu/README.md @@ -4,7 +4,7 @@ ## Getting started -```ruby +```bash $ export LINE_CHANNEL_SECRET=YOUR_CHANNEL_SECRET $ export LINE_CHANNEL_TOKEN=YOUR_CHANNEL_ACCESS_TOKEN $ bundle install diff --git a/examples/rich_menu/app.rb b/examples/rich_menu/app.rb index a70d7a95..a078a32f 100644 --- a/examples/rich_menu/app.rb +++ b/examples/rich_menu/app.rb @@ -1,33 +1,43 @@ -require 'line/bot' +require 'line-bot-api' + +begin + LINE::Client::MessagingApi.configure do |config| + config.access_token = ENV.fetch('LINE_CHANNEL_TOKEN') + config.debugging = true + end +end def client - @client ||= Line::Bot::Client.new { |config| - config.channel_secret = ENV["LINE_CHANNEL_SECRET"] - config.channel_token = ENV["LINE_CHANNEL_TOKEN"] - } + @client ||= LINE::Client::MessagingApi::MessagingApiApi.new +end + +def blob_client + @blob_client ||= LINE::Client::MessagingApi::MessagingApiBlobApi.new end def main # 2. Create rich menu A (richmenu-a) - create_rich_menu_response = client.create_rich_menu(rich_menu_object_a) - rich_a_menu = JSON.parse(create_rich_menu_response.body) + rich_a_menu = client.create_rich_menu(rich_menu_object_a) puts "created: #{rich_a_menu}" # => {"richMenuId"=>"richmenu-xxx"} # 3. Upload image to rich menu A - client.create_rich_menu_image(rich_a_menu['richMenuId'], File.open('./public/richmenu-a.png')) + blob_client.set_rich_menu_image(rich_a_menu.rich_menu_id, { + body: File.new('./public/richmenu-a.png') + }) # 4. Create rich menu B (richmenu-b) - create_rich_menu_response = client.create_rich_menu(rich_menu_object_b) - rich_b_menu = JSON.parse(create_rich_menu_response.body) + rich_b_menu = client.create_rich_menu(rich_menu_object_b) puts "created: #{rich_b_menu}" # => {"richMenuId"=>"richmenu-xxx"} # 5. Upload image to rich menu B - client.create_rich_menu_image(rich_b_menu['richMenuId'], File.open('./public/richmenu-b.png')) + blob_client.set_rich_menu_image(rich_b_menu.rich_menu_id, { + body: File.new('./public/richmenu-b.png') + }) # 6. Set rich menu A as the default rich menu - client.set_default_rich_menu(rich_a_menu['richMenuId']) + client.set_default_rich_menu(rich_a_menu.rich_menu_id) # 7. Create rich menu alias A - client.set_rich_menus_alias(rich_a_menu['richMenuId'], 'richmenu-alias-a') + client.set_rich_menus_alias(rich_a_menu.rich_menu_id, 'richmenu-alias-a') # 8. Create rich menu alias B - client.set_rich_menus_alias(rich_b_menu['richMenuId'], 'richmenu-alias-b') + client.set_rich_menus_alias(rich_b_menu.rich_menu_id, 'richmenu-alias-b') puts 'success' end diff --git a/lib/clients/channel-access-token/.gitignore b/lib/clients/channel-access-token/.gitignore new file mode 100644 index 00000000..05a17cb8 --- /dev/null +++ b/lib/clients/channel-access-token/.gitignore @@ -0,0 +1,39 @@ +# Generated by: https://openapi-generator.tech +# + +*.gem +*.rbc +/.config +/coverage/ +/InstalledFiles +/pkg/ +/spec/reports/ +/spec/examples.txt +/test/tmp/ +/test/version_tmp/ +/tmp/ + +## Specific to RubyMotion: +.dat* +.repl_history +build/ + +## Documentation cache and generated files: +/.yardoc/ +/_yardoc/ +/doc/ +/rdoc/ + +## Environment normalization: +/.bundle/ +/vendor/bundle +/lib/bundler/man/ + +# for a library or gem, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# Gemfile.lock +# .ruby-version +# .ruby-gemset + +# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: +.rvmrc diff --git a/lib/clients/channel-access-token/.openapi-generator/FILES b/lib/clients/channel-access-token/.openapi-generator/FILES new file mode 100644 index 00000000..5b1dcf8f --- /dev/null +++ b/lib/clients/channel-access-token/.openapi-generator/FILES @@ -0,0 +1,33 @@ +.gitignore +.gitlab-ci.yml +.rspec +.rubocop.yml +.travis.yml +Gemfile +README.md +Rakefile +docs/ChannelAccessTokenApi.md +docs/ChannelAccessTokenKeyIdsResponse.md +docs/ErrorResponse.md +docs/IssueChannelAccessTokenResponse.md +docs/IssueShortLivedChannelAccessTokenResponse.md +docs/IssueStatelessChannelAccessTokenResponse.md +docs/VerifyChannelAccessTokenResponse.md +git_push.sh +lib/line_client_channel_access_token.rb +lib/line_client_channel_access_token/api/channel_access_token_api.rb +lib/line_client_channel_access_token/api_client.rb +lib/line_client_channel_access_token/api_error.rb +lib/line_client_channel_access_token/configuration.rb +lib/line_client_channel_access_token/models/channel_access_token_key_ids_response.rb +lib/line_client_channel_access_token/models/error_response.rb +lib/line_client_channel_access_token/models/issue_channel_access_token_response.rb +lib/line_client_channel_access_token/models/issue_short_lived_channel_access_token_response.rb +lib/line_client_channel_access_token/models/issue_stateless_channel_access_token_response.rb +lib/line_client_channel_access_token/models/verify_channel_access_token_response.rb +lib/line_client_channel_access_token/version.rb +line_client_channel_access_token.gemspec +spec/api_client_spec.rb +spec/configuration_spec.rb +spec/models/issue_stateless_channel_access_token_response_spec.rb +spec/spec_helper.rb diff --git a/lib/clients/channel-access-token/.openapi-generator/VERSION b/lib/clients/channel-access-token/.openapi-generator/VERSION new file mode 100644 index 00000000..41225218 --- /dev/null +++ b/lib/clients/channel-access-token/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.0.0 \ No newline at end of file diff --git a/lib/clients/channel-access-token/README.md b/lib/clients/channel-access-token/README.md new file mode 100644 index 00000000..de522c50 --- /dev/null +++ b/lib/clients/channel-access-token/README.md @@ -0,0 +1,111 @@ +# LINE::Client::ChannelAccessToken + +This document describes Channel Access Token API. + +This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 0.0.1 +- Package version: 2.0.0 +- Build package: org.openapitools.codegen.languages.RubyClientCodegen + +## Installation + +### Build a gem + +To build the Ruby code into a gem: + +```shell +gem build line-bot-api.gemspec +``` + +Then either install the gem locally: + +```shell +gem install ./line-bot-api-2.0.0.gem +``` + +(for development, run `gem install --dev ./line-bot-api-2.0.0.gem` to install the development dependencies) + +or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/). + +Finally add this to the Gemfile: + + gem 'line-bot-api', '~> 2.0.0' + +### Install from Git + +If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile: + + gem 'line-bot-api', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git' + +### Include the Ruby code directly + +Include the Ruby code directly using `-I` as follows: + +```shell +ruby -Ilib script.rb +``` + +## Getting Started + +Please follow the [installation](#installation) procedure and then run the following code: + +```ruby +# Load the gem +require 'line-bot-api' + +# Setup authorization +LINE::Client::ChannelAccessToken.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' + # Configure a proc to get access tokens in lieu of the static access_token configuration + config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' } +end + +api_instance = LINE::Client::ChannelAccessToken::ChannelAccessTokenApi.new +client_assertion_type = 'client_assertion_type_example' # String | `urn:ietf:params:oauth:client-assertion-type:jwt-bearer` +client_assertion = 'client_assertion_example' # String | A JSON Web Token (JWT) (opens new window)the client needs to create and sign with the private key. + +begin + result = api_instance.gets_all_valid_channel_access_token_key_ids(client_assertion_type, client_assertion) + p result +rescue LINE::Client::ChannelAccessToken::ApiError => e + puts "Exception when calling ChannelAccessTokenApi->gets_all_valid_channel_access_token_key_ids: #{e}" +end + +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://api.line.me* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*LINE::Client::ChannelAccessToken::ChannelAccessTokenApi* | [**gets_all_valid_channel_access_token_key_ids**](docs/ChannelAccessTokenApi.md#gets_all_valid_channel_access_token_key_ids) | **GET** /oauth2/v2.1/tokens/kid | +*LINE::Client::ChannelAccessToken::ChannelAccessTokenApi* | [**issue_channel_token**](docs/ChannelAccessTokenApi.md#issue_channel_token) | **POST** /v2/oauth/accessToken | +*LINE::Client::ChannelAccessToken::ChannelAccessTokenApi* | [**issue_channel_token_by_jwt**](docs/ChannelAccessTokenApi.md#issue_channel_token_by_jwt) | **POST** /oauth2/v2.1/token | +*LINE::Client::ChannelAccessToken::ChannelAccessTokenApi* | [**issue_stateless_channel_token**](docs/ChannelAccessTokenApi.md#issue_stateless_channel_token) | **POST** /oauth2/v3/token | +*LINE::Client::ChannelAccessToken::ChannelAccessTokenApi* | [**revoke_channel_token**](docs/ChannelAccessTokenApi.md#revoke_channel_token) | **POST** /v2/oauth/revoke | +*LINE::Client::ChannelAccessToken::ChannelAccessTokenApi* | [**revoke_channel_token_by_jwt**](docs/ChannelAccessTokenApi.md#revoke_channel_token_by_jwt) | **POST** /oauth2/v2.1/revoke | +*LINE::Client::ChannelAccessToken::ChannelAccessTokenApi* | [**verify_channel_token**](docs/ChannelAccessTokenApi.md#verify_channel_token) | **POST** /v2/oauth/verify | +*LINE::Client::ChannelAccessToken::ChannelAccessTokenApi* | [**verify_channel_token_by_jwt**](docs/ChannelAccessTokenApi.md#verify_channel_token_by_jwt) | **GET** /oauth2/v2.1/verify | + + +## Documentation for Models + + - [LINE::Client::ChannelAccessToken::ChannelAccessTokenKeyIdsResponse](docs/ChannelAccessTokenKeyIdsResponse.md) + - [LINE::Client::ChannelAccessToken::ErrorResponse](docs/ErrorResponse.md) + - [LINE::Client::ChannelAccessToken::IssueChannelAccessTokenResponse](docs/IssueChannelAccessTokenResponse.md) + - [LINE::Client::ChannelAccessToken::IssueShortLivedChannelAccessTokenResponse](docs/IssueShortLivedChannelAccessTokenResponse.md) + - [LINE::Client::ChannelAccessToken::IssueStatelessChannelAccessTokenResponse](docs/IssueStatelessChannelAccessTokenResponse.md) + - [LINE::Client::ChannelAccessToken::VerifyChannelAccessTokenResponse](docs/VerifyChannelAccessTokenResponse.md) + + +## Documentation for Authorization + + +Authentication schemes defined for the API: +### Bearer + +- **Type**: Bearer authentication + diff --git a/lib/clients/channel-access-token/docs/ChannelAccessTokenApi.md b/lib/clients/channel-access-token/docs/ChannelAccessTokenApi.md new file mode 100644 index 00000000..7d44391a --- /dev/null +++ b/lib/clients/channel-access-token/docs/ChannelAccessTokenApi.md @@ -0,0 +1,597 @@ +# LINE::Client::ChannelAccessToken::ChannelAccessTokenApi + +All URIs are relative to *https://api.line.me* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**gets_all_valid_channel_access_token_key_ids**](ChannelAccessTokenApi.md#gets_all_valid_channel_access_token_key_ids) | **GET** /oauth2/v2.1/tokens/kid | | +| [**issue_channel_token**](ChannelAccessTokenApi.md#issue_channel_token) | **POST** /v2/oauth/accessToken | | +| [**issue_channel_token_by_jwt**](ChannelAccessTokenApi.md#issue_channel_token_by_jwt) | **POST** /oauth2/v2.1/token | | +| [**issue_stateless_channel_token**](ChannelAccessTokenApi.md#issue_stateless_channel_token) | **POST** /oauth2/v3/token | | +| [**revoke_channel_token**](ChannelAccessTokenApi.md#revoke_channel_token) | **POST** /v2/oauth/revoke | | +| [**revoke_channel_token_by_jwt**](ChannelAccessTokenApi.md#revoke_channel_token_by_jwt) | **POST** /oauth2/v2.1/revoke | | +| [**verify_channel_token**](ChannelAccessTokenApi.md#verify_channel_token) | **POST** /v2/oauth/verify | | +| [**verify_channel_token_by_jwt**](ChannelAccessTokenApi.md#verify_channel_token_by_jwt) | **GET** /oauth2/v2.1/verify | | + + +## gets_all_valid_channel_access_token_key_ids + +> gets_all_valid_channel_access_token_key_ids(client_assertion_type, client_assertion) + + + +Gets all valid channel access token key IDs. + +### Examples + +```ruby +require 'time' +require 'line_client_channel_access_token' +# setup authorization +LINE::Client::ChannelAccessToken.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::ChannelAccessToken::ChannelAccessTokenApi.new +client_assertion_type = 'client_assertion_type_example' # String | `urn:ietf:params:oauth:client-assertion-type:jwt-bearer` +client_assertion = 'client_assertion_example' # String | A JSON Web Token (JWT) (opens new window)the client needs to create and sign with the private key. + +begin + + result = api_instance.gets_all_valid_channel_access_token_key_ids(client_assertion_type, client_assertion) + p result +rescue LINE::Client::ChannelAccessToken::ApiError => e + puts "Error when calling ChannelAccessTokenApi->gets_all_valid_channel_access_token_key_ids: #{e}" +end +``` + +#### Using the gets_all_valid_channel_access_token_key_ids_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> gets_all_valid_channel_access_token_key_ids_with_http_info(client_assertion_type, client_assertion) + +```ruby +begin + + data, status_code, headers = api_instance.gets_all_valid_channel_access_token_key_ids_with_http_info(client_assertion_type, client_assertion) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::ChannelAccessToken::ApiError => e + puts "Error when calling ChannelAccessTokenApi->gets_all_valid_channel_access_token_key_ids_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **client_assertion_type** | **String** | `urn:ietf:params:oauth:client-assertion-type:jwt-bearer` | | +| **client_assertion** | **String** | A JSON Web Token (JWT) (opens new window)the client needs to create and sign with the private key. | | + +### Return type + +[**ChannelAccessTokenKeyIdsResponse**](ChannelAccessTokenKeyIdsResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## issue_channel_token + +> issue_channel_token(opts) + + + +Issue short-lived channel access token + +### Examples + +```ruby +require 'time' +require 'line_client_channel_access_token' +# setup authorization +LINE::Client::ChannelAccessToken.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::ChannelAccessToken::ChannelAccessTokenApi.new +opts = { + grant_type: 'grant_type_example', # String | `client_credentials` + client_id: 'client_id_example', # String | Channel ID. + client_secret: 'client_secret_example' # String | Channel secret. +} + +begin + + result = api_instance.issue_channel_token(opts) + p result +rescue LINE::Client::ChannelAccessToken::ApiError => e + puts "Error when calling ChannelAccessTokenApi->issue_channel_token: #{e}" +end +``` + +#### Using the issue_channel_token_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> issue_channel_token_with_http_info(opts) + +```ruby +begin + + data, status_code, headers = api_instance.issue_channel_token_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::ChannelAccessToken::ApiError => e + puts "Error when calling ChannelAccessTokenApi->issue_channel_token_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **grant_type** | **String** | `client_credentials` | [optional] | +| **client_id** | **String** | Channel ID. | [optional] | +| **client_secret** | **String** | Channel secret. | [optional] | + +### Return type + +[**IssueShortLivedChannelAccessTokenResponse**](IssueShortLivedChannelAccessTokenResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: application/json + + +## issue_channel_token_by_jwt + +> issue_channel_token_by_jwt(opts) + + + +Issues a channel access token that allows you to specify a desired expiration date. This method lets you use JWT assertion for authentication. + +### Examples + +```ruby +require 'time' +require 'line_client_channel_access_token' +# setup authorization +LINE::Client::ChannelAccessToken.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::ChannelAccessToken::ChannelAccessTokenApi.new +opts = { + grant_type: 'grant_type_example', # String | client_credentials + client_assertion_type: 'client_assertion_type_example', # String | urn:ietf:params:oauth:client-assertion-type:jwt-bearer + client_assertion: 'client_assertion_example' # String | A JSON Web Token the client needs to create and sign with the private key of the Assertion Signing Key. +} + +begin + + result = api_instance.issue_channel_token_by_jwt(opts) + p result +rescue LINE::Client::ChannelAccessToken::ApiError => e + puts "Error when calling ChannelAccessTokenApi->issue_channel_token_by_jwt: #{e}" +end +``` + +#### Using the issue_channel_token_by_jwt_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> issue_channel_token_by_jwt_with_http_info(opts) + +```ruby +begin + + data, status_code, headers = api_instance.issue_channel_token_by_jwt_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::ChannelAccessToken::ApiError => e + puts "Error when calling ChannelAccessTokenApi->issue_channel_token_by_jwt_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **grant_type** | **String** | client_credentials | [optional] | +| **client_assertion_type** | **String** | urn:ietf:params:oauth:client-assertion-type:jwt-bearer | [optional] | +| **client_assertion** | **String** | A JSON Web Token the client needs to create and sign with the private key of the Assertion Signing Key. | [optional] | + +### Return type + +[**IssueChannelAccessTokenResponse**](IssueChannelAccessTokenResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: application/json + + +## issue_stateless_channel_token + +> issue_stateless_channel_token(grant_type, client_assertion_type, client_assertion, client_id, client_secret) + + + +Issues a new stateless channel access token, which doesn't have max active token limit unlike the other token types. The newly issued token is only valid for 15 minutes but can not be revoked until it naturally expires. + +### Examples + +```ruby +require 'time' +require 'line_client_channel_access_token' +# setup authorization +LINE::Client::ChannelAccessToken.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::ChannelAccessToken::ChannelAccessTokenApi.new +grant_type = 'client_credentials' # String | `client_credentials` +client_assertion_type = 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer' # String | URL-encoded value of `urn:ietf:params:oauth:client-assertion-type:jwt-bearer` +client_assertion = 'client_assertion_example' # String | A JSON Web Token the client needs to create and sign with the private key of the Assertion Signing Key. +client_id = 'client_id_example' # String | Channel ID. +client_secret = 'client_secret_example' # String | Channel secret. + +begin + + result = api_instance.issue_stateless_channel_token(grant_type, client_assertion_type, client_assertion, client_id, client_secret) + p result +rescue LINE::Client::ChannelAccessToken::ApiError => e + puts "Error when calling ChannelAccessTokenApi->issue_stateless_channel_token: #{e}" +end +``` + +#### Using the issue_stateless_channel_token_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> issue_stateless_channel_token_with_http_info(grant_type, client_assertion_type, client_assertion, client_id, client_secret) + +```ruby +begin + + data, status_code, headers = api_instance.issue_stateless_channel_token_with_http_info(grant_type, client_assertion_type, client_assertion, client_id, client_secret) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::ChannelAccessToken::ApiError => e + puts "Error when calling ChannelAccessTokenApi->issue_stateless_channel_token_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **grant_type** | **String** | `client_credentials` | | +| **client_assertion_type** | **String** | URL-encoded value of `urn:ietf:params:oauth:client-assertion-type:jwt-bearer` | | +| **client_assertion** | **String** | A JSON Web Token the client needs to create and sign with the private key of the Assertion Signing Key. | | +| **client_id** | **String** | Channel ID. | | +| **client_secret** | **String** | Channel secret. | | + +### Return type + +[**IssueStatelessChannelAccessTokenResponse**](IssueStatelessChannelAccessTokenResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: application/json + + +## revoke_channel_token + +> revoke_channel_token(opts) + + + +Revoke short-lived or long-lived channel access token + +### Examples + +```ruby +require 'time' +require 'line_client_channel_access_token' +# setup authorization +LINE::Client::ChannelAccessToken.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::ChannelAccessToken::ChannelAccessTokenApi.new +opts = { + access_token: 'access_token_example' # String | Channel access token +} + +begin + + api_instance.revoke_channel_token(opts) +rescue LINE::Client::ChannelAccessToken::ApiError => e + puts "Error when calling ChannelAccessTokenApi->revoke_channel_token: #{e}" +end +``` + +#### Using the revoke_channel_token_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> revoke_channel_token_with_http_info(opts) + +```ruby +begin + + data, status_code, headers = api_instance.revoke_channel_token_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::ChannelAccessToken::ApiError => e + puts "Error when calling ChannelAccessTokenApi->revoke_channel_token_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **access_token** | **String** | Channel access token | [optional] | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + + +## revoke_channel_token_by_jwt + +> revoke_channel_token_by_jwt(opts) + + + +Revoke channel access token v2.1 + +### Examples + +```ruby +require 'time' +require 'line_client_channel_access_token' +# setup authorization +LINE::Client::ChannelAccessToken.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::ChannelAccessToken::ChannelAccessTokenApi.new +opts = { + client_id: 'client_id_example', # String | Channel ID + client_secret: 'client_secret_example', # String | Channel Secret + access_token: 'access_token_example' # String | Channel access token +} + +begin + + api_instance.revoke_channel_token_by_jwt(opts) +rescue LINE::Client::ChannelAccessToken::ApiError => e + puts "Error when calling ChannelAccessTokenApi->revoke_channel_token_by_jwt: #{e}" +end +``` + +#### Using the revoke_channel_token_by_jwt_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> revoke_channel_token_by_jwt_with_http_info(opts) + +```ruby +begin + + data, status_code, headers = api_instance.revoke_channel_token_by_jwt_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::ChannelAccessToken::ApiError => e + puts "Error when calling ChannelAccessTokenApi->revoke_channel_token_by_jwt_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **client_id** | **String** | Channel ID | [optional] | +| **client_secret** | **String** | Channel Secret | [optional] | +| **access_token** | **String** | Channel access token | [optional] | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + + +## verify_channel_token + +> verify_channel_token(opts) + + + +Verify the validity of short-lived and long-lived channel access tokens + +### Examples + +```ruby +require 'time' +require 'line_client_channel_access_token' +# setup authorization +LINE::Client::ChannelAccessToken.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::ChannelAccessToken::ChannelAccessTokenApi.new +opts = { + access_token: 'access_token_example' # String | A short-lived or long-lived channel access token. +} + +begin + + result = api_instance.verify_channel_token(opts) + p result +rescue LINE::Client::ChannelAccessToken::ApiError => e + puts "Error when calling ChannelAccessTokenApi->verify_channel_token: #{e}" +end +``` + +#### Using the verify_channel_token_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> verify_channel_token_with_http_info(opts) + +```ruby +begin + + data, status_code, headers = api_instance.verify_channel_token_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::ChannelAccessToken::ApiError => e + puts "Error when calling ChannelAccessTokenApi->verify_channel_token_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **access_token** | **String** | A short-lived or long-lived channel access token. | [optional] | + +### Return type + +[**VerifyChannelAccessTokenResponse**](VerifyChannelAccessTokenResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: application/json + + +## verify_channel_token_by_jwt + +> verify_channel_token_by_jwt(access_token) + + + +You can verify whether a Channel access token with a user-specified expiration (Channel Access Token v2.1) is valid. + +### Examples + +```ruby +require 'time' +require 'line_client_channel_access_token' +# setup authorization +LINE::Client::ChannelAccessToken.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::ChannelAccessToken::ChannelAccessTokenApi.new +access_token = 'access_token_example' # String | Channel access token with a user-specified expiration (Channel Access Token v2.1). + +begin + + result = api_instance.verify_channel_token_by_jwt(access_token) + p result +rescue LINE::Client::ChannelAccessToken::ApiError => e + puts "Error when calling ChannelAccessTokenApi->verify_channel_token_by_jwt: #{e}" +end +``` + +#### Using the verify_channel_token_by_jwt_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> verify_channel_token_by_jwt_with_http_info(access_token) + +```ruby +begin + + data, status_code, headers = api_instance.verify_channel_token_by_jwt_with_http_info(access_token) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::ChannelAccessToken::ApiError => e + puts "Error when calling ChannelAccessTokenApi->verify_channel_token_by_jwt_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **access_token** | **String** | Channel access token with a user-specified expiration (Channel Access Token v2.1). | | + +### Return type + +[**VerifyChannelAccessTokenResponse**](VerifyChannelAccessTokenResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/lib/clients/channel-access-token/docs/ChannelAccessTokenKeyIdsResponse.md b/lib/clients/channel-access-token/docs/ChannelAccessTokenKeyIdsResponse.md new file mode 100644 index 00000000..e5c27b84 --- /dev/null +++ b/lib/clients/channel-access-token/docs/ChannelAccessTokenKeyIdsResponse.md @@ -0,0 +1,18 @@ +# LINE::Client::ChannelAccessToken::ChannelAccessTokenKeyIdsResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **kids** | **Array<String>** | Array of channel access token key IDs. | | + +## Example + +```ruby +require 'line_client_channel_access_token' + +instance = LINE::Client::ChannelAccessToken::ChannelAccessTokenKeyIdsResponse.new( + kids: null +) +``` + diff --git a/lib/clients/channel-access-token/docs/ErrorResponse.md b/lib/clients/channel-access-token/docs/ErrorResponse.md new file mode 100644 index 00000000..b38ad3a4 --- /dev/null +++ b/lib/clients/channel-access-token/docs/ErrorResponse.md @@ -0,0 +1,20 @@ +# LINE::Client::ChannelAccessToken::ErrorResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **error** | **String** | Error summary | [optional] | +| **error_description** | **String** | Details of the error. Not returned in certain situations. | [optional] | + +## Example + +```ruby +require 'line_client_channel_access_token' + +instance = LINE::Client::ChannelAccessToken::ErrorResponse.new( + error: null, + error_description: null +) +``` + diff --git a/lib/clients/channel-access-token/docs/IssueChannelAccessTokenResponse.md b/lib/clients/channel-access-token/docs/IssueChannelAccessTokenResponse.md new file mode 100644 index 00000000..676fccf6 --- /dev/null +++ b/lib/clients/channel-access-token/docs/IssueChannelAccessTokenResponse.md @@ -0,0 +1,24 @@ +# LINE::Client::ChannelAccessToken::IssueChannelAccessTokenResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **access_token** | **String** | Channel access token. | | +| **expires_in** | **Integer** | Amount of time in seconds from issue to expiration of the channel access token | | +| **token_type** | **String** | A token type. | [default to 'Bearer'] | +| **key_id** | **String** | Unique key ID for identifying the channel access token. | | + +## Example + +```ruby +require 'line_client_channel_access_token' + +instance = LINE::Client::ChannelAccessToken::IssueChannelAccessTokenResponse.new( + access_token: null, + expires_in: null, + token_type: null, + key_id: null +) +``` + diff --git a/lib/clients/channel-access-token/docs/IssueShortLivedChannelAccessTokenResponse.md b/lib/clients/channel-access-token/docs/IssueShortLivedChannelAccessTokenResponse.md new file mode 100644 index 00000000..ce41bc65 --- /dev/null +++ b/lib/clients/channel-access-token/docs/IssueShortLivedChannelAccessTokenResponse.md @@ -0,0 +1,22 @@ +# LINE::Client::ChannelAccessToken::IssueShortLivedChannelAccessTokenResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **access_token** | **String** | A short-lived channel access token. Valid for 30 days. Note: Channel access tokens cannot be refreshed. | | +| **expires_in** | **Integer** | Time until channel access token expires in seconds from time the token is issued. | | +| **token_type** | **String** | Token type. The value is always `Bearer`. | [default to 'Bearer'] | + +## Example + +```ruby +require 'line_client_channel_access_token' + +instance = LINE::Client::ChannelAccessToken::IssueShortLivedChannelAccessTokenResponse.new( + access_token: null, + expires_in: null, + token_type: null +) +``` + diff --git a/lib/clients/channel-access-token/docs/IssueStatelessChannelAccessTokenResponse.md b/lib/clients/channel-access-token/docs/IssueStatelessChannelAccessTokenResponse.md new file mode 100644 index 00000000..089ae66b --- /dev/null +++ b/lib/clients/channel-access-token/docs/IssueStatelessChannelAccessTokenResponse.md @@ -0,0 +1,22 @@ +# LINE::Client::ChannelAccessToken::IssueStatelessChannelAccessTokenResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **access_token** | **String** | A stateless channel access token. The token is an opaque string which means its format is an implementation detail and the consumer of this token should never try to use the data parsed from the token. | | +| **expires_in** | **Integer** | Duration in seconds after which the issued access token expires | | +| **token_type** | **String** | Token type. The value is always `Bearer`. | [default to 'Bearer'] | + +## Example + +```ruby +require 'line_client_channel_access_token' + +instance = LINE::Client::ChannelAccessToken::IssueStatelessChannelAccessTokenResponse.new( + access_token: null, + expires_in: null, + token_type: null +) +``` + diff --git a/lib/clients/channel-access-token/docs/VerifyChannelAccessTokenResponse.md b/lib/clients/channel-access-token/docs/VerifyChannelAccessTokenResponse.md new file mode 100644 index 00000000..b84aece8 --- /dev/null +++ b/lib/clients/channel-access-token/docs/VerifyChannelAccessTokenResponse.md @@ -0,0 +1,22 @@ +# LINE::Client::ChannelAccessToken::VerifyChannelAccessTokenResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **client_id** | **String** | The channel ID for which the channel access token was issued. | | +| **expires_in** | **Integer** | Number of seconds before the channel access token expires. | | +| **scope** | **String** | Permissions granted to the channel access token. | [optional] | + +## Example + +```ruby +require 'line_client_channel_access_token' + +instance = LINE::Client::ChannelAccessToken::VerifyChannelAccessTokenResponse.new( + client_id: null, + expires_in: null, + scope: null +) +``` + diff --git a/lib/clients/channel-access-token/lib/line_client_channel_access_token.rb b/lib/clients/channel-access-token/lib/line_client_channel_access_token.rb new file mode 100644 index 00000000..52c52a55 --- /dev/null +++ b/lib/clients/channel-access-token/lib/line_client_channel_access_token.rb @@ -0,0 +1,46 @@ +=begin +#Channel Access Token API + +#This document describes Channel Access Token API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +# Common files +require 'line_client_channel_access_token/api_client' +require 'line_client_channel_access_token/api_error' +require 'line_client_channel_access_token/version' +require 'line_client_channel_access_token/configuration' + +# Models +require 'line_client_channel_access_token/models/channel_access_token_key_ids_response' +require 'line_client_channel_access_token/models/error_response' +require 'line_client_channel_access_token/models/issue_channel_access_token_response' +require 'line_client_channel_access_token/models/issue_short_lived_channel_access_token_response' +require 'line_client_channel_access_token/models/issue_stateless_channel_access_token_response' +require 'line_client_channel_access_token/models/verify_channel_access_token_response' + +# APIs +require 'line_client_channel_access_token/api/channel_access_token_api' + +module LINE::Client::ChannelAccessToken + class << self + # Customize default settings for the SDK using block. + # LINE::Client::ChannelAccessToken.configure do |config| + # config.username = "xxx" + # config.password = "xxx" + # end + # If no block given, return the default Configuration object. + def configure + if block_given? + yield(Configuration.default) + else + Configuration.default + end + end + end +end diff --git a/lib/clients/channel-access-token/lib/line_client_channel_access_token/api/channel_access_token_api.rb b/lib/clients/channel-access-token/lib/line_client_channel_access_token/api/channel_access_token_api.rb new file mode 100644 index 00000000..caae7a14 --- /dev/null +++ b/lib/clients/channel-access-token/lib/line_client_channel_access_token/api/channel_access_token_api.rb @@ -0,0 +1,587 @@ +=begin +#Channel Access Token API + +#This document describes Channel Access Token API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'cgi' + +module LINE::Client::ChannelAccessToken + class ChannelAccessTokenApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Gets all valid channel access token key IDs. + # @param client_assertion_type [String] `urn:ietf:params:oauth:client-assertion-type:jwt-bearer` + # @param client_assertion [String] A JSON Web Token (JWT) (opens new window)the client needs to create and sign with the private key. + # @param [Hash] opts the optional parameters + # @return [ChannelAccessTokenKeyIdsResponse] + def gets_all_valid_channel_access_token_key_ids(client_assertion_type, client_assertion, opts = {}) + data, _status_code, _headers = gets_all_valid_channel_access_token_key_ids_with_http_info(client_assertion_type, client_assertion, opts) + data + end + + # Gets all valid channel access token key IDs. + # @param client_assertion_type [String] `urn:ietf:params:oauth:client-assertion-type:jwt-bearer` + # @param client_assertion [String] A JSON Web Token (JWT) (opens new window)the client needs to create and sign with the private key. + # @param [Hash] opts the optional parameters + # @return [Array<(ChannelAccessTokenKeyIdsResponse, Integer, Hash)>] ChannelAccessTokenKeyIdsResponse data, response status code and response headers + def gets_all_valid_channel_access_token_key_ids_with_http_info(client_assertion_type, client_assertion, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ChannelAccessTokenApi.gets_all_valid_channel_access_token_key_ids ...' + end + # verify the required parameter 'client_assertion_type' is set + if @api_client.config.client_side_validation && client_assertion_type.nil? + fail ArgumentError, "Missing the required parameter 'client_assertion_type' when calling ChannelAccessTokenApi.gets_all_valid_channel_access_token_key_ids" + end + # verify the required parameter 'client_assertion' is set + if @api_client.config.client_side_validation && client_assertion.nil? + fail ArgumentError, "Missing the required parameter 'client_assertion' when calling ChannelAccessTokenApi.gets_all_valid_channel_access_token_key_ids" + end + # resource path + local_var_path = '/oauth2/v2.1/tokens/kid' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'client_assertion_type'] = client_assertion_type + query_params[:'client_assertion'] = client_assertion + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ChannelAccessTokenKeyIdsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"ChannelAccessTokenApi.gets_all_valid_channel_access_token_key_ids", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ChannelAccessTokenApi#gets_all_valid_channel_access_token_key_ids\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Issue short-lived channel access token + # @param [Hash] opts the optional parameters + # @option opts [String] :grant_type `client_credentials` + # @option opts [String] :client_id Channel ID. + # @option opts [String] :client_secret Channel secret. + # @return [IssueShortLivedChannelAccessTokenResponse] + def issue_channel_token(opts = {}) + data, _status_code, _headers = issue_channel_token_with_http_info(opts) + data + end + + # Issue short-lived channel access token + # @param [Hash] opts the optional parameters + # @option opts [String] :grant_type `client_credentials` + # @option opts [String] :client_id Channel ID. + # @option opts [String] :client_secret Channel secret. + # @return [Array<(IssueShortLivedChannelAccessTokenResponse, Integer, Hash)>] IssueShortLivedChannelAccessTokenResponse data, response status code and response headers + def issue_channel_token_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ChannelAccessTokenApi.issue_channel_token ...' + end + # resource path + local_var_path = '/v2/oauth/accessToken' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + form_params['grant_type'] = opts[:'grant_type'] if !opts[:'grant_type'].nil? + form_params['client_id'] = opts[:'client_id'] if !opts[:'client_id'].nil? + form_params['client_secret'] = opts[:'client_secret'] if !opts[:'client_secret'].nil? + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'IssueShortLivedChannelAccessTokenResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"ChannelAccessTokenApi.issue_channel_token", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ChannelAccessTokenApi#issue_channel_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Issues a channel access token that allows you to specify a desired expiration date. This method lets you use JWT assertion for authentication. + # @param [Hash] opts the optional parameters + # @option opts [String] :grant_type client_credentials + # @option opts [String] :client_assertion_type urn:ietf:params:oauth:client-assertion-type:jwt-bearer + # @option opts [String] :client_assertion A JSON Web Token the client needs to create and sign with the private key of the Assertion Signing Key. + # @return [IssueChannelAccessTokenResponse] + def issue_channel_token_by_jwt(opts = {}) + data, _status_code, _headers = issue_channel_token_by_jwt_with_http_info(opts) + data + end + + # Issues a channel access token that allows you to specify a desired expiration date. This method lets you use JWT assertion for authentication. + # @param [Hash] opts the optional parameters + # @option opts [String] :grant_type client_credentials + # @option opts [String] :client_assertion_type urn:ietf:params:oauth:client-assertion-type:jwt-bearer + # @option opts [String] :client_assertion A JSON Web Token the client needs to create and sign with the private key of the Assertion Signing Key. + # @return [Array<(IssueChannelAccessTokenResponse, Integer, Hash)>] IssueChannelAccessTokenResponse data, response status code and response headers + def issue_channel_token_by_jwt_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ChannelAccessTokenApi.issue_channel_token_by_jwt ...' + end + # resource path + local_var_path = '/oauth2/v2.1/token' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + form_params['grant_type'] = opts[:'grant_type'] if !opts[:'grant_type'].nil? + form_params['client_assertion_type'] = opts[:'client_assertion_type'] if !opts[:'client_assertion_type'].nil? + form_params['client_assertion'] = opts[:'client_assertion'] if !opts[:'client_assertion'].nil? + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'IssueChannelAccessTokenResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"ChannelAccessTokenApi.issue_channel_token_by_jwt", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ChannelAccessTokenApi#issue_channel_token_by_jwt\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Issues a new stateless channel access token, which doesn't have max active token limit unlike the other token types. The newly issued token is only valid for 15 minutes but can not be revoked until it naturally expires. + # @param grant_type [String] `client_credentials` + # @param client_assertion_type [String] URL-encoded value of `urn:ietf:params:oauth:client-assertion-type:jwt-bearer` + # @param client_assertion [String] A JSON Web Token the client needs to create and sign with the private key of the Assertion Signing Key. + # @param client_id [String] Channel ID. + # @param client_secret [String] Channel secret. + # @param [Hash] opts the optional parameters + # @return [IssueStatelessChannelAccessTokenResponse] + def issue_stateless_channel_token(grant_type, client_assertion_type, client_assertion, client_id, client_secret, opts = {}) + data, _status_code, _headers = issue_stateless_channel_token_with_http_info(grant_type, client_assertion_type, client_assertion, client_id, client_secret, opts) + data + end + + # Issues a new stateless channel access token, which doesn't have max active token limit unlike the other token types. The newly issued token is only valid for 15 minutes but can not be revoked until it naturally expires. + # @param grant_type [String] `client_credentials` + # @param client_assertion_type [String] URL-encoded value of `urn:ietf:params:oauth:client-assertion-type:jwt-bearer` + # @param client_assertion [String] A JSON Web Token the client needs to create and sign with the private key of the Assertion Signing Key. + # @param client_id [String] Channel ID. + # @param client_secret [String] Channel secret. + # @param [Hash] opts the optional parameters + # @return [Array<(IssueStatelessChannelAccessTokenResponse, Integer, Hash)>] IssueStatelessChannelAccessTokenResponse data, response status code and response headers + def issue_stateless_channel_token_with_http_info(grant_type, client_assertion_type, client_assertion, client_id, client_secret, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ChannelAccessTokenApi.issue_stateless_channel_token ...' + end + # verify the required parameter 'grant_type' is set + if @api_client.config.client_side_validation && grant_type.nil? + fail ArgumentError, "Missing the required parameter 'grant_type' when calling ChannelAccessTokenApi.issue_stateless_channel_token" + end + # verify enum value + allowable_values = ["client_credentials"] + if @api_client.config.client_side_validation && !allowable_values.include?(grant_type) + fail ArgumentError, "invalid value for \"grant_type\", must be one of #{allowable_values}" + end + # verify the required parameter 'client_assertion_type' is set + if @api_client.config.client_side_validation && client_assertion_type.nil? + fail ArgumentError, "Missing the required parameter 'client_assertion_type' when calling ChannelAccessTokenApi.issue_stateless_channel_token" + end + # verify enum value + allowable_values = ["urn:ietf:params:oauth:client-assertion-type:jwt-bearer"] + if @api_client.config.client_side_validation && !allowable_values.include?(client_assertion_type) + fail ArgumentError, "invalid value for \"client_assertion_type\", must be one of #{allowable_values}" + end + # verify the required parameter 'client_assertion' is set + if @api_client.config.client_side_validation && client_assertion.nil? + fail ArgumentError, "Missing the required parameter 'client_assertion' when calling ChannelAccessTokenApi.issue_stateless_channel_token" + end + # verify the required parameter 'client_id' is set + if @api_client.config.client_side_validation && client_id.nil? + fail ArgumentError, "Missing the required parameter 'client_id' when calling ChannelAccessTokenApi.issue_stateless_channel_token" + end + # verify the required parameter 'client_secret' is set + if @api_client.config.client_side_validation && client_secret.nil? + fail ArgumentError, "Missing the required parameter 'client_secret' when calling ChannelAccessTokenApi.issue_stateless_channel_token" + end + # resource path + local_var_path = '/oauth2/v3/token' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + form_params['grant_type'] = grant_type + form_params['client_assertion_type'] = client_assertion_type + form_params['client_assertion'] = client_assertion + form_params['client_id'] = client_id + form_params['client_secret'] = client_secret + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'IssueStatelessChannelAccessTokenResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"ChannelAccessTokenApi.issue_stateless_channel_token", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ChannelAccessTokenApi#issue_stateless_channel_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Revoke short-lived or long-lived channel access token + # @param [Hash] opts the optional parameters + # @option opts [String] :access_token Channel access token + # @return [nil] + def revoke_channel_token(opts = {}) + revoke_channel_token_with_http_info(opts) + nil + end + + # Revoke short-lived or long-lived channel access token + # @param [Hash] opts the optional parameters + # @option opts [String] :access_token Channel access token + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def revoke_channel_token_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ChannelAccessTokenApi.revoke_channel_token ...' + end + # resource path + local_var_path = '/v2/oauth/revoke' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + form_params['access_token'] = opts[:'access_token'] if !opts[:'access_token'].nil? + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"ChannelAccessTokenApi.revoke_channel_token", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ChannelAccessTokenApi#revoke_channel_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Revoke channel access token v2.1 + # @param [Hash] opts the optional parameters + # @option opts [String] :client_id Channel ID + # @option opts [String] :client_secret Channel Secret + # @option opts [String] :access_token Channel access token + # @return [nil] + def revoke_channel_token_by_jwt(opts = {}) + revoke_channel_token_by_jwt_with_http_info(opts) + nil + end + + # Revoke channel access token v2.1 + # @param [Hash] opts the optional parameters + # @option opts [String] :client_id Channel ID + # @option opts [String] :client_secret Channel Secret + # @option opts [String] :access_token Channel access token + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def revoke_channel_token_by_jwt_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ChannelAccessTokenApi.revoke_channel_token_by_jwt ...' + end + # resource path + local_var_path = '/oauth2/v2.1/revoke' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + form_params['client_id'] = opts[:'client_id'] if !opts[:'client_id'].nil? + form_params['client_secret'] = opts[:'client_secret'] if !opts[:'client_secret'].nil? + form_params['access_token'] = opts[:'access_token'] if !opts[:'access_token'].nil? + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"ChannelAccessTokenApi.revoke_channel_token_by_jwt", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ChannelAccessTokenApi#revoke_channel_token_by_jwt\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Verify the validity of short-lived and long-lived channel access tokens + # @param [Hash] opts the optional parameters + # @option opts [String] :access_token A short-lived or long-lived channel access token. + # @return [VerifyChannelAccessTokenResponse] + def verify_channel_token(opts = {}) + data, _status_code, _headers = verify_channel_token_with_http_info(opts) + data + end + + # Verify the validity of short-lived and long-lived channel access tokens + # @param [Hash] opts the optional parameters + # @option opts [String] :access_token A short-lived or long-lived channel access token. + # @return [Array<(VerifyChannelAccessTokenResponse, Integer, Hash)>] VerifyChannelAccessTokenResponse data, response status code and response headers + def verify_channel_token_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ChannelAccessTokenApi.verify_channel_token ...' + end + # resource path + local_var_path = '/v2/oauth/verify' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + form_params['access_token'] = opts[:'access_token'] if !opts[:'access_token'].nil? + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'VerifyChannelAccessTokenResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"ChannelAccessTokenApi.verify_channel_token", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ChannelAccessTokenApi#verify_channel_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # You can verify whether a Channel access token with a user-specified expiration (Channel Access Token v2.1) is valid. + # @param access_token [String] Channel access token with a user-specified expiration (Channel Access Token v2.1). + # @param [Hash] opts the optional parameters + # @return [VerifyChannelAccessTokenResponse] + def verify_channel_token_by_jwt(access_token, opts = {}) + data, _status_code, _headers = verify_channel_token_by_jwt_with_http_info(access_token, opts) + data + end + + # You can verify whether a Channel access token with a user-specified expiration (Channel Access Token v2.1) is valid. + # @param access_token [String] Channel access token with a user-specified expiration (Channel Access Token v2.1). + # @param [Hash] opts the optional parameters + # @return [Array<(VerifyChannelAccessTokenResponse, Integer, Hash)>] VerifyChannelAccessTokenResponse data, response status code and response headers + def verify_channel_token_by_jwt_with_http_info(access_token, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ChannelAccessTokenApi.verify_channel_token_by_jwt ...' + end + # verify the required parameter 'access_token' is set + if @api_client.config.client_side_validation && access_token.nil? + fail ArgumentError, "Missing the required parameter 'access_token' when calling ChannelAccessTokenApi.verify_channel_token_by_jwt" + end + # resource path + local_var_path = '/oauth2/v2.1/verify' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'access_token'] = access_token + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'VerifyChannelAccessTokenResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"ChannelAccessTokenApi.verify_channel_token_by_jwt", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ChannelAccessTokenApi#verify_channel_token_by_jwt\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/clients/channel-access-token/lib/line_client_channel_access_token/api_client.rb b/lib/clients/channel-access-token/lib/line_client_channel_access_token/api_client.rb new file mode 100644 index 00000000..893d6ace --- /dev/null +++ b/lib/clients/channel-access-token/lib/line_client_channel_access_token/api_client.rb @@ -0,0 +1,392 @@ +=begin +#Channel Access Token API + +#This document describes Channel Access Token API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'json' +require 'logger' +require 'tempfile' +require 'time' +require 'typhoeus' + +module LINE::Client::ChannelAccessToken + class ApiClient + # The Configuration object holding settings to be used in the API client. + attr_accessor :config + + # Defines the headers to be used in HTTP requests of all API calls by default. + # + # @return [Hash] + attr_accessor :default_headers + + # Initializes the ApiClient + # @option config [Configuration] Configuration for initializing the object, default to Configuration.default + def initialize(config = Configuration.default) + @config = config + @user_agent = "LINE-BotSDK-Ruby/2.0.0" + @default_headers = { + 'Content-Type' => 'application/json', + 'User-Agent' => @user_agent + } + end + + def self.default + @@default ||= ApiClient.new + end + + # Call an API with given options. + # + # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: + # the data deserialized from response body (could be nil), response status code and response headers. + def call_api(http_method, path, opts = {}) + request = build_request(http_method, path, opts) + response = request.run + + if @config.debugging + @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" + end + + unless response.success? + if response.timed_out? + fail ApiError.new('Connection timed out') + elsif response.code == 0 + # Errors from libcurl will be made visible here + fail ApiError.new(:code => 0, + :message => response.return_message) + else + fail ApiError.new(:code => response.code, + :response_headers => response.headers, + :response_body => response.body), + response.status_message + end + end + + if opts[:return_type] + data = deserialize(response, opts[:return_type]) + else + data = nil + end + return data, response.code, response.headers + end + + # Builds the HTTP request + # + # @param [String] http_method HTTP method/verb (e.g. POST) + # @param [String] path URL path (e.g. /account/new) + # @option opts [Hash] :header_params Header parameters + # @option opts [Hash] :query_params Query parameters + # @option opts [Hash] :form_params Query parameters + # @option opts [Object] :body HTTP body (JSON/XML) + # @return [Typhoeus::Request] A Typhoeus Request + def build_request(http_method, path, opts = {}) + url = build_request_url(path, opts) + http_method = http_method.to_sym.downcase + + header_params = @default_headers.merge(opts[:header_params] || {}) + query_params = opts[:query_params] || {} + form_params = opts[:form_params] || {} + follow_location = opts[:follow_location] || true + + update_params_for_auth! header_params, query_params, opts[:auth_names] + + # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false) + _verify_ssl_host = @config.verify_ssl_host ? 2 : 0 + + req_opts = { + :method => http_method, + :headers => header_params, + :params => query_params, + :params_encoding => @config.params_encoding, + :timeout => @config.timeout, + :ssl_verifypeer => @config.verify_ssl, + :ssl_verifyhost => _verify_ssl_host, + :sslcert => @config.cert_file, + :sslkey => @config.key_file, + :verbose => @config.debugging, + :followlocation => follow_location + } + + # set custom cert, if provided + req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert + + if [:post, :patch, :put, :delete].include?(http_method) + req_body = build_request_body(header_params, form_params, opts[:body]) + req_opts.update :body => req_body + if @config.debugging + @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n" + end + end + + request = Typhoeus::Request.new(url, req_opts) + download_file(request) if opts[:return_type] == 'File' + request + end + + # Builds the HTTP request body + # + # @param [Hash] header_params Header parameters + # @param [Hash] form_params Query parameters + # @param [Object] body HTTP body (JSON/XML) + # @return [String] HTTP body data in the form of string + def build_request_body(header_params, form_params, body) + # http form + if header_params['Content-Type'] == 'application/x-www-form-urlencoded' || + header_params['Content-Type'] == 'multipart/form-data' + data = {} + form_params.each do |key, value| + case value + when ::File, ::Array, nil + # let typhoeus handle File, Array and nil parameters + data[key] = value + else + data[key] = value.to_s + end + end + elsif body + data = body.is_a?(String) ? body : body.to_json + else + data = nil + end + data + end + + # Save response body into a file in (the defined) temporary folder, using the filename + # from the "Content-Disposition" header if provided, otherwise a random filename. + # The response body is written to the file in chunks in order to handle files which + # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby + # process can use. + # + # @see Configuration#temp_folder_path + def download_file(request) + tempfile = nil + encoding = nil + request.on_headers do |response| + content_disposition = response.headers['Content-Disposition'] + if content_disposition && content_disposition =~ /filename=/i + filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1] + prefix = sanitize_filename(filename) + else + prefix = 'download-' + end + prefix = prefix + '-' unless prefix.end_with?('-') + encoding = response.body.encoding + tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) + @tempfile = tempfile + end + request.on_body do |chunk| + chunk.force_encoding(encoding) + tempfile.write(chunk) + end + request.on_complete do |response| + if tempfile + tempfile.close + @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ + "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ + "will be deleted automatically with GC. It's also recommended to delete the temp file "\ + "explicitly with `tempfile.delete`" + end + end + end + + # Check if the given MIME is a JSON MIME. + # JSON MIME examples: + # application/json + # application/json; charset=UTF8 + # APPLICATION/JSON + # */* + # @param [String] mime MIME + # @return [Boolean] True if the MIME is application/json + def json_mime?(mime) + (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + end + + # Deserialize the response to the given return type. + # + # @param [Response] response HTTP response + # @param [String] return_type some examples: "User", "Array", "Hash" + def deserialize(response, return_type) + body = response.body + + # handle file downloading - return the File instance processed in request callbacks + # note that response body is empty when the file is written in chunks in request on_body callback + return @tempfile if return_type == 'File' + + return nil if body.nil? || body.empty? + + # return response body directly for String return type + return body if return_type == 'String' + + # ensuring a default content type + content_type = response.headers['Content-Type'] || 'application/json' + + fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type) + + begin + data = JSON.parse("[#{body}]", :symbolize_names => true)[0] + rescue JSON::ParserError => e + if %w(String Date Time).include?(return_type) + data = body + else + raise e + end + end + + convert_to_type data, return_type + end + + # Convert data to the given return type. + # @param [Object] data Data to be converted + # @param [String] return_type Return type + # @return [Mixed] Data in a particular type + def convert_to_type(data, return_type) + return nil if data.nil? + case return_type + when 'String' + data.to_s + when 'Integer' + data.to_i + when 'Float' + data.to_f + when 'Boolean' + data == true + when 'Time' + # parse date time (expecting ISO 8601 format) + Time.parse data + when 'Date' + # parse date time (expecting ISO 8601 format) + Date.parse data + when 'Object' + # generic object (usually a Hash), return directly + data + when /\AArray<(.+)>\z/ + # e.g. Array + sub_type = $1 + data.map { |item| convert_to_type(item, sub_type) } + when /\AHash\\z/ + # e.g. Hash + sub_type = $1 + {}.tap do |hash| + data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } + end + else + # models (e.g. Pet) or oneOf + klass = LINE::Client::ChannelAccessToken.const_get(return_type) + klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + end + end + + # Sanitize filename by removing path. + # e.g. ../../sun.gif becomes sun.gif + # + # @param [String] filename the filename to be sanitized + # @return [String] the sanitized filename + def sanitize_filename(filename) + filename.gsub(/.*[\/\\]/, '') + end + + def build_request_url(path, opts = {}) + # Add leading and trailing slashes to path + path = "/#{path}".gsub(/\/+/, '/') + @config.base_url(opts[:operation]) + path + end + + # Update header and query params based on authentication settings. + # + # @param [Hash] header_params Header parameters + # @param [Hash] query_params Query parameters + # @param [String] auth_names Authentication scheme name + def update_params_for_auth!(header_params, query_params, auth_names) + Array(auth_names).each do |auth_name| + auth_setting = @config.auth_settings[auth_name] + next unless auth_setting + case auth_setting[:in] + when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] + when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] + else fail ArgumentError, 'Authentication token must be in `query` or `header`' + end + end + end + + # Sets user agent in HTTP header + # + # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0) + def user_agent=(user_agent) + @user_agent = user_agent + @default_headers['User-Agent'] = @user_agent + end + + # Return Accept header based on an array of accepts provided. + # @param [Array] accepts array for Accept + # @return [String] the Accept header (e.g. application/json) + def select_header_accept(accepts) + return nil if accepts.nil? || accepts.empty? + # use JSON when present, otherwise use all of the provided + json_accept = accepts.find { |s| json_mime?(s) } + json_accept || accepts.join(',') + end + + # Return Content-Type header based on an array of content types provided. + # @param [Array] content_types array for Content-Type + # @return [String] the Content-Type header (e.g. application/json) + def select_header_content_type(content_types) + # return nil by default + return if content_types.nil? || content_types.empty? + # use JSON when present, otherwise use the first one + json_content_type = content_types.find { |s| json_mime?(s) } + json_content_type || content_types.first + end + + # Convert object (array, hash, object, etc) to JSON string. + # @param [Object] model object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_http_body(model) + return model if model.nil? || model.is_a?(String) + local_body = nil + if model.is_a?(Array) + local_body = model.map { |m| object_to_hash(m) } + else + local_body = object_to_hash(model) + end + local_body.to_json + end + + # Convert object(non-array) to hash. + # @param [Object] obj object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_hash(obj) + if obj.respond_to?(:to_hash) + obj.to_hash + else + obj + end + end + + # Build parameter value according to the given collection format. + # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi + def build_collection_param(param, collection_format) + case collection_format + when :csv + param.join(',') + when :ssv + param.join(' ') + when :tsv + param.join("\t") + when :pipes + param.join('|') + when :multi + # return the array directly as typhoeus will handle it as expected + param + else + fail "unknown collection format: #{collection_format.inspect}" + end + end + end +end diff --git a/lib/clients/channel-access-token/lib/line_client_channel_access_token/api_error.rb b/lib/clients/channel-access-token/lib/line_client_channel_access_token/api_error.rb new file mode 100644 index 00000000..ab7fe9d9 --- /dev/null +++ b/lib/clients/channel-access-token/lib/line_client_channel_access_token/api_error.rb @@ -0,0 +1,58 @@ +=begin +#Channel Access Token API + +#This document describes Channel Access Token API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::ChannelAccessToken + class ApiError < StandardError + attr_reader :code, :response_headers, :response_body + + # Usage examples: + # ApiError.new + # ApiError.new("message") + # ApiError.new(:code => 500, :response_headers => {}, :response_body => "") + # ApiError.new(:code => 404, :message => "Not Found") + def initialize(arg = nil) + if arg.is_a? Hash + if arg.key?(:message) || arg.key?('message') + super(arg[:message] || arg['message']) + else + super arg + end + + arg.each do |k, v| + instance_variable_set "@#{k}", v + end + else + super arg + @message = arg + end + end + + # Override to_s to display a friendly error message + def to_s + message + end + + def message + if @message.nil? + msg = "Error message: the server returns an error" + else + msg = @message + end + + msg += "\nHTTP status code: #{code}" if code + msg += "\nResponse headers: #{response_headers}" if response_headers + msg += "\nResponse body: #{response_body}" if response_body + + msg + end + end +end diff --git a/lib/clients/channel-access-token/lib/line_client_channel_access_token/configuration.rb b/lib/clients/channel-access-token/lib/line_client_channel_access_token/configuration.rb new file mode 100644 index 00000000..fe23f77f --- /dev/null +++ b/lib/clients/channel-access-token/lib/line_client_channel_access_token/configuration.rb @@ -0,0 +1,297 @@ +=begin +#Channel Access Token API + +#This document describes Channel Access Token API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::ChannelAccessToken + class Configuration + # Defines url scheme + attr_accessor :scheme + + # Defines url host + attr_accessor :host + + # Defines url base path + attr_accessor :base_path + + # Define server configuration index + attr_accessor :server_index + + # Define server operation configuration index + attr_accessor :server_operation_index + + # Default server variables + attr_accessor :server_variables + + # Default server operation variables + attr_accessor :server_operation_variables + + # Defines API keys used with API Key authentications. + # + # @return [Hash] key: parameter name, value: parameter value (API key) + # + # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string) + # config.api_key['api_key'] = 'xxx' + attr_accessor :api_key + + # Defines API key prefixes used with API Key authentications. + # + # @return [Hash] key: parameter name, value: API key prefix + # + # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers) + # config.api_key_prefix['api_key'] = 'Token' + attr_accessor :api_key_prefix + + # Defines the username used with HTTP basic authentication. + # + # @return [String] + attr_accessor :username + + # Defines the password used with HTTP basic authentication. + # + # @return [String] + attr_accessor :password + + # Defines the access token (Bearer) used with OAuth2. + attr_accessor :access_token + + # Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2. + # Overrides the access_token if set + # @return [Proc] + attr_accessor :access_token_getter + + # Set this to return data as binary instead of downloading a temp file. When enabled (set to true) + # HTTP responses with return type `File` will be returned as a stream of binary data. + # Default to false. + attr_accessor :return_binary_data + + # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response + # details will be logged with `logger.debug` (see the `logger` attribute). + # Default to false. + # + # @return [true, false] + attr_accessor :debugging + + # Defines the logger used for debugging. + # Default to `Rails.logger` (when in Rails) or logging to STDOUT. + # + # @return [#debug] + attr_accessor :logger + + # Defines the temporary folder to store downloaded files + # (for API endpoints that have file response). + # Default to use `Tempfile`. + # + # @return [String] + attr_accessor :temp_folder_path + + # The time limit for HTTP request in seconds. + # Default to 0 (never times out). + attr_accessor :timeout + + # Set this to false to skip client side validation in the operation. + # Default to true. + # @return [true, false] + attr_accessor :client_side_validation + + ### TLS/SSL setting + # Set this to false to skip verifying SSL certificate when calling API from https server. + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl + + ### TLS/SSL setting + # Set this to false to skip verifying SSL host name + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl_host + + ### TLS/SSL setting + # Set this to customize the certificate file to verify the peer. + # + # @return [String] the path to the certificate file + # + # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code: + # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145 + attr_accessor :ssl_ca_cert + + ### TLS/SSL setting + # Client certificate file (for client certificate) + attr_accessor :cert_file + + ### TLS/SSL setting + # Client private key file (for client certificate) + attr_accessor :key_file + + # Set this to customize parameters encoding of array parameter with multi collectionFormat. + # Default to nil. + # + # @see The params_encoding option of Ethon. Related source code: + # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 + attr_accessor :params_encoding + + + attr_accessor :inject_format + + attr_accessor :force_ending_format + + def initialize + @scheme = 'https' + @host = 'api.line.me' + @base_path = '' + @server_index = nil + @server_operation_index = {} + @server_variables = {} + @server_operation_variables = {} + @api_key = {} + @api_key_prefix = {} + @client_side_validation = true + @verify_ssl = true + @verify_ssl_host = true + @cert_file = nil + @key_file = nil + @timeout = 0 + @params_encoding = nil + @debugging = false + @inject_format = false + @force_ending_format = false + @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) + + yield(self) if block_given? + end + + # The default Configuration object. + def self.default + @@default ||= Configuration.new + end + + def configure + yield(self) if block_given? + end + + def scheme=(scheme) + # remove :// from scheme + @scheme = scheme.sub(/:\/\//, '') + end + + def host=(host) + # remove http(s):// and anything after a slash + @host = host.sub(/https?:\/\//, '').split('/').first + end + + def base_path=(base_path) + # Add leading and trailing slashes to base_path + @base_path = "/#{base_path}".gsub(/\/+/, '/') + @base_path = '' if @base_path == '/' + end + + # Returns base URL for specified operation based on server settings + def base_url(operation = nil) + if operation_server_settings.key?(operation) then + index = server_operation_index.fetch(operation, server_index) + server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) + else + server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil) + end + end + + # Gets API key (with prefix if set). + # @param [String] param_name the parameter name of API key auth + def api_key_with_prefix(param_name, param_alias = nil) + key = @api_key[param_name] + key = @api_key.fetch(param_alias, key) unless param_alias.nil? + if @api_key_prefix[param_name] + "#{@api_key_prefix[param_name]} #{key}" + else + key + end + end + + # Gets access_token using access_token_getter or uses the static access_token + def access_token_with_refresh + return access_token if access_token_getter.nil? + access_token_getter.call + end + + # Gets Basic Auth token string + def basic_auth_token + 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") + end + + # Returns Auth Settings hash for api client. + def auth_settings + { + 'Bearer' => + { + type: 'bearer', + in: 'header', + key: 'Authorization', + value: "Bearer #{access_token_with_refresh}" + }, + } + end + + # Returns an array of Server setting + def server_settings + [ + { + url: "https://api.line.me", + description: "No description provided", + } + ] + end + + def operation_server_settings + { + } + end + + # Returns URL based on server settings + # + # @param index array index of the server settings + # @param variables hash of variable and the corresponding value + def server_url(index, variables = {}, servers = nil) + servers = server_settings if servers == nil + + # check array index out of bound + if (index.nil? || index < 0 || index >= servers.size) + fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}" + end + + server = servers[index] + url = server[:url] + + return url unless server.key? :variables + + # go through variable and assign a value + server[:variables].each do |name, variable| + if variables.key?(name) + if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name])) + url.gsub! "{" + name.to_s + "}", variables[name] + else + fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}." + end + else + # use default value + url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] + end + end + + url + end + + end +end diff --git a/lib/clients/channel-access-token/lib/line_client_channel_access_token/models/channel_access_token_key_ids_response.rb b/lib/clients/channel-access-token/lib/line_client_channel_access_token/models/channel_access_token_key_ids_response.rb new file mode 100644 index 00000000..89952c17 --- /dev/null +++ b/lib/clients/channel-access-token/lib/line_client_channel_access_token/models/channel_access_token_key_ids_response.rb @@ -0,0 +1,230 @@ +=begin +#Channel Access Token API + +#This document describes Channel Access Token API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ChannelAccessToken + # Channel access token key IDs + class ChannelAccessTokenKeyIdsResponse + # Array of channel access token key IDs. + attr_accessor :kids + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'kids' => :'kids' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'kids' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::ChannelAccessToken::ChannelAccessTokenKeyIdsResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::ChannelAccessToken::ChannelAccessTokenKeyIdsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'kids') + if (value = attributes[:'kids']).is_a?(Array) + self.kids = value + end + else + self.kids = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @kids.nil? + invalid_properties.push('invalid value for "kids", kids cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @kids.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + kids == o.kids + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [kids].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::ChannelAccessToken.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/channel-access-token/lib/line_client_channel_access_token/models/error_response.rb b/lib/clients/channel-access-token/lib/line_client_channel_access_token/models/error_response.rb new file mode 100644 index 00000000..b08ed43a --- /dev/null +++ b/lib/clients/channel-access-token/lib/line_client_channel_access_token/models/error_response.rb @@ -0,0 +1,231 @@ +=begin +#Channel Access Token API + +#This document describes Channel Access Token API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ChannelAccessToken + # Error response of the Channel access token + class ErrorResponse + # Error summary + attr_accessor :error + + # Details of the error. Not returned in certain situations. + attr_accessor :error_description + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'error' => :'error', + :'error_description' => :'error_description' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'error' => :'String', + :'error_description' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::ChannelAccessToken::ErrorResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::ChannelAccessToken::ErrorResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'error') + self.error = attributes[:'error'] + end + + if attributes.key?(:'error_description') + self.error_description = attributes[:'error_description'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + error == o.error && + error_description == o.error_description + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [error, error_description].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::ChannelAccessToken.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/channel-access-token/lib/line_client_channel_access_token/models/issue_channel_access_token_response.rb b/lib/clients/channel-access-token/lib/line_client_channel_access_token/models/issue_channel_access_token_response.rb new file mode 100644 index 00000000..0134efc5 --- /dev/null +++ b/lib/clients/channel-access-token/lib/line_client_channel_access_token/models/issue_channel_access_token_response.rb @@ -0,0 +1,279 @@ +=begin +#Channel Access Token API + +#This document describes Channel Access Token API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ChannelAccessToken + # Issued channel access token + class IssueChannelAccessTokenResponse + # Channel access token. + attr_accessor :access_token + + # Amount of time in seconds from issue to expiration of the channel access token + attr_accessor :expires_in + + # A token type. + attr_accessor :token_type + + # Unique key ID for identifying the channel access token. + attr_accessor :key_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'access_token' => :'access_token', + :'expires_in' => :'expires_in', + :'token_type' => :'token_type', + :'key_id' => :'key_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'access_token' => :'String', + :'expires_in' => :'Integer', + :'token_type' => :'String', + :'key_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::ChannelAccessToken::IssueChannelAccessTokenResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::ChannelAccessToken::IssueChannelAccessTokenResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'access_token') + self.access_token = attributes[:'access_token'] + else + self.access_token = nil + end + + if attributes.key?(:'expires_in') + self.expires_in = attributes[:'expires_in'] + else + self.expires_in = nil + end + + if attributes.key?(:'token_type') + self.token_type = attributes[:'token_type'] + else + self.token_type = 'Bearer' + end + + if attributes.key?(:'key_id') + self.key_id = attributes[:'key_id'] + else + self.key_id = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @access_token.nil? + invalid_properties.push('invalid value for "access_token", access_token cannot be nil.') + end + + if @expires_in.nil? + invalid_properties.push('invalid value for "expires_in", expires_in cannot be nil.') + end + + if @token_type.nil? + invalid_properties.push('invalid value for "token_type", token_type cannot be nil.') + end + + if @key_id.nil? + invalid_properties.push('invalid value for "key_id", key_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @access_token.nil? + return false if @expires_in.nil? + return false if @token_type.nil? + return false if @key_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + access_token == o.access_token && + expires_in == o.expires_in && + token_type == o.token_type && + key_id == o.key_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [access_token, expires_in, token_type, key_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::ChannelAccessToken.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/channel-access-token/lib/line_client_channel_access_token/models/issue_short_lived_channel_access_token_response.rb b/lib/clients/channel-access-token/lib/line_client_channel_access_token/models/issue_short_lived_channel_access_token_response.rb new file mode 100644 index 00000000..4aaa2c4c --- /dev/null +++ b/lib/clients/channel-access-token/lib/line_client_channel_access_token/models/issue_short_lived_channel_access_token_response.rb @@ -0,0 +1,262 @@ +=begin +#Channel Access Token API + +#This document describes Channel Access Token API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ChannelAccessToken + # Issued short-lived channel access token + class IssueShortLivedChannelAccessTokenResponse + # A short-lived channel access token. Valid for 30 days. Note: Channel access tokens cannot be refreshed. + attr_accessor :access_token + + # Time until channel access token expires in seconds from time the token is issued. + attr_accessor :expires_in + + # Token type. The value is always `Bearer`. + attr_accessor :token_type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'access_token' => :'access_token', + :'expires_in' => :'expires_in', + :'token_type' => :'token_type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'access_token' => :'String', + :'expires_in' => :'Integer', + :'token_type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::ChannelAccessToken::IssueShortLivedChannelAccessTokenResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::ChannelAccessToken::IssueShortLivedChannelAccessTokenResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'access_token') + self.access_token = attributes[:'access_token'] + else + self.access_token = nil + end + + if attributes.key?(:'expires_in') + self.expires_in = attributes[:'expires_in'] + else + self.expires_in = nil + end + + if attributes.key?(:'token_type') + self.token_type = attributes[:'token_type'] + else + self.token_type = 'Bearer' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @access_token.nil? + invalid_properties.push('invalid value for "access_token", access_token cannot be nil.') + end + + if @expires_in.nil? + invalid_properties.push('invalid value for "expires_in", expires_in cannot be nil.') + end + + if @token_type.nil? + invalid_properties.push('invalid value for "token_type", token_type cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @access_token.nil? + return false if @expires_in.nil? + return false if @token_type.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + access_token == o.access_token && + expires_in == o.expires_in && + token_type == o.token_type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [access_token, expires_in, token_type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::ChannelAccessToken.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/channel-access-token/lib/line_client_channel_access_token/models/issue_stateless_channel_access_token_response.rb b/lib/clients/channel-access-token/lib/line_client_channel_access_token/models/issue_stateless_channel_access_token_response.rb new file mode 100644 index 00000000..d018b889 --- /dev/null +++ b/lib/clients/channel-access-token/lib/line_client_channel_access_token/models/issue_stateless_channel_access_token_response.rb @@ -0,0 +1,262 @@ +=begin +#Channel Access Token API + +#This document describes Channel Access Token API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ChannelAccessToken + # Issued stateless channel access token + class IssueStatelessChannelAccessTokenResponse + # A stateless channel access token. The token is an opaque string which means its format is an implementation detail and the consumer of this token should never try to use the data parsed from the token. + attr_accessor :access_token + + # Duration in seconds after which the issued access token expires + attr_accessor :expires_in + + # Token type. The value is always `Bearer`. + attr_accessor :token_type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'access_token' => :'access_token', + :'expires_in' => :'expires_in', + :'token_type' => :'token_type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'access_token' => :'String', + :'expires_in' => :'Integer', + :'token_type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::ChannelAccessToken::IssueStatelessChannelAccessTokenResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::ChannelAccessToken::IssueStatelessChannelAccessTokenResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'access_token') + self.access_token = attributes[:'access_token'] + else + self.access_token = nil + end + + if attributes.key?(:'expires_in') + self.expires_in = attributes[:'expires_in'] + else + self.expires_in = nil + end + + if attributes.key?(:'token_type') + self.token_type = attributes[:'token_type'] + else + self.token_type = 'Bearer' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @access_token.nil? + invalid_properties.push('invalid value for "access_token", access_token cannot be nil.') + end + + if @expires_in.nil? + invalid_properties.push('invalid value for "expires_in", expires_in cannot be nil.') + end + + if @token_type.nil? + invalid_properties.push('invalid value for "token_type", token_type cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @access_token.nil? + return false if @expires_in.nil? + return false if @token_type.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + access_token == o.access_token && + expires_in == o.expires_in && + token_type == o.token_type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [access_token, expires_in, token_type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::ChannelAccessToken.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/channel-access-token/lib/line_client_channel_access_token/models/verify_channel_access_token_response.rb b/lib/clients/channel-access-token/lib/line_client_channel_access_token/models/verify_channel_access_token_response.rb new file mode 100644 index 00000000..6c8a6c01 --- /dev/null +++ b/lib/clients/channel-access-token/lib/line_client_channel_access_token/models/verify_channel_access_token_response.rb @@ -0,0 +1,255 @@ +=begin +#Channel Access Token API + +#This document describes Channel Access Token API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ChannelAccessToken + # Verification result + class VerifyChannelAccessTokenResponse + # The channel ID for which the channel access token was issued. + attr_accessor :client_id + + # Number of seconds before the channel access token expires. + attr_accessor :expires_in + + # Permissions granted to the channel access token. + attr_accessor :scope + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'client_id' => :'client_id', + :'expires_in' => :'expires_in', + :'scope' => :'scope' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'client_id' => :'String', + :'expires_in' => :'Integer', + :'scope' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::ChannelAccessToken::VerifyChannelAccessTokenResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::ChannelAccessToken::VerifyChannelAccessTokenResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'client_id') + self.client_id = attributes[:'client_id'] + else + self.client_id = nil + end + + if attributes.key?(:'expires_in') + self.expires_in = attributes[:'expires_in'] + else + self.expires_in = nil + end + + if attributes.key?(:'scope') + self.scope = attributes[:'scope'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @client_id.nil? + invalid_properties.push('invalid value for "client_id", client_id cannot be nil.') + end + + if @expires_in.nil? + invalid_properties.push('invalid value for "expires_in", expires_in cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @client_id.nil? + return false if @expires_in.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + client_id == o.client_id && + expires_in == o.expires_in && + scope == o.scope + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [client_id, expires_in, scope].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::ChannelAccessToken.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/channel-access-token/lib/line_client_channel_access_token/version.rb b/lib/clients/channel-access-token/lib/line_client_channel_access_token/version.rb new file mode 100644 index 00000000..175a8491 --- /dev/null +++ b/lib/clients/channel-access-token/lib/line_client_channel_access_token/version.rb @@ -0,0 +1,15 @@ +=begin +#Channel Access Token API + +#This document describes Channel Access Token API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::ChannelAccessToken + VERSION = '2.0.0' +end diff --git a/lib/clients/insight/.gitignore b/lib/clients/insight/.gitignore new file mode 100644 index 00000000..05a17cb8 --- /dev/null +++ b/lib/clients/insight/.gitignore @@ -0,0 +1,39 @@ +# Generated by: https://openapi-generator.tech +# + +*.gem +*.rbc +/.config +/coverage/ +/InstalledFiles +/pkg/ +/spec/reports/ +/spec/examples.txt +/test/tmp/ +/test/version_tmp/ +/tmp/ + +## Specific to RubyMotion: +.dat* +.repl_history +build/ + +## Documentation cache and generated files: +/.yardoc/ +/_yardoc/ +/doc/ +/rdoc/ + +## Environment normalization: +/.bundle/ +/vendor/bundle +/lib/bundler/man/ + +# for a library or gem, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# Gemfile.lock +# .ruby-version +# .ruby-gemset + +# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: +.rvmrc diff --git a/lib/clients/insight/.openapi-generator/FILES b/lib/clients/insight/.openapi-generator/FILES new file mode 100644 index 00000000..e0ecb784 --- /dev/null +++ b/lib/clients/insight/.openapi-generator/FILES @@ -0,0 +1,56 @@ +.gitignore +.gitlab-ci.yml +.rspec +.rubocop.yml +.travis.yml +Gemfile +README.md +Rakefile +docs/AgeTile.md +docs/AppTypeTile.md +docs/AreaTile.md +docs/ErrorDetail.md +docs/ErrorResponse.md +docs/GenderTile.md +docs/GetFriendsDemographicsResponse.md +docs/GetMessageEventResponse.md +docs/GetMessageEventResponseClick.md +docs/GetMessageEventResponseMessage.md +docs/GetMessageEventResponseOverview.md +docs/GetNumberOfFollowersResponse.md +docs/GetNumberOfMessageDeliveriesResponse.md +docs/GetStatisticsPerUnitResponse.md +docs/GetStatisticsPerUnitResponseClick.md +docs/GetStatisticsPerUnitResponseMessage.md +docs/GetStatisticsPerUnitResponseOverview.md +docs/InsightApi.md +docs/SubscriptionPeriodTile.md +git_push.sh +lib/line_client_insight.rb +lib/line_client_insight/api/insight_api.rb +lib/line_client_insight/api_client.rb +lib/line_client_insight/api_error.rb +lib/line_client_insight/configuration.rb +lib/line_client_insight/models/age_tile.rb +lib/line_client_insight/models/app_type_tile.rb +lib/line_client_insight/models/area_tile.rb +lib/line_client_insight/models/error_detail.rb +lib/line_client_insight/models/error_response.rb +lib/line_client_insight/models/gender_tile.rb +lib/line_client_insight/models/get_friends_demographics_response.rb +lib/line_client_insight/models/get_message_event_response.rb +lib/line_client_insight/models/get_message_event_response_click.rb +lib/line_client_insight/models/get_message_event_response_message.rb +lib/line_client_insight/models/get_message_event_response_overview.rb +lib/line_client_insight/models/get_number_of_followers_response.rb +lib/line_client_insight/models/get_number_of_message_deliveries_response.rb +lib/line_client_insight/models/get_statistics_per_unit_response.rb +lib/line_client_insight/models/get_statistics_per_unit_response_click.rb +lib/line_client_insight/models/get_statistics_per_unit_response_message.rb +lib/line_client_insight/models/get_statistics_per_unit_response_overview.rb +lib/line_client_insight/models/subscription_period_tile.rb +lib/line_client_insight/version.rb +line_client_insight.gemspec +spec/api_client_spec.rb +spec/configuration_spec.rb +spec/spec_helper.rb diff --git a/lib/clients/insight/.openapi-generator/VERSION b/lib/clients/insight/.openapi-generator/VERSION new file mode 100644 index 00000000..41225218 --- /dev/null +++ b/lib/clients/insight/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.0.0 \ No newline at end of file diff --git a/lib/clients/insight/README.md b/lib/clients/insight/README.md new file mode 100644 index 00000000..48a688c0 --- /dev/null +++ b/lib/clients/insight/README.md @@ -0,0 +1,118 @@ +# LINE::Client::Insight + +This document describes LINE Messaging API(Insight). + +This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 0.0.1 +- Package version: 2.0.0 +- Build package: org.openapitools.codegen.languages.RubyClientCodegen + +## Installation + +### Build a gem + +To build the Ruby code into a gem: + +```shell +gem build line-bot-api.gemspec +``` + +Then either install the gem locally: + +```shell +gem install ./line-bot-api-2.0.0.gem +``` + +(for development, run `gem install --dev ./line-bot-api-2.0.0.gem` to install the development dependencies) + +or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/). + +Finally add this to the Gemfile: + + gem 'line-bot-api', '~> 2.0.0' + +### Install from Git + +If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile: + + gem 'line-bot-api', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git' + +### Include the Ruby code directly + +Include the Ruby code directly using `-I` as follows: + +```shell +ruby -Ilib script.rb +``` + +## Getting Started + +Please follow the [installation](#installation) procedure and then run the following code: + +```ruby +# Load the gem +require 'line-bot-api' + +# Setup authorization +LINE::Client::Insight.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' + # Configure a proc to get access tokens in lieu of the static access_token configuration + config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' } +end + +api_instance = LINE::Client::Insight::InsightApi.new + +begin + result = api_instance.get_friends_demographics + p result +rescue LINE::Client::Insight::ApiError => e + puts "Exception when calling InsightApi->get_friends_demographics: #{e}" +end + +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://api.line.me* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*LINE::Client::Insight::InsightApi* | [**get_friends_demographics**](docs/InsightApi.md#get_friends_demographics) | **GET** /v2/bot/insight/demographic | +*LINE::Client::Insight::InsightApi* | [**get_message_event**](docs/InsightApi.md#get_message_event) | **GET** /v2/bot/insight/message/event | Get user interaction statistics +*LINE::Client::Insight::InsightApi* | [**get_number_of_followers**](docs/InsightApi.md#get_number_of_followers) | **GET** /v2/bot/insight/followers | Get number of followers +*LINE::Client::Insight::InsightApi* | [**get_number_of_message_deliveries**](docs/InsightApi.md#get_number_of_message_deliveries) | **GET** /v2/bot/insight/message/delivery | Get number of message deliveries +*LINE::Client::Insight::InsightApi* | [**get_statistics_per_unit**](docs/InsightApi.md#get_statistics_per_unit) | **GET** /v2/bot/insight/message/event/aggregation | + + +## Documentation for Models + + - [LINE::Client::Insight::AgeTile](docs/AgeTile.md) + - [LINE::Client::Insight::AppTypeTile](docs/AppTypeTile.md) + - [LINE::Client::Insight::AreaTile](docs/AreaTile.md) + - [LINE::Client::Insight::ErrorDetail](docs/ErrorDetail.md) + - [LINE::Client::Insight::ErrorResponse](docs/ErrorResponse.md) + - [LINE::Client::Insight::GenderTile](docs/GenderTile.md) + - [LINE::Client::Insight::GetFriendsDemographicsResponse](docs/GetFriendsDemographicsResponse.md) + - [LINE::Client::Insight::GetMessageEventResponse](docs/GetMessageEventResponse.md) + - [LINE::Client::Insight::GetMessageEventResponseClick](docs/GetMessageEventResponseClick.md) + - [LINE::Client::Insight::GetMessageEventResponseMessage](docs/GetMessageEventResponseMessage.md) + - [LINE::Client::Insight::GetMessageEventResponseOverview](docs/GetMessageEventResponseOverview.md) + - [LINE::Client::Insight::GetNumberOfFollowersResponse](docs/GetNumberOfFollowersResponse.md) + - [LINE::Client::Insight::GetNumberOfMessageDeliveriesResponse](docs/GetNumberOfMessageDeliveriesResponse.md) + - [LINE::Client::Insight::GetStatisticsPerUnitResponse](docs/GetStatisticsPerUnitResponse.md) + - [LINE::Client::Insight::GetStatisticsPerUnitResponseClick](docs/GetStatisticsPerUnitResponseClick.md) + - [LINE::Client::Insight::GetStatisticsPerUnitResponseMessage](docs/GetStatisticsPerUnitResponseMessage.md) + - [LINE::Client::Insight::GetStatisticsPerUnitResponseOverview](docs/GetStatisticsPerUnitResponseOverview.md) + - [LINE::Client::Insight::SubscriptionPeriodTile](docs/SubscriptionPeriodTile.md) + + +## Documentation for Authorization + + +Authentication schemes defined for the API: +### Bearer + +- **Type**: Bearer authentication + diff --git a/lib/clients/insight/docs/AgeTile.md b/lib/clients/insight/docs/AgeTile.md new file mode 100644 index 00000000..6c132746 --- /dev/null +++ b/lib/clients/insight/docs/AgeTile.md @@ -0,0 +1,20 @@ +# LINE::Client::Insight::AgeTile + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **age** | **String** | users' age | [optional] | +| **percentage** | **Float** | Percentage | [optional] | + +## Example + +```ruby +require 'line_client_insight' + +instance = LINE::Client::Insight::AgeTile.new( + age: null, + percentage: null +) +``` + diff --git a/lib/clients/insight/docs/AppTypeTile.md b/lib/clients/insight/docs/AppTypeTile.md new file mode 100644 index 00000000..9d90aa97 --- /dev/null +++ b/lib/clients/insight/docs/AppTypeTile.md @@ -0,0 +1,20 @@ +# LINE::Client::Insight::AppTypeTile + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **app_type** | **String** | users' OS | [optional] | +| **percentage** | **Float** | Percentage | [optional] | + +## Example + +```ruby +require 'line_client_insight' + +instance = LINE::Client::Insight::AppTypeTile.new( + app_type: null, + percentage: null +) +``` + diff --git a/lib/clients/insight/docs/AreaTile.md b/lib/clients/insight/docs/AreaTile.md new file mode 100644 index 00000000..9b6eec40 --- /dev/null +++ b/lib/clients/insight/docs/AreaTile.md @@ -0,0 +1,20 @@ +# LINE::Client::Insight::AreaTile + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **area** | **String** | users' country and region | [optional] | +| **percentage** | **Float** | Percentage | [optional] | + +## Example + +```ruby +require 'line_client_insight' + +instance = LINE::Client::Insight::AreaTile.new( + area: null, + percentage: null +) +``` + diff --git a/lib/clients/insight/docs/ErrorDetail.md b/lib/clients/insight/docs/ErrorDetail.md new file mode 100644 index 00000000..f06f4899 --- /dev/null +++ b/lib/clients/insight/docs/ErrorDetail.md @@ -0,0 +1,20 @@ +# LINE::Client::Insight::ErrorDetail + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **message** | **String** | Details of the error. Not included in the response under certain situations. | [optional] | +| **property** | **String** | Location of where the error occurred. Returns the JSON field name or query parameter name of the request. Not included in the response under certain situations. | [optional] | + +## Example + +```ruby +require 'line_client_insight' + +instance = LINE::Client::Insight::ErrorDetail.new( + message: null, + property: null +) +``` + diff --git a/lib/clients/insight/docs/ErrorResponse.md b/lib/clients/insight/docs/ErrorResponse.md new file mode 100644 index 00000000..3f30d50d --- /dev/null +++ b/lib/clients/insight/docs/ErrorResponse.md @@ -0,0 +1,20 @@ +# LINE::Client::Insight::ErrorResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **message** | **String** | Message containing information about the error. | | +| **details** | [**Array<ErrorDetail>**](ErrorDetail.md) | An array of error details. If the array is empty, this property will not be included in the response. | [optional] | + +## Example + +```ruby +require 'line_client_insight' + +instance = LINE::Client::Insight::ErrorResponse.new( + message: null, + details: null +) +``` + diff --git a/lib/clients/insight/docs/GenderTile.md b/lib/clients/insight/docs/GenderTile.md new file mode 100644 index 00000000..d0f58720 --- /dev/null +++ b/lib/clients/insight/docs/GenderTile.md @@ -0,0 +1,20 @@ +# LINE::Client::Insight::GenderTile + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **gender** | **String** | users' gender | [optional] | +| **percentage** | **Float** | Percentage | [optional] | + +## Example + +```ruby +require 'line_client_insight' + +instance = LINE::Client::Insight::GenderTile.new( + gender: null, + percentage: null +) +``` + diff --git a/lib/clients/insight/docs/GetFriendsDemographicsResponse.md b/lib/clients/insight/docs/GetFriendsDemographicsResponse.md new file mode 100644 index 00000000..b281492a --- /dev/null +++ b/lib/clients/insight/docs/GetFriendsDemographicsResponse.md @@ -0,0 +1,28 @@ +# LINE::Client::Insight::GetFriendsDemographicsResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **available** | **Boolean** | true if friend demographic information is available. | [optional] | +| **genders** | [**Array<GenderTile>**](GenderTile.md) | Percentage per gender. | [optional] | +| **ages** | [**Array<AgeTile>**](AgeTile.md) | Percentage per age group. | [optional] | +| **areas** | [**Array<AreaTile>**](AreaTile.md) | Percentage per area. | [optional] | +| **app_types** | [**Array<AppTypeTile>**](AppTypeTile.md) | Percentage by OS. | [optional] | +| **subscription_periods** | [**Array<SubscriptionPeriodTile>**](SubscriptionPeriodTile.md) | Percentage per friendship duration. | [optional] | + +## Example + +```ruby +require 'line_client_insight' + +instance = LINE::Client::Insight::GetFriendsDemographicsResponse.new( + available: null, + genders: null, + ages: null, + areas: null, + app_types: null, + subscription_periods: null +) +``` + diff --git a/lib/clients/insight/docs/GetMessageEventResponse.md b/lib/clients/insight/docs/GetMessageEventResponse.md new file mode 100644 index 00000000..5c0c84a6 --- /dev/null +++ b/lib/clients/insight/docs/GetMessageEventResponse.md @@ -0,0 +1,22 @@ +# LINE::Client::Insight::GetMessageEventResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **overview** | [**GetMessageEventResponseOverview**](GetMessageEventResponseOverview.md) | | [optional] | +| **messages** | [**Array<GetMessageEventResponseMessage>**](GetMessageEventResponseMessage.md) | Array of information about individual message bubbles. | [optional] | +| **clicks** | [**Array<GetMessageEventResponseClick>**](GetMessageEventResponseClick.md) | Array of information about opened URLs in the message. | [optional] | + +## Example + +```ruby +require 'line_client_insight' + +instance = LINE::Client::Insight::GetMessageEventResponse.new( + overview: null, + messages: null, + clicks: null +) +``` + diff --git a/lib/clients/insight/docs/GetMessageEventResponseClick.md b/lib/clients/insight/docs/GetMessageEventResponseClick.md new file mode 100644 index 00000000..e3934e20 --- /dev/null +++ b/lib/clients/insight/docs/GetMessageEventResponseClick.md @@ -0,0 +1,26 @@ +# LINE::Client::Insight::GetMessageEventResponseClick + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **seq** | **Integer** | The URL's serial number. | [optional] | +| **url** | **String** | URL. | [optional] | +| **click** | **Integer** | Number of times the URL was opened. | [optional] | +| **unique_click** | **Integer** | Number of users that opened the URL. | [optional] | +| **unique_click_of_request** | **Integer** | Number of users who opened this url through any link in the message. If a message contains two links to the same URL and a user opens both links, they're counted only once. | [optional] | + +## Example + +```ruby +require 'line_client_insight' + +instance = LINE::Client::Insight::GetMessageEventResponseClick.new( + seq: null, + url: null, + click: null, + unique_click: null, + unique_click_of_request: null +) +``` + diff --git a/lib/clients/insight/docs/GetMessageEventResponseMessage.md b/lib/clients/insight/docs/GetMessageEventResponseMessage.md new file mode 100644 index 00000000..f85573c6 --- /dev/null +++ b/lib/clients/insight/docs/GetMessageEventResponseMessage.md @@ -0,0 +1,40 @@ +# LINE::Client::Insight::GetMessageEventResponseMessage + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **seq** | **Integer** | Bubble's serial number. | [optional] | +| **impression** | **Integer** | Number of times the bubble was displayed. | [optional] | +| **media_played** | **Integer** | Number of times audio or video in the bubble started playing. | [optional] | +| **media_played25_percent** | **Integer** | Number of times audio or video in the bubble started playing and was played 25% of the total time. | [optional] | +| **media_played50_percent** | **Integer** | Number of times audio or video in the bubble started playing and was played 50% of the total time. | [optional] | +| **media_played75_percent** | **Integer** | Number of times audio or video in the bubble started playing and was played 75% of the total time. | [optional] | +| **media_played100_percent** | **Integer** | Number of times audio or video in the bubble started playing and was played 100% of the total time. | [optional] | +| **unique_media_played** | **Integer** | Number of users that started playing audio or video in the bubble. | [optional] | +| **unique_media_played25_percent** | **Integer** | Number of users that started playing audio or video in the bubble and played 25% of the total time. | [optional] | +| **unique_media_played50_percent** | **Integer** | Number of users that started playing audio or video in the bubble and played 50% of the total time. | [optional] | +| **unique_media_played75_percent** | **Integer** | Number of users that started playing audio or video in the bubble and played 75% of the total time. | [optional] | +| **unique_media_played100_percent** | **Integer** | Number of users that started playing audio or video in the bubble and played 100% of the total time. | [optional] | + +## Example + +```ruby +require 'line_client_insight' + +instance = LINE::Client::Insight::GetMessageEventResponseMessage.new( + seq: null, + impression: null, + media_played: null, + media_played25_percent: null, + media_played50_percent: null, + media_played75_percent: null, + media_played100_percent: null, + unique_media_played: null, + unique_media_played25_percent: null, + unique_media_played50_percent: null, + unique_media_played75_percent: null, + unique_media_played100_percent: null +) +``` + diff --git a/lib/clients/insight/docs/GetMessageEventResponseOverview.md b/lib/clients/insight/docs/GetMessageEventResponseOverview.md new file mode 100644 index 00000000..5bf6a5a6 --- /dev/null +++ b/lib/clients/insight/docs/GetMessageEventResponseOverview.md @@ -0,0 +1,30 @@ +# LINE::Client::Insight::GetMessageEventResponseOverview + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **request_id** | **String** | Request ID. | [optional] | +| **timestamp** | **Integer** | UNIX timestamp for message delivery time in seconds. | [optional] | +| **delivered** | **Integer** | Number of messages delivered. This property shows values of less than 20. However, if all messages have not been sent, it will be null. | [optional] | +| **unique_impression** | **Integer** | Number of users who opened the message, meaning they displayed at least 1 bubble. | [optional] | +| **unique_click** | **Integer** | Number of users who opened any URL in the message. | [optional] | +| **unique_media_played** | **Integer** | Number of users who started playing any video or audio in the message. | [optional] | +| **unique_media_played100_percent** | **Integer** | Number of users who played the entirety of any video or audio in the message. | [optional] | + +## Example + +```ruby +require 'line_client_insight' + +instance = LINE::Client::Insight::GetMessageEventResponseOverview.new( + request_id: null, + timestamp: null, + delivered: null, + unique_impression: null, + unique_click: null, + unique_media_played: null, + unique_media_played100_percent: null +) +``` + diff --git a/lib/clients/insight/docs/GetNumberOfFollowersResponse.md b/lib/clients/insight/docs/GetNumberOfFollowersResponse.md new file mode 100644 index 00000000..7c9e07d0 --- /dev/null +++ b/lib/clients/insight/docs/GetNumberOfFollowersResponse.md @@ -0,0 +1,24 @@ +# LINE::Client::Insight::GetNumberOfFollowersResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **status** | **String** | Calculation status. | [optional] | +| **followers** | **Integer** | The number of times, as of the specified date, that a user added this LINE Official Account as a friend for the first time. The number doesn't decrease even if a user later blocks the account or when they delete their LINE account. | [optional] | +| **targeted_reaches** | **Integer** | The number of users, as of the specified date, that the LINE Official Account can reach through targeted messages based on gender, age, and/or region. This number only includes users who are active on LINE or LINE services and whose demographics have a high level of certainty. | [optional] | +| **blocks** | **Integer** | The number of users blocking the account as of the specified date. The number decreases when a user unblocks the account. | [optional] | + +## Example + +```ruby +require 'line_client_insight' + +instance = LINE::Client::Insight::GetNumberOfFollowersResponse.new( + status: null, + followers: null, + targeted_reaches: null, + blocks: null +) +``` + diff --git a/lib/clients/insight/docs/GetNumberOfMessageDeliveriesResponse.md b/lib/clients/insight/docs/GetNumberOfMessageDeliveriesResponse.md new file mode 100644 index 00000000..603b4834 --- /dev/null +++ b/lib/clients/insight/docs/GetNumberOfMessageDeliveriesResponse.md @@ -0,0 +1,38 @@ +# LINE::Client::Insight::GetNumberOfMessageDeliveriesResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **status** | **String** | Status of the counting process. | [optional] | +| **broadcast** | **Integer** | Number of messages sent to all of this LINE Official Account's friends (broadcast messages). | [optional] | +| **targeting** | **Integer** | Number of messages sent to some of this LINE Official Account's friends, based on specific attributes (targeted messages). | [optional] | +| **auto_response** | **Integer** | Number of auto-response messages sent. | [optional] | +| **welcome_response** | **Integer** | Number of greeting messages sent. | [optional] | +| **chat** | **Integer** | Number of messages sent from LINE Official Account Manager [Chat screen](https://www.linebiz.com/jp/manual/OfficialAccountManager/chats/) (only available in Japanese). | [optional] | +| **api_broadcast** | **Integer** | Number of broadcast messages sent with the `Send broadcast message` Messaging API operation. | [optional] | +| **api_push** | **Integer** | Number of push messages sent with the `Send push message` Messaging API operation. | [optional] | +| **api_multicast** | **Integer** | Number of multicast messages sent with the `Send multicast message` Messaging API operation. | [optional] | +| **api_narrowcast** | **Integer** | Number of narrowcast messages sent with the `Send narrowcast message` Messaging API operation. | [optional] | +| **api_reply** | **Integer** | Number of replies sent with the `Send reply message` Messaging API operation. | [optional] | + +## Example + +```ruby +require 'line_client_insight' + +instance = LINE::Client::Insight::GetNumberOfMessageDeliveriesResponse.new( + status: null, + broadcast: null, + targeting: null, + auto_response: null, + welcome_response: null, + chat: null, + api_broadcast: null, + api_push: null, + api_multicast: null, + api_narrowcast: null, + api_reply: null +) +``` + diff --git a/lib/clients/insight/docs/GetStatisticsPerUnitResponse.md b/lib/clients/insight/docs/GetStatisticsPerUnitResponse.md new file mode 100644 index 00000000..9a210ef6 --- /dev/null +++ b/lib/clients/insight/docs/GetStatisticsPerUnitResponse.md @@ -0,0 +1,22 @@ +# LINE::Client::Insight::GetStatisticsPerUnitResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **overview** | [**GetStatisticsPerUnitResponseOverview**](GetStatisticsPerUnitResponseOverview.md) | | | +| **messages** | [**Array<GetStatisticsPerUnitResponseMessage>**](GetStatisticsPerUnitResponseMessage.md) | Array of information about individual message bubbles. | | +| **clicks** | [**Array<GetStatisticsPerUnitResponseClick>**](GetStatisticsPerUnitResponseClick.md) | Array of information about opened URLs in the message. | | + +## Example + +```ruby +require 'line_client_insight' + +instance = LINE::Client::Insight::GetStatisticsPerUnitResponse.new( + overview: null, + messages: null, + clicks: null +) +``` + diff --git a/lib/clients/insight/docs/GetStatisticsPerUnitResponseClick.md b/lib/clients/insight/docs/GetStatisticsPerUnitResponseClick.md new file mode 100644 index 00000000..14bcd28d --- /dev/null +++ b/lib/clients/insight/docs/GetStatisticsPerUnitResponseClick.md @@ -0,0 +1,26 @@ +# LINE::Client::Insight::GetStatisticsPerUnitResponseClick + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **seq** | **Integer** | The URL's serial number. | | +| **url** | **String** | URL. | | +| **click** | **Integer** | Number of times the URL in the bubble was opened. | [optional] | +| **unique_click** | **Integer** | Number of users that opened the URL in the bubble. | [optional] | +| **unique_click_of_request** | **Integer** | Number of users who opened this url through any link in the message. If another message bubble contains the same URL and a user opens both links, it's counted only once. | [optional] | + +## Example + +```ruby +require 'line_client_insight' + +instance = LINE::Client::Insight::GetStatisticsPerUnitResponseClick.new( + seq: null, + url: null, + click: null, + unique_click: null, + unique_click_of_request: null +) +``` + diff --git a/lib/clients/insight/docs/GetStatisticsPerUnitResponseMessage.md b/lib/clients/insight/docs/GetStatisticsPerUnitResponseMessage.md new file mode 100644 index 00000000..8606fa67 --- /dev/null +++ b/lib/clients/insight/docs/GetStatisticsPerUnitResponseMessage.md @@ -0,0 +1,42 @@ +# LINE::Client::Insight::GetStatisticsPerUnitResponseMessage + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **seq** | **Integer** | Bubble's serial number. | | +| **impression** | **Integer** | Number of times the bubble was displayed. | [optional] | +| **media_played** | **Integer** | Number of times audio or video in the bubble started playing. | [optional] | +| **media_played25_percent** | **Integer** | Number of times audio or video in the bubble started playing and was played 25% of the total time. | [optional] | +| **media_played50_percent** | **Integer** | Number of times audio or video in the bubble started playing and was played 50% of the total time. | [optional] | +| **media_played75_percent** | **Integer** | Number of times audio or video in the bubble started playing and was played 75% of the total time. | [optional] | +| **media_played100_percent** | **Integer** | Number of times audio or video in the bubble started playing and was played 100% of the total time. | [optional] | +| **unique_impression** | **Integer** | Number of users the bubble was displayed. | [optional] | +| **unique_media_played** | **Integer** | Number of users that started playing audio or video in the bubble. | [optional] | +| **unique_media_played25_percent** | **Integer** | Number of users that started playing audio or video in the bubble and played 25% of the total time. | [optional] | +| **unique_media_played50_percent** | **Integer** | Number of users that started playing audio or video in the bubble and played 50% of the total time. | [optional] | +| **unique_media_played75_percent** | **Integer** | Number of users that started playing audio or video in the bubble and played 75% of the total time. | [optional] | +| **unique_media_played100_percent** | **Integer** | Number of users that started playing audio or video in the bubble and played 100% of the total time. | [optional] | + +## Example + +```ruby +require 'line_client_insight' + +instance = LINE::Client::Insight::GetStatisticsPerUnitResponseMessage.new( + seq: null, + impression: null, + media_played: null, + media_played25_percent: null, + media_played50_percent: null, + media_played75_percent: null, + media_played100_percent: null, + unique_impression: null, + unique_media_played: null, + unique_media_played25_percent: null, + unique_media_played50_percent: null, + unique_media_played75_percent: null, + unique_media_played100_percent: null +) +``` + diff --git a/lib/clients/insight/docs/GetStatisticsPerUnitResponseOverview.md b/lib/clients/insight/docs/GetStatisticsPerUnitResponseOverview.md new file mode 100644 index 00000000..22c37b4b --- /dev/null +++ b/lib/clients/insight/docs/GetStatisticsPerUnitResponseOverview.md @@ -0,0 +1,24 @@ +# LINE::Client::Insight::GetStatisticsPerUnitResponseOverview + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **unique_impression** | **Integer** | Number of users who opened the message, meaning they displayed at least 1 bubble. | [optional] | +| **unique_click** | **Integer** | Number of users who opened any URL in the message. | [optional] | +| **unique_media_played** | **Integer** | Number of users who started playing any video or audio in the message. | [optional] | +| **unique_media_played100_percent** | **Integer** | Number of users who played the entirety of any video or audio in the message. | [optional] | + +## Example + +```ruby +require 'line_client_insight' + +instance = LINE::Client::Insight::GetStatisticsPerUnitResponseOverview.new( + unique_impression: null, + unique_click: null, + unique_media_played: null, + unique_media_played100_percent: null +) +``` + diff --git a/lib/clients/insight/docs/InsightApi.md b/lib/clients/insight/docs/InsightApi.md new file mode 100644 index 00000000..1a9945a5 --- /dev/null +++ b/lib/clients/insight/docs/InsightApi.md @@ -0,0 +1,360 @@ +# LINE::Client::Insight::InsightApi + +All URIs are relative to *https://api.line.me* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**get_friends_demographics**](InsightApi.md#get_friends_demographics) | **GET** /v2/bot/insight/demographic | | +| [**get_message_event**](InsightApi.md#get_message_event) | **GET** /v2/bot/insight/message/event | Get user interaction statistics | +| [**get_number_of_followers**](InsightApi.md#get_number_of_followers) | **GET** /v2/bot/insight/followers | Get number of followers | +| [**get_number_of_message_deliveries**](InsightApi.md#get_number_of_message_deliveries) | **GET** /v2/bot/insight/message/delivery | Get number of message deliveries | +| [**get_statistics_per_unit**](InsightApi.md#get_statistics_per_unit) | **GET** /v2/bot/insight/message/event/aggregation | | + + +## get_friends_demographics + +> get_friends_demographics + + + +Retrieves the demographic attributes for a LINE Official Account's friends.You can only retrieve information about friends for LINE Official Accounts created by users in Japan (JP), Thailand (TH), Taiwan (TW) and Indonesia (ID). + +### Examples + +```ruby +require 'time' +require 'line_client_insight' +# setup authorization +LINE::Client::Insight.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::Insight::InsightApi.new + +begin + + result = api_instance.get_friends_demographics + p result +rescue LINE::Client::Insight::ApiError => e + puts "Error when calling InsightApi->get_friends_demographics: #{e}" +end +``` + +#### Using the get_friends_demographics_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_friends_demographics_with_http_info + +```ruby +begin + + data, status_code, headers = api_instance.get_friends_demographics_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::Insight::ApiError => e + puts "Error when calling InsightApi->get_friends_demographics_with_http_info: #{e}" +end +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**GetFriendsDemographicsResponse**](GetFriendsDemographicsResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_message_event + +> get_message_event(request_id) + +Get user interaction statistics + +Returns statistics about how users interact with narrowcast messages or broadcast messages sent from your LINE Official Account. + +### Examples + +```ruby +require 'time' +require 'line_client_insight' +# setup authorization +LINE::Client::Insight.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::Insight::InsightApi.new +request_id = 'request_id_example' # String | Request ID of a narrowcast message or broadcast message. Each Messaging API request has a request ID. + +begin + # Get user interaction statistics + result = api_instance.get_message_event(request_id) + p result +rescue LINE::Client::Insight::ApiError => e + puts "Error when calling InsightApi->get_message_event: #{e}" +end +``` + +#### Using the get_message_event_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_message_event_with_http_info(request_id) + +```ruby +begin + # Get user interaction statistics + data, status_code, headers = api_instance.get_message_event_with_http_info(request_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::Insight::ApiError => e + puts "Error when calling InsightApi->get_message_event_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **request_id** | **String** | Request ID of a narrowcast message or broadcast message. Each Messaging API request has a request ID. | | + +### Return type + +[**GetMessageEventResponse**](GetMessageEventResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_number_of_followers + +> get_number_of_followers(opts) + +Get number of followers + +Returns the number of users who have added the LINE Official Account on or before a specified date. + +### Examples + +```ruby +require 'time' +require 'line_client_insight' +# setup authorization +LINE::Client::Insight.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::Insight::InsightApi.new +opts = { + date: 'date_example' # String | Date for which to retrieve the number of followers. Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9 +} + +begin + # Get number of followers + result = api_instance.get_number_of_followers(opts) + p result +rescue LINE::Client::Insight::ApiError => e + puts "Error when calling InsightApi->get_number_of_followers: #{e}" +end +``` + +#### Using the get_number_of_followers_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_number_of_followers_with_http_info(opts) + +```ruby +begin + # Get number of followers + data, status_code, headers = api_instance.get_number_of_followers_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::Insight::ApiError => e + puts "Error when calling InsightApi->get_number_of_followers_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **date** | **String** | Date for which to retrieve the number of followers. Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9 | [optional] | + +### Return type + +[**GetNumberOfFollowersResponse**](GetNumberOfFollowersResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_number_of_message_deliveries + +> get_number_of_message_deliveries(date) + +Get number of message deliveries + +Returns the number of messages sent from LINE Official Account on a specified day. + +### Examples + +```ruby +require 'time' +require 'line_client_insight' +# setup authorization +LINE::Client::Insight.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::Insight::InsightApi.new +date = 'date_example' # String | Date for which to retrieve number of sent messages. - Format: yyyyMMdd (e.g. 20191231) - Timezone: UTC+9 + +begin + # Get number of message deliveries + result = api_instance.get_number_of_message_deliveries(date) + p result +rescue LINE::Client::Insight::ApiError => e + puts "Error when calling InsightApi->get_number_of_message_deliveries: #{e}" +end +``` + +#### Using the get_number_of_message_deliveries_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_number_of_message_deliveries_with_http_info(date) + +```ruby +begin + # Get number of message deliveries + data, status_code, headers = api_instance.get_number_of_message_deliveries_with_http_info(date) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::Insight::ApiError => e + puts "Error when calling InsightApi->get_number_of_message_deliveries_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **date** | **String** | Date for which to retrieve number of sent messages. - Format: yyyyMMdd (e.g. 20191231) - Timezone: UTC+9 | | + +### Return type + +[**GetNumberOfMessageDeliveriesResponse**](GetNumberOfMessageDeliveriesResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_statistics_per_unit + +> get_statistics_per_unit(custom_aggregation_unit, from, to) + + + +You can check the per-unit statistics of how users interact with push messages and multicast messages sent from your LINE Official Account. + +### Examples + +```ruby +require 'time' +require 'line_client_insight' +# setup authorization +LINE::Client::Insight.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::Insight::InsightApi.new +custom_aggregation_unit = 'custom_aggregation_unit_example' # String | Name of aggregation unit specified when sending the message. Case-sensitive. For example, `Promotion_a` and `Promotion_A` are regarded as different unit names. +from = '20210301' # String | Start date of aggregation period. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 +to = '20210301' # String | End date of aggregation period. The end date can be specified for up to 30 days later. For example, if the start date is 20210301, the latest end date is 20210331. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 + +begin + + result = api_instance.get_statistics_per_unit(custom_aggregation_unit, from, to) + p result +rescue LINE::Client::Insight::ApiError => e + puts "Error when calling InsightApi->get_statistics_per_unit: #{e}" +end +``` + +#### Using the get_statistics_per_unit_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_statistics_per_unit_with_http_info(custom_aggregation_unit, from, to) + +```ruby +begin + + data, status_code, headers = api_instance.get_statistics_per_unit_with_http_info(custom_aggregation_unit, from, to) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::Insight::ApiError => e + puts "Error when calling InsightApi->get_statistics_per_unit_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **custom_aggregation_unit** | **String** | Name of aggregation unit specified when sending the message. Case-sensitive. For example, `Promotion_a` and `Promotion_A` are regarded as different unit names. | | +| **from** | **String** | Start date of aggregation period. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 | | +| **to** | **String** | End date of aggregation period. The end date can be specified for up to 30 days later. For example, if the start date is 20210301, the latest end date is 20210331. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 | | + +### Return type + +[**GetStatisticsPerUnitResponse**](GetStatisticsPerUnitResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/lib/clients/insight/docs/SubscriptionPeriodTile.md b/lib/clients/insight/docs/SubscriptionPeriodTile.md new file mode 100644 index 00000000..353a8842 --- /dev/null +++ b/lib/clients/insight/docs/SubscriptionPeriodTile.md @@ -0,0 +1,20 @@ +# LINE::Client::Insight::SubscriptionPeriodTile + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **subscription_period** | **String** | Subscription period. Possible values: `within7days`, `within90days`, `unknown` etc. | [optional] | +| **percentage** | **Float** | Percentage. Possible values: [0.0,100.0] e.g. 0, 2.9, 37.6. | [optional] | + +## Example + +```ruby +require 'line_client_insight' + +instance = LINE::Client::Insight::SubscriptionPeriodTile.new( + subscription_period: null, + percentage: null +) +``` + diff --git a/lib/clients/insight/lib/line_client_insight.rb b/lib/clients/insight/lib/line_client_insight.rb new file mode 100644 index 00000000..9c4c4a4e --- /dev/null +++ b/lib/clients/insight/lib/line_client_insight.rb @@ -0,0 +1,58 @@ +=begin +#LINE Messaging API(Insight) + +#This document describes LINE Messaging API(Insight). + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +# Common files +require 'line_client_insight/api_client' +require 'line_client_insight/api_error' +require 'line_client_insight/version' +require 'line_client_insight/configuration' + +# Models +require 'line_client_insight/models/age_tile' +require 'line_client_insight/models/app_type_tile' +require 'line_client_insight/models/area_tile' +require 'line_client_insight/models/error_detail' +require 'line_client_insight/models/error_response' +require 'line_client_insight/models/gender_tile' +require 'line_client_insight/models/get_friends_demographics_response' +require 'line_client_insight/models/get_message_event_response' +require 'line_client_insight/models/get_message_event_response_click' +require 'line_client_insight/models/get_message_event_response_message' +require 'line_client_insight/models/get_message_event_response_overview' +require 'line_client_insight/models/get_number_of_followers_response' +require 'line_client_insight/models/get_number_of_message_deliveries_response' +require 'line_client_insight/models/get_statistics_per_unit_response' +require 'line_client_insight/models/get_statistics_per_unit_response_click' +require 'line_client_insight/models/get_statistics_per_unit_response_message' +require 'line_client_insight/models/get_statistics_per_unit_response_overview' +require 'line_client_insight/models/subscription_period_tile' + +# APIs +require 'line_client_insight/api/insight_api' + +module LINE::Client::Insight + class << self + # Customize default settings for the SDK using block. + # LINE::Client::Insight.configure do |config| + # config.username = "xxx" + # config.password = "xxx" + # end + # If no block given, return the default Configuration object. + def configure + if block_given? + yield(Configuration.default) + else + Configuration.default + end + end + end +end diff --git a/lib/clients/insight/lib/line_client_insight/api/insight_api.rb b/lib/clients/insight/lib/line_client_insight/api/insight_api.rb new file mode 100644 index 00000000..8abba31b --- /dev/null +++ b/lib/clients/insight/lib/line_client_insight/api/insight_api.rb @@ -0,0 +1,410 @@ +=begin +#LINE Messaging API(Insight) + +#This document describes LINE Messaging API(Insight). + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'cgi' + +module LINE::Client::Insight + class InsightApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Retrieves the demographic attributes for a LINE Official Account's friends.You can only retrieve information about friends for LINE Official Accounts created by users in Japan (JP), Thailand (TH), Taiwan (TW) and Indonesia (ID). + # @param [Hash] opts the optional parameters + # @return [GetFriendsDemographicsResponse] + def get_friends_demographics(opts = {}) + data, _status_code, _headers = get_friends_demographics_with_http_info(opts) + data + end + + # Retrieves the demographic attributes for a LINE Official Account's friends.You can only retrieve information about friends for LINE Official Accounts created by users in Japan (JP), Thailand (TH), Taiwan (TW) and Indonesia (ID). + # @param [Hash] opts the optional parameters + # @return [Array<(GetFriendsDemographicsResponse, Integer, Hash)>] GetFriendsDemographicsResponse data, response status code and response headers + def get_friends_demographics_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: InsightApi.get_friends_demographics ...' + end + # resource path + local_var_path = '/v2/bot/insight/demographic' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetFriendsDemographicsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"InsightApi.get_friends_demographics", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: InsightApi#get_friends_demographics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get user interaction statistics + # Returns statistics about how users interact with narrowcast messages or broadcast messages sent from your LINE Official Account. + # @param request_id [String] Request ID of a narrowcast message or broadcast message. Each Messaging API request has a request ID. + # @param [Hash] opts the optional parameters + # @return [GetMessageEventResponse] + def get_message_event(request_id, opts = {}) + data, _status_code, _headers = get_message_event_with_http_info(request_id, opts) + data + end + + # Get user interaction statistics + # Returns statistics about how users interact with narrowcast messages or broadcast messages sent from your LINE Official Account. + # @param request_id [String] Request ID of a narrowcast message or broadcast message. Each Messaging API request has a request ID. + # @param [Hash] opts the optional parameters + # @return [Array<(GetMessageEventResponse, Integer, Hash)>] GetMessageEventResponse data, response status code and response headers + def get_message_event_with_http_info(request_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: InsightApi.get_message_event ...' + end + # verify the required parameter 'request_id' is set + if @api_client.config.client_side_validation && request_id.nil? + fail ArgumentError, "Missing the required parameter 'request_id' when calling InsightApi.get_message_event" + end + if @api_client.config.client_side_validation && request_id.to_s.length < 1 + fail ArgumentError, 'invalid value for "request_id" when calling InsightApi.get_message_event, the character length must be great than or equal to 1.' + end + + # resource path + local_var_path = '/v2/bot/insight/message/event' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'requestId'] = request_id + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetMessageEventResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"InsightApi.get_message_event", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: InsightApi#get_message_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get number of followers + # Returns the number of users who have added the LINE Official Account on or before a specified date. + # @param [Hash] opts the optional parameters + # @option opts [String] :date Date for which to retrieve the number of followers. Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9 + # @return [GetNumberOfFollowersResponse] + def get_number_of_followers(opts = {}) + data, _status_code, _headers = get_number_of_followers_with_http_info(opts) + data + end + + # Get number of followers + # Returns the number of users who have added the LINE Official Account on or before a specified date. + # @param [Hash] opts the optional parameters + # @option opts [String] :date Date for which to retrieve the number of followers. Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9 + # @return [Array<(GetNumberOfFollowersResponse, Integer, Hash)>] GetNumberOfFollowersResponse data, response status code and response headers + def get_number_of_followers_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: InsightApi.get_number_of_followers ...' + end + if @api_client.config.client_side_validation && !opts[:'date'].nil? && opts[:'date'].to_s.length > 8 + fail ArgumentError, 'invalid value for "opts[:"date"]" when calling InsightApi.get_number_of_followers, the character length must be smaller than or equal to 8.' + end + + if @api_client.config.client_side_validation && !opts[:'date'].nil? && opts[:'date'].to_s.length < 8 + fail ArgumentError, 'invalid value for "opts[:"date"]" when calling InsightApi.get_number_of_followers, the character length must be great than or equal to 8.' + end + + pattern = Regexp.new(/^[0-9]{8}$/) + if @api_client.config.client_side_validation && !opts[:'date'].nil? && opts[:'date'] !~ pattern + fail ArgumentError, "invalid value for 'opts[:\"date\"]' when calling InsightApi.get_number_of_followers, must conform to the pattern #{pattern}." + end + + # resource path + local_var_path = '/v2/bot/insight/followers' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'date'] = opts[:'date'] if !opts[:'date'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetNumberOfFollowersResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"InsightApi.get_number_of_followers", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: InsightApi#get_number_of_followers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get number of message deliveries + # Returns the number of messages sent from LINE Official Account on a specified day. + # @param date [String] Date for which to retrieve number of sent messages. - Format: yyyyMMdd (e.g. 20191231) - Timezone: UTC+9 + # @param [Hash] opts the optional parameters + # @return [GetNumberOfMessageDeliveriesResponse] + def get_number_of_message_deliveries(date, opts = {}) + data, _status_code, _headers = get_number_of_message_deliveries_with_http_info(date, opts) + data + end + + # Get number of message deliveries + # Returns the number of messages sent from LINE Official Account on a specified day. + # @param date [String] Date for which to retrieve number of sent messages. - Format: yyyyMMdd (e.g. 20191231) - Timezone: UTC+9 + # @param [Hash] opts the optional parameters + # @return [Array<(GetNumberOfMessageDeliveriesResponse, Integer, Hash)>] GetNumberOfMessageDeliveriesResponse data, response status code and response headers + def get_number_of_message_deliveries_with_http_info(date, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: InsightApi.get_number_of_message_deliveries ...' + end + # verify the required parameter 'date' is set + if @api_client.config.client_side_validation && date.nil? + fail ArgumentError, "Missing the required parameter 'date' when calling InsightApi.get_number_of_message_deliveries" + end + if @api_client.config.client_side_validation && date.to_s.length > 8 + fail ArgumentError, 'invalid value for "date" when calling InsightApi.get_number_of_message_deliveries, the character length must be smaller than or equal to 8.' + end + + if @api_client.config.client_side_validation && date.to_s.length < 8 + fail ArgumentError, 'invalid value for "date" when calling InsightApi.get_number_of_message_deliveries, the character length must be great than or equal to 8.' + end + + pattern = Regexp.new(/^[0-9]{8}$/) + if @api_client.config.client_side_validation && date !~ pattern + fail ArgumentError, "invalid value for 'date' when calling InsightApi.get_number_of_message_deliveries, must conform to the pattern #{pattern}." + end + + # resource path + local_var_path = '/v2/bot/insight/message/delivery' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'date'] = date + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetNumberOfMessageDeliveriesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"InsightApi.get_number_of_message_deliveries", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: InsightApi#get_number_of_message_deliveries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # You can check the per-unit statistics of how users interact with push messages and multicast messages sent from your LINE Official Account. + # @param custom_aggregation_unit [String] Name of aggregation unit specified when sending the message. Case-sensitive. For example, `Promotion_a` and `Promotion_A` are regarded as different unit names. + # @param from [String] Start date of aggregation period. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 + # @param to [String] End date of aggregation period. The end date can be specified for up to 30 days later. For example, if the start date is 20210301, the latest end date is 20210331. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 + # @param [Hash] opts the optional parameters + # @return [GetStatisticsPerUnitResponse] + def get_statistics_per_unit(custom_aggregation_unit, from, to, opts = {}) + data, _status_code, _headers = get_statistics_per_unit_with_http_info(custom_aggregation_unit, from, to, opts) + data + end + + # You can check the per-unit statistics of how users interact with push messages and multicast messages sent from your LINE Official Account. + # @param custom_aggregation_unit [String] Name of aggregation unit specified when sending the message. Case-sensitive. For example, `Promotion_a` and `Promotion_A` are regarded as different unit names. + # @param from [String] Start date of aggregation period. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 + # @param to [String] End date of aggregation period. The end date can be specified for up to 30 days later. For example, if the start date is 20210301, the latest end date is 20210331. Format: yyyyMMdd (e.g. 20210301) Time zone: UTC+9 + # @param [Hash] opts the optional parameters + # @return [Array<(GetStatisticsPerUnitResponse, Integer, Hash)>] GetStatisticsPerUnitResponse data, response status code and response headers + def get_statistics_per_unit_with_http_info(custom_aggregation_unit, from, to, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: InsightApi.get_statistics_per_unit ...' + end + # verify the required parameter 'custom_aggregation_unit' is set + if @api_client.config.client_side_validation && custom_aggregation_unit.nil? + fail ArgumentError, "Missing the required parameter 'custom_aggregation_unit' when calling InsightApi.get_statistics_per_unit" + end + if @api_client.config.client_side_validation && custom_aggregation_unit.to_s.length > 30 + fail ArgumentError, 'invalid value for "custom_aggregation_unit" when calling InsightApi.get_statistics_per_unit, the character length must be smaller than or equal to 30.' + end + + if @api_client.config.client_side_validation && custom_aggregation_unit.to_s.length < 1 + fail ArgumentError, 'invalid value for "custom_aggregation_unit" when calling InsightApi.get_statistics_per_unit, the character length must be great than or equal to 1.' + end + + pattern = Regexp.new(/^[a-zA-Z0-9_]{1,30}$/) + if @api_client.config.client_side_validation && custom_aggregation_unit !~ pattern + fail ArgumentError, "invalid value for 'custom_aggregation_unit' when calling InsightApi.get_statistics_per_unit, must conform to the pattern #{pattern}." + end + + # verify the required parameter 'from' is set + if @api_client.config.client_side_validation && from.nil? + fail ArgumentError, "Missing the required parameter 'from' when calling InsightApi.get_statistics_per_unit" + end + if @api_client.config.client_side_validation && from.to_s.length > 8 + fail ArgumentError, 'invalid value for "from" when calling InsightApi.get_statistics_per_unit, the character length must be smaller than or equal to 8.' + end + + if @api_client.config.client_side_validation && from.to_s.length < 8 + fail ArgumentError, 'invalid value for "from" when calling InsightApi.get_statistics_per_unit, the character length must be great than or equal to 8.' + end + + pattern = Regexp.new(/^[0-9]{8}$/) + if @api_client.config.client_side_validation && from !~ pattern + fail ArgumentError, "invalid value for 'from' when calling InsightApi.get_statistics_per_unit, must conform to the pattern #{pattern}." + end + + # verify the required parameter 'to' is set + if @api_client.config.client_side_validation && to.nil? + fail ArgumentError, "Missing the required parameter 'to' when calling InsightApi.get_statistics_per_unit" + end + if @api_client.config.client_side_validation && to.to_s.length > 8 + fail ArgumentError, 'invalid value for "to" when calling InsightApi.get_statistics_per_unit, the character length must be smaller than or equal to 8.' + end + + if @api_client.config.client_side_validation && to.to_s.length < 8 + fail ArgumentError, 'invalid value for "to" when calling InsightApi.get_statistics_per_unit, the character length must be great than or equal to 8.' + end + + pattern = Regexp.new(/^[0-9]{8}$/) + if @api_client.config.client_side_validation && to !~ pattern + fail ArgumentError, "invalid value for 'to' when calling InsightApi.get_statistics_per_unit, must conform to the pattern #{pattern}." + end + + # resource path + local_var_path = '/v2/bot/insight/message/event/aggregation' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'customAggregationUnit'] = custom_aggregation_unit + query_params[:'from'] = from + query_params[:'to'] = to + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetStatisticsPerUnitResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"InsightApi.get_statistics_per_unit", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: InsightApi#get_statistics_per_unit\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/clients/insight/lib/line_client_insight/api_client.rb b/lib/clients/insight/lib/line_client_insight/api_client.rb new file mode 100644 index 00000000..19cc4e63 --- /dev/null +++ b/lib/clients/insight/lib/line_client_insight/api_client.rb @@ -0,0 +1,392 @@ +=begin +#LINE Messaging API(Insight) + +#This document describes LINE Messaging API(Insight). + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'json' +require 'logger' +require 'tempfile' +require 'time' +require 'typhoeus' + +module LINE::Client::Insight + class ApiClient + # The Configuration object holding settings to be used in the API client. + attr_accessor :config + + # Defines the headers to be used in HTTP requests of all API calls by default. + # + # @return [Hash] + attr_accessor :default_headers + + # Initializes the ApiClient + # @option config [Configuration] Configuration for initializing the object, default to Configuration.default + def initialize(config = Configuration.default) + @config = config + @user_agent = "LINE-BotSDK-Ruby/2.0.0" + @default_headers = { + 'Content-Type' => 'application/json', + 'User-Agent' => @user_agent + } + end + + def self.default + @@default ||= ApiClient.new + end + + # Call an API with given options. + # + # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: + # the data deserialized from response body (could be nil), response status code and response headers. + def call_api(http_method, path, opts = {}) + request = build_request(http_method, path, opts) + response = request.run + + if @config.debugging + @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" + end + + unless response.success? + if response.timed_out? + fail ApiError.new('Connection timed out') + elsif response.code == 0 + # Errors from libcurl will be made visible here + fail ApiError.new(:code => 0, + :message => response.return_message) + else + fail ApiError.new(:code => response.code, + :response_headers => response.headers, + :response_body => response.body), + response.status_message + end + end + + if opts[:return_type] + data = deserialize(response, opts[:return_type]) + else + data = nil + end + return data, response.code, response.headers + end + + # Builds the HTTP request + # + # @param [String] http_method HTTP method/verb (e.g. POST) + # @param [String] path URL path (e.g. /account/new) + # @option opts [Hash] :header_params Header parameters + # @option opts [Hash] :query_params Query parameters + # @option opts [Hash] :form_params Query parameters + # @option opts [Object] :body HTTP body (JSON/XML) + # @return [Typhoeus::Request] A Typhoeus Request + def build_request(http_method, path, opts = {}) + url = build_request_url(path, opts) + http_method = http_method.to_sym.downcase + + header_params = @default_headers.merge(opts[:header_params] || {}) + query_params = opts[:query_params] || {} + form_params = opts[:form_params] || {} + follow_location = opts[:follow_location] || true + + update_params_for_auth! header_params, query_params, opts[:auth_names] + + # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false) + _verify_ssl_host = @config.verify_ssl_host ? 2 : 0 + + req_opts = { + :method => http_method, + :headers => header_params, + :params => query_params, + :params_encoding => @config.params_encoding, + :timeout => @config.timeout, + :ssl_verifypeer => @config.verify_ssl, + :ssl_verifyhost => _verify_ssl_host, + :sslcert => @config.cert_file, + :sslkey => @config.key_file, + :verbose => @config.debugging, + :followlocation => follow_location + } + + # set custom cert, if provided + req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert + + if [:post, :patch, :put, :delete].include?(http_method) + req_body = build_request_body(header_params, form_params, opts[:body]) + req_opts.update :body => req_body + if @config.debugging + @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n" + end + end + + request = Typhoeus::Request.new(url, req_opts) + download_file(request) if opts[:return_type] == 'File' + request + end + + # Builds the HTTP request body + # + # @param [Hash] header_params Header parameters + # @param [Hash] form_params Query parameters + # @param [Object] body HTTP body (JSON/XML) + # @return [String] HTTP body data in the form of string + def build_request_body(header_params, form_params, body) + # http form + if header_params['Content-Type'] == 'application/x-www-form-urlencoded' || + header_params['Content-Type'] == 'multipart/form-data' + data = {} + form_params.each do |key, value| + case value + when ::File, ::Array, nil + # let typhoeus handle File, Array and nil parameters + data[key] = value + else + data[key] = value.to_s + end + end + elsif body + data = body.is_a?(String) ? body : body.to_json + else + data = nil + end + data + end + + # Save response body into a file in (the defined) temporary folder, using the filename + # from the "Content-Disposition" header if provided, otherwise a random filename. + # The response body is written to the file in chunks in order to handle files which + # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby + # process can use. + # + # @see Configuration#temp_folder_path + def download_file(request) + tempfile = nil + encoding = nil + request.on_headers do |response| + content_disposition = response.headers['Content-Disposition'] + if content_disposition && content_disposition =~ /filename=/i + filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1] + prefix = sanitize_filename(filename) + else + prefix = 'download-' + end + prefix = prefix + '-' unless prefix.end_with?('-') + encoding = response.body.encoding + tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) + @tempfile = tempfile + end + request.on_body do |chunk| + chunk.force_encoding(encoding) + tempfile.write(chunk) + end + request.on_complete do |response| + if tempfile + tempfile.close + @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ + "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ + "will be deleted automatically with GC. It's also recommended to delete the temp file "\ + "explicitly with `tempfile.delete`" + end + end + end + + # Check if the given MIME is a JSON MIME. + # JSON MIME examples: + # application/json + # application/json; charset=UTF8 + # APPLICATION/JSON + # */* + # @param [String] mime MIME + # @return [Boolean] True if the MIME is application/json + def json_mime?(mime) + (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + end + + # Deserialize the response to the given return type. + # + # @param [Response] response HTTP response + # @param [String] return_type some examples: "User", "Array", "Hash" + def deserialize(response, return_type) + body = response.body + + # handle file downloading - return the File instance processed in request callbacks + # note that response body is empty when the file is written in chunks in request on_body callback + return @tempfile if return_type == 'File' + + return nil if body.nil? || body.empty? + + # return response body directly for String return type + return body if return_type == 'String' + + # ensuring a default content type + content_type = response.headers['Content-Type'] || 'application/json' + + fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type) + + begin + data = JSON.parse("[#{body}]", :symbolize_names => true)[0] + rescue JSON::ParserError => e + if %w(String Date Time).include?(return_type) + data = body + else + raise e + end + end + + convert_to_type data, return_type + end + + # Convert data to the given return type. + # @param [Object] data Data to be converted + # @param [String] return_type Return type + # @return [Mixed] Data in a particular type + def convert_to_type(data, return_type) + return nil if data.nil? + case return_type + when 'String' + data.to_s + when 'Integer' + data.to_i + when 'Float' + data.to_f + when 'Boolean' + data == true + when 'Time' + # parse date time (expecting ISO 8601 format) + Time.parse data + when 'Date' + # parse date time (expecting ISO 8601 format) + Date.parse data + when 'Object' + # generic object (usually a Hash), return directly + data + when /\AArray<(.+)>\z/ + # e.g. Array + sub_type = $1 + data.map { |item| convert_to_type(item, sub_type) } + when /\AHash\\z/ + # e.g. Hash + sub_type = $1 + {}.tap do |hash| + data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } + end + else + # models (e.g. Pet) or oneOf + klass = LINE::Client::Insight.const_get(return_type) + klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + end + end + + # Sanitize filename by removing path. + # e.g. ../../sun.gif becomes sun.gif + # + # @param [String] filename the filename to be sanitized + # @return [String] the sanitized filename + def sanitize_filename(filename) + filename.gsub(/.*[\/\\]/, '') + end + + def build_request_url(path, opts = {}) + # Add leading and trailing slashes to path + path = "/#{path}".gsub(/\/+/, '/') + @config.base_url(opts[:operation]) + path + end + + # Update header and query params based on authentication settings. + # + # @param [Hash] header_params Header parameters + # @param [Hash] query_params Query parameters + # @param [String] auth_names Authentication scheme name + def update_params_for_auth!(header_params, query_params, auth_names) + Array(auth_names).each do |auth_name| + auth_setting = @config.auth_settings[auth_name] + next unless auth_setting + case auth_setting[:in] + when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] + when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] + else fail ArgumentError, 'Authentication token must be in `query` or `header`' + end + end + end + + # Sets user agent in HTTP header + # + # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0) + def user_agent=(user_agent) + @user_agent = user_agent + @default_headers['User-Agent'] = @user_agent + end + + # Return Accept header based on an array of accepts provided. + # @param [Array] accepts array for Accept + # @return [String] the Accept header (e.g. application/json) + def select_header_accept(accepts) + return nil if accepts.nil? || accepts.empty? + # use JSON when present, otherwise use all of the provided + json_accept = accepts.find { |s| json_mime?(s) } + json_accept || accepts.join(',') + end + + # Return Content-Type header based on an array of content types provided. + # @param [Array] content_types array for Content-Type + # @return [String] the Content-Type header (e.g. application/json) + def select_header_content_type(content_types) + # return nil by default + return if content_types.nil? || content_types.empty? + # use JSON when present, otherwise use the first one + json_content_type = content_types.find { |s| json_mime?(s) } + json_content_type || content_types.first + end + + # Convert object (array, hash, object, etc) to JSON string. + # @param [Object] model object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_http_body(model) + return model if model.nil? || model.is_a?(String) + local_body = nil + if model.is_a?(Array) + local_body = model.map { |m| object_to_hash(m) } + else + local_body = object_to_hash(model) + end + local_body.to_json + end + + # Convert object(non-array) to hash. + # @param [Object] obj object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_hash(obj) + if obj.respond_to?(:to_hash) + obj.to_hash + else + obj + end + end + + # Build parameter value according to the given collection format. + # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi + def build_collection_param(param, collection_format) + case collection_format + when :csv + param.join(',') + when :ssv + param.join(' ') + when :tsv + param.join("\t") + when :pipes + param.join('|') + when :multi + # return the array directly as typhoeus will handle it as expected + param + else + fail "unknown collection format: #{collection_format.inspect}" + end + end + end +end diff --git a/lib/clients/insight/lib/line_client_insight/api_error.rb b/lib/clients/insight/lib/line_client_insight/api_error.rb new file mode 100644 index 00000000..8ebf8cf1 --- /dev/null +++ b/lib/clients/insight/lib/line_client_insight/api_error.rb @@ -0,0 +1,58 @@ +=begin +#LINE Messaging API(Insight) + +#This document describes LINE Messaging API(Insight). + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::Insight + class ApiError < StandardError + attr_reader :code, :response_headers, :response_body + + # Usage examples: + # ApiError.new + # ApiError.new("message") + # ApiError.new(:code => 500, :response_headers => {}, :response_body => "") + # ApiError.new(:code => 404, :message => "Not Found") + def initialize(arg = nil) + if arg.is_a? Hash + if arg.key?(:message) || arg.key?('message') + super(arg[:message] || arg['message']) + else + super arg + end + + arg.each do |k, v| + instance_variable_set "@#{k}", v + end + else + super arg + @message = arg + end + end + + # Override to_s to display a friendly error message + def to_s + message + end + + def message + if @message.nil? + msg = "Error message: the server returns an error" + else + msg = @message + end + + msg += "\nHTTP status code: #{code}" if code + msg += "\nResponse headers: #{response_headers}" if response_headers + msg += "\nResponse body: #{response_body}" if response_body + + msg + end + end +end diff --git a/lib/clients/insight/lib/line_client_insight/configuration.rb b/lib/clients/insight/lib/line_client_insight/configuration.rb new file mode 100644 index 00000000..f3c25b78 --- /dev/null +++ b/lib/clients/insight/lib/line_client_insight/configuration.rb @@ -0,0 +1,297 @@ +=begin +#LINE Messaging API(Insight) + +#This document describes LINE Messaging API(Insight). + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::Insight + class Configuration + # Defines url scheme + attr_accessor :scheme + + # Defines url host + attr_accessor :host + + # Defines url base path + attr_accessor :base_path + + # Define server configuration index + attr_accessor :server_index + + # Define server operation configuration index + attr_accessor :server_operation_index + + # Default server variables + attr_accessor :server_variables + + # Default server operation variables + attr_accessor :server_operation_variables + + # Defines API keys used with API Key authentications. + # + # @return [Hash] key: parameter name, value: parameter value (API key) + # + # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string) + # config.api_key['api_key'] = 'xxx' + attr_accessor :api_key + + # Defines API key prefixes used with API Key authentications. + # + # @return [Hash] key: parameter name, value: API key prefix + # + # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers) + # config.api_key_prefix['api_key'] = 'Token' + attr_accessor :api_key_prefix + + # Defines the username used with HTTP basic authentication. + # + # @return [String] + attr_accessor :username + + # Defines the password used with HTTP basic authentication. + # + # @return [String] + attr_accessor :password + + # Defines the access token (Bearer) used with OAuth2. + attr_accessor :access_token + + # Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2. + # Overrides the access_token if set + # @return [Proc] + attr_accessor :access_token_getter + + # Set this to return data as binary instead of downloading a temp file. When enabled (set to true) + # HTTP responses with return type `File` will be returned as a stream of binary data. + # Default to false. + attr_accessor :return_binary_data + + # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response + # details will be logged with `logger.debug` (see the `logger` attribute). + # Default to false. + # + # @return [true, false] + attr_accessor :debugging + + # Defines the logger used for debugging. + # Default to `Rails.logger` (when in Rails) or logging to STDOUT. + # + # @return [#debug] + attr_accessor :logger + + # Defines the temporary folder to store downloaded files + # (for API endpoints that have file response). + # Default to use `Tempfile`. + # + # @return [String] + attr_accessor :temp_folder_path + + # The time limit for HTTP request in seconds. + # Default to 0 (never times out). + attr_accessor :timeout + + # Set this to false to skip client side validation in the operation. + # Default to true. + # @return [true, false] + attr_accessor :client_side_validation + + ### TLS/SSL setting + # Set this to false to skip verifying SSL certificate when calling API from https server. + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl + + ### TLS/SSL setting + # Set this to false to skip verifying SSL host name + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl_host + + ### TLS/SSL setting + # Set this to customize the certificate file to verify the peer. + # + # @return [String] the path to the certificate file + # + # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code: + # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145 + attr_accessor :ssl_ca_cert + + ### TLS/SSL setting + # Client certificate file (for client certificate) + attr_accessor :cert_file + + ### TLS/SSL setting + # Client private key file (for client certificate) + attr_accessor :key_file + + # Set this to customize parameters encoding of array parameter with multi collectionFormat. + # Default to nil. + # + # @see The params_encoding option of Ethon. Related source code: + # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 + attr_accessor :params_encoding + + + attr_accessor :inject_format + + attr_accessor :force_ending_format + + def initialize + @scheme = 'https' + @host = 'api.line.me' + @base_path = '' + @server_index = nil + @server_operation_index = {} + @server_variables = {} + @server_operation_variables = {} + @api_key = {} + @api_key_prefix = {} + @client_side_validation = true + @verify_ssl = true + @verify_ssl_host = true + @cert_file = nil + @key_file = nil + @timeout = 0 + @params_encoding = nil + @debugging = false + @inject_format = false + @force_ending_format = false + @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) + + yield(self) if block_given? + end + + # The default Configuration object. + def self.default + @@default ||= Configuration.new + end + + def configure + yield(self) if block_given? + end + + def scheme=(scheme) + # remove :// from scheme + @scheme = scheme.sub(/:\/\//, '') + end + + def host=(host) + # remove http(s):// and anything after a slash + @host = host.sub(/https?:\/\//, '').split('/').first + end + + def base_path=(base_path) + # Add leading and trailing slashes to base_path + @base_path = "/#{base_path}".gsub(/\/+/, '/') + @base_path = '' if @base_path == '/' + end + + # Returns base URL for specified operation based on server settings + def base_url(operation = nil) + if operation_server_settings.key?(operation) then + index = server_operation_index.fetch(operation, server_index) + server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) + else + server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil) + end + end + + # Gets API key (with prefix if set). + # @param [String] param_name the parameter name of API key auth + def api_key_with_prefix(param_name, param_alias = nil) + key = @api_key[param_name] + key = @api_key.fetch(param_alias, key) unless param_alias.nil? + if @api_key_prefix[param_name] + "#{@api_key_prefix[param_name]} #{key}" + else + key + end + end + + # Gets access_token using access_token_getter or uses the static access_token + def access_token_with_refresh + return access_token if access_token_getter.nil? + access_token_getter.call + end + + # Gets Basic Auth token string + def basic_auth_token + 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") + end + + # Returns Auth Settings hash for api client. + def auth_settings + { + 'Bearer' => + { + type: 'bearer', + in: 'header', + key: 'Authorization', + value: "Bearer #{access_token_with_refresh}" + }, + } + end + + # Returns an array of Server setting + def server_settings + [ + { + url: "https://api.line.me", + description: "No description provided", + } + ] + end + + def operation_server_settings + { + } + end + + # Returns URL based on server settings + # + # @param index array index of the server settings + # @param variables hash of variable and the corresponding value + def server_url(index, variables = {}, servers = nil) + servers = server_settings if servers == nil + + # check array index out of bound + if (index.nil? || index < 0 || index >= servers.size) + fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}" + end + + server = servers[index] + url = server[:url] + + return url unless server.key? :variables + + # go through variable and assign a value + server[:variables].each do |name, variable| + if variables.key?(name) + if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name])) + url.gsub! "{" + name.to_s + "}", variables[name] + else + fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}." + end + else + # use default value + url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] + end + end + + url + end + + end +end diff --git a/lib/clients/insight/lib/line_client_insight/models/age_tile.rb b/lib/clients/insight/lib/line_client_insight/models/age_tile.rb new file mode 100644 index 00000000..b39823c9 --- /dev/null +++ b/lib/clients/insight/lib/line_client_insight/models/age_tile.rb @@ -0,0 +1,264 @@ +=begin +#LINE Messaging API(Insight) + +#This document describes LINE Messaging API(Insight). + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Insight + class AgeTile + # users' age + attr_accessor :age + + # Percentage + attr_accessor :percentage + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'age' => :'age', + :'percentage' => :'percentage' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'age' => :'String', + :'percentage' => :'Float' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Insight::AgeTile` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Insight::AgeTile`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'age') + self.age = attributes[:'age'] + end + + if attributes.key?(:'percentage') + self.percentage = attributes[:'percentage'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + age_validator = EnumAttributeValidator.new('String', ["from0to14", "from15to19", "from20to24", "from25to29", "from30to34", "from35to39", "from40to44", "from45to49", "from50", "unknown"]) + return false unless age_validator.valid?(@age) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] age Object to be assigned + def age=(age) + validator = EnumAttributeValidator.new('String', ["from0to14", "from15to19", "from20to24", "from25to29", "from30to34", "from35to39", "from40to44", "from45to49", "from50", "unknown"]) + unless validator.valid?(age) + fail ArgumentError, "invalid value for \"age\", must be one of #{validator.allowable_values}." + end + @age = age + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + age == o.age && + percentage == o.percentage + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [age, percentage].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Insight.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/insight/lib/line_client_insight/models/app_type_tile.rb b/lib/clients/insight/lib/line_client_insight/models/app_type_tile.rb new file mode 100644 index 00000000..659908ff --- /dev/null +++ b/lib/clients/insight/lib/line_client_insight/models/app_type_tile.rb @@ -0,0 +1,264 @@ +=begin +#LINE Messaging API(Insight) + +#This document describes LINE Messaging API(Insight). + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Insight + class AppTypeTile + # users' OS + attr_accessor :app_type + + # Percentage + attr_accessor :percentage + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'app_type' => :'appType', + :'percentage' => :'percentage' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'app_type' => :'String', + :'percentage' => :'Float' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Insight::AppTypeTile` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Insight::AppTypeTile`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'app_type') + self.app_type = attributes[:'app_type'] + end + + if attributes.key?(:'percentage') + self.percentage = attributes[:'percentage'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + app_type_validator = EnumAttributeValidator.new('String', ["ios", "android", "others"]) + return false unless app_type_validator.valid?(@app_type) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] app_type Object to be assigned + def app_type=(app_type) + validator = EnumAttributeValidator.new('String', ["ios", "android", "others"]) + unless validator.valid?(app_type) + fail ArgumentError, "invalid value for \"app_type\", must be one of #{validator.allowable_values}." + end + @app_type = app_type + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + app_type == o.app_type && + percentage == o.percentage + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [app_type, percentage].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Insight.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/insight/lib/line_client_insight/models/area_tile.rb b/lib/clients/insight/lib/line_client_insight/models/area_tile.rb new file mode 100644 index 00000000..47304504 --- /dev/null +++ b/lib/clients/insight/lib/line_client_insight/models/area_tile.rb @@ -0,0 +1,230 @@ +=begin +#LINE Messaging API(Insight) + +#This document describes LINE Messaging API(Insight). + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Insight + class AreaTile + # users' country and region + attr_accessor :area + + # Percentage + attr_accessor :percentage + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'area' => :'area', + :'percentage' => :'percentage' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'area' => :'String', + :'percentage' => :'Float' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Insight::AreaTile` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Insight::AreaTile`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'area') + self.area = attributes[:'area'] + end + + if attributes.key?(:'percentage') + self.percentage = attributes[:'percentage'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + area == o.area && + percentage == o.percentage + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [area, percentage].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Insight.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/insight/lib/line_client_insight/models/error_detail.rb b/lib/clients/insight/lib/line_client_insight/models/error_detail.rb new file mode 100644 index 00000000..641594dc --- /dev/null +++ b/lib/clients/insight/lib/line_client_insight/models/error_detail.rb @@ -0,0 +1,230 @@ +=begin +#LINE Messaging API(Insight) + +#This document describes LINE Messaging API(Insight). + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Insight + class ErrorDetail + # Details of the error. Not included in the response under certain situations. + attr_accessor :message + + # Location of where the error occurred. Returns the JSON field name or query parameter name of the request. Not included in the response under certain situations. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'message' => :'message', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'message' => :'String', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Insight::ErrorDetail` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Insight::ErrorDetail`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + message == o.message && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [message, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Insight.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/insight/lib/line_client_insight/models/error_response.rb b/lib/clients/insight/lib/line_client_insight/models/error_response.rb new file mode 100644 index 00000000..4cb4aa52 --- /dev/null +++ b/lib/clients/insight/lib/line_client_insight/models/error_response.rb @@ -0,0 +1,239 @@ +=begin +#LINE Messaging API(Insight) + +#This document describes LINE Messaging API(Insight). + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Insight + class ErrorResponse + # Message containing information about the error. + attr_accessor :message + + # An array of error details. If the array is empty, this property will not be included in the response. + attr_accessor :details + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'message' => :'message', + :'details' => :'details' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'message' => :'String', + :'details' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Insight::ErrorResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Insight::ErrorResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'message') + self.message = attributes[:'message'] + else + self.message = nil + end + + if attributes.key?(:'details') + if (value = attributes[:'details']).is_a?(Array) + self.details = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @message.nil? + invalid_properties.push('invalid value for "message", message cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @message.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + message == o.message && + details == o.details + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [message, details].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Insight.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/insight/lib/line_client_insight/models/gender_tile.rb b/lib/clients/insight/lib/line_client_insight/models/gender_tile.rb new file mode 100644 index 00000000..de52f392 --- /dev/null +++ b/lib/clients/insight/lib/line_client_insight/models/gender_tile.rb @@ -0,0 +1,264 @@ +=begin +#LINE Messaging API(Insight) + +#This document describes LINE Messaging API(Insight). + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Insight + class GenderTile + # users' gender + attr_accessor :gender + + # Percentage + attr_accessor :percentage + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'gender' => :'gender', + :'percentage' => :'percentage' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'gender' => :'String', + :'percentage' => :'Float' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Insight::GenderTile` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Insight::GenderTile`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'gender') + self.gender = attributes[:'gender'] + end + + if attributes.key?(:'percentage') + self.percentage = attributes[:'percentage'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + gender_validator = EnumAttributeValidator.new('String', ["male", "female", "unknown"]) + return false unless gender_validator.valid?(@gender) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] gender Object to be assigned + def gender=(gender) + validator = EnumAttributeValidator.new('String', ["male", "female", "unknown"]) + unless validator.valid?(gender) + fail ArgumentError, "invalid value for \"gender\", must be one of #{validator.allowable_values}." + end + @gender = gender + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + gender == o.gender && + percentage == o.percentage + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [gender, percentage].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Insight.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/insight/lib/line_client_insight/models/get_friends_demographics_response.rb b/lib/clients/insight/lib/line_client_insight/models/get_friends_demographics_response.rb new file mode 100644 index 00000000..85b77557 --- /dev/null +++ b/lib/clients/insight/lib/line_client_insight/models/get_friends_demographics_response.rb @@ -0,0 +1,281 @@ +=begin +#LINE Messaging API(Insight) + +#This document describes LINE Messaging API(Insight). + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Insight + # Get friend demographics + class GetFriendsDemographicsResponse + # true if friend demographic information is available. + attr_accessor :available + + # Percentage per gender. + attr_accessor :genders + + # Percentage per age group. + attr_accessor :ages + + # Percentage per area. + attr_accessor :areas + + # Percentage by OS. + attr_accessor :app_types + + # Percentage per friendship duration. + attr_accessor :subscription_periods + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'available' => :'available', + :'genders' => :'genders', + :'ages' => :'ages', + :'areas' => :'areas', + :'app_types' => :'appTypes', + :'subscription_periods' => :'subscriptionPeriods' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'available' => :'Boolean', + :'genders' => :'Array', + :'ages' => :'Array', + :'areas' => :'Array', + :'app_types' => :'Array', + :'subscription_periods' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Insight::GetFriendsDemographicsResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Insight::GetFriendsDemographicsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'available') + self.available = attributes[:'available'] + end + + if attributes.key?(:'genders') + if (value = attributes[:'genders']).is_a?(Array) + self.genders = value + end + end + + if attributes.key?(:'ages') + if (value = attributes[:'ages']).is_a?(Array) + self.ages = value + end + end + + if attributes.key?(:'areas') + if (value = attributes[:'areas']).is_a?(Array) + self.areas = value + end + end + + if attributes.key?(:'app_types') + if (value = attributes[:'app_types']).is_a?(Array) + self.app_types = value + end + end + + if attributes.key?(:'subscription_periods') + if (value = attributes[:'subscription_periods']).is_a?(Array) + self.subscription_periods = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + available == o.available && + genders == o.genders && + ages == o.ages && + areas == o.areas && + app_types == o.app_types && + subscription_periods == o.subscription_periods + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [available, genders, ages, areas, app_types, subscription_periods].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Insight.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/insight/lib/line_client_insight/models/get_message_event_response.rb b/lib/clients/insight/lib/line_client_insight/models/get_message_event_response.rb new file mode 100644 index 00000000..23d5b757 --- /dev/null +++ b/lib/clients/insight/lib/line_client_insight/models/get_message_event_response.rb @@ -0,0 +1,244 @@ +=begin +#LINE Messaging API(Insight) + +#This document describes LINE Messaging API(Insight). + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Insight + # Statistics about how users interact with narrowcast messages or broadcast messages sent from your LINE Official Account. + class GetMessageEventResponse + attr_accessor :overview + + # Array of information about individual message bubbles. + attr_accessor :messages + + # Array of information about opened URLs in the message. + attr_accessor :clicks + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'overview' => :'overview', + :'messages' => :'messages', + :'clicks' => :'clicks' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'overview' => :'GetMessageEventResponseOverview', + :'messages' => :'Array', + :'clicks' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Insight::GetMessageEventResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Insight::GetMessageEventResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'overview') + self.overview = attributes[:'overview'] + end + + if attributes.key?(:'messages') + if (value = attributes[:'messages']).is_a?(Array) + self.messages = value + end + end + + if attributes.key?(:'clicks') + if (value = attributes[:'clicks']).is_a?(Array) + self.clicks = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + overview == o.overview && + messages == o.messages && + clicks == o.clicks + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [overview, messages, clicks].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Insight.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/insight/lib/line_client_insight/models/get_message_event_response_click.rb b/lib/clients/insight/lib/line_client_insight/models/get_message_event_response_click.rb new file mode 100644 index 00000000..5760c598 --- /dev/null +++ b/lib/clients/insight/lib/line_client_insight/models/get_message_event_response_click.rb @@ -0,0 +1,263 @@ +=begin +#LINE Messaging API(Insight) + +#This document describes LINE Messaging API(Insight). + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Insight + class GetMessageEventResponseClick + # The URL's serial number. + attr_accessor :seq + + # URL. + attr_accessor :url + + # Number of times the URL was opened. + attr_accessor :click + + # Number of users that opened the URL. + attr_accessor :unique_click + + # Number of users who opened this url through any link in the message. If a message contains two links to the same URL and a user opens both links, they're counted only once. + attr_accessor :unique_click_of_request + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'seq' => :'seq', + :'url' => :'url', + :'click' => :'click', + :'unique_click' => :'uniqueClick', + :'unique_click_of_request' => :'uniqueClickOfRequest' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'seq' => :'Integer', + :'url' => :'String', + :'click' => :'Integer', + :'unique_click' => :'Integer', + :'unique_click_of_request' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'click', + :'unique_click', + :'unique_click_of_request' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Insight::GetMessageEventResponseClick` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Insight::GetMessageEventResponseClick`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'seq') + self.seq = attributes[:'seq'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + + if attributes.key?(:'click') + self.click = attributes[:'click'] + end + + if attributes.key?(:'unique_click') + self.unique_click = attributes[:'unique_click'] + end + + if attributes.key?(:'unique_click_of_request') + self.unique_click_of_request = attributes[:'unique_click_of_request'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + seq == o.seq && + url == o.url && + click == o.click && + unique_click == o.unique_click && + unique_click_of_request == o.unique_click_of_request + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [seq, url, click, unique_click, unique_click_of_request].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Insight.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/insight/lib/line_client_insight/models/get_message_event_response_message.rb b/lib/clients/insight/lib/line_client_insight/models/get_message_event_response_message.rb new file mode 100644 index 00000000..6257f818 --- /dev/null +++ b/lib/clients/insight/lib/line_client_insight/models/get_message_event_response_message.rb @@ -0,0 +1,341 @@ +=begin +#LINE Messaging API(Insight) + +#This document describes LINE Messaging API(Insight). + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Insight + class GetMessageEventResponseMessage + # Bubble's serial number. + attr_accessor :seq + + # Number of times the bubble was displayed. + attr_accessor :impression + + # Number of times audio or video in the bubble started playing. + attr_accessor :media_played + + # Number of times audio or video in the bubble started playing and was played 25% of the total time. + attr_accessor :media_played25_percent + + # Number of times audio or video in the bubble started playing and was played 50% of the total time. + attr_accessor :media_played50_percent + + # Number of times audio or video in the bubble started playing and was played 75% of the total time. + attr_accessor :media_played75_percent + + # Number of times audio or video in the bubble started playing and was played 100% of the total time. + attr_accessor :media_played100_percent + + # Number of users that started playing audio or video in the bubble. + attr_accessor :unique_media_played + + # Number of users that started playing audio or video in the bubble and played 25% of the total time. + attr_accessor :unique_media_played25_percent + + # Number of users that started playing audio or video in the bubble and played 50% of the total time. + attr_accessor :unique_media_played50_percent + + # Number of users that started playing audio or video in the bubble and played 75% of the total time. + attr_accessor :unique_media_played75_percent + + # Number of users that started playing audio or video in the bubble and played 100% of the total time. + attr_accessor :unique_media_played100_percent + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'seq' => :'seq', + :'impression' => :'impression', + :'media_played' => :'mediaPlayed', + :'media_played25_percent' => :'mediaPlayed25Percent', + :'media_played50_percent' => :'mediaPlayed50Percent', + :'media_played75_percent' => :'mediaPlayed75Percent', + :'media_played100_percent' => :'mediaPlayed100Percent', + :'unique_media_played' => :'uniqueMediaPlayed', + :'unique_media_played25_percent' => :'uniqueMediaPlayed25Percent', + :'unique_media_played50_percent' => :'uniqueMediaPlayed50Percent', + :'unique_media_played75_percent' => :'uniqueMediaPlayed75Percent', + :'unique_media_played100_percent' => :'uniqueMediaPlayed100Percent' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'seq' => :'Integer', + :'impression' => :'Integer', + :'media_played' => :'Integer', + :'media_played25_percent' => :'Integer', + :'media_played50_percent' => :'Integer', + :'media_played75_percent' => :'Integer', + :'media_played100_percent' => :'Integer', + :'unique_media_played' => :'Integer', + :'unique_media_played25_percent' => :'Integer', + :'unique_media_played50_percent' => :'Integer', + :'unique_media_played75_percent' => :'Integer', + :'unique_media_played100_percent' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'impression', + :'media_played', + :'media_played25_percent', + :'media_played50_percent', + :'media_played75_percent', + :'media_played100_percent', + :'unique_media_played', + :'unique_media_played25_percent', + :'unique_media_played50_percent', + :'unique_media_played75_percent', + :'unique_media_played100_percent' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Insight::GetMessageEventResponseMessage` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Insight::GetMessageEventResponseMessage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'seq') + self.seq = attributes[:'seq'] + end + + if attributes.key?(:'impression') + self.impression = attributes[:'impression'] + end + + if attributes.key?(:'media_played') + self.media_played = attributes[:'media_played'] + end + + if attributes.key?(:'media_played25_percent') + self.media_played25_percent = attributes[:'media_played25_percent'] + end + + if attributes.key?(:'media_played50_percent') + self.media_played50_percent = attributes[:'media_played50_percent'] + end + + if attributes.key?(:'media_played75_percent') + self.media_played75_percent = attributes[:'media_played75_percent'] + end + + if attributes.key?(:'media_played100_percent') + self.media_played100_percent = attributes[:'media_played100_percent'] + end + + if attributes.key?(:'unique_media_played') + self.unique_media_played = attributes[:'unique_media_played'] + end + + if attributes.key?(:'unique_media_played25_percent') + self.unique_media_played25_percent = attributes[:'unique_media_played25_percent'] + end + + if attributes.key?(:'unique_media_played50_percent') + self.unique_media_played50_percent = attributes[:'unique_media_played50_percent'] + end + + if attributes.key?(:'unique_media_played75_percent') + self.unique_media_played75_percent = attributes[:'unique_media_played75_percent'] + end + + if attributes.key?(:'unique_media_played100_percent') + self.unique_media_played100_percent = attributes[:'unique_media_played100_percent'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + seq == o.seq && + impression == o.impression && + media_played == o.media_played && + media_played25_percent == o.media_played25_percent && + media_played50_percent == o.media_played50_percent && + media_played75_percent == o.media_played75_percent && + media_played100_percent == o.media_played100_percent && + unique_media_played == o.unique_media_played && + unique_media_played25_percent == o.unique_media_played25_percent && + unique_media_played50_percent == o.unique_media_played50_percent && + unique_media_played75_percent == o.unique_media_played75_percent && + unique_media_played100_percent == o.unique_media_played100_percent + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [seq, impression, media_played, media_played25_percent, media_played50_percent, media_played75_percent, media_played100_percent, unique_media_played, unique_media_played25_percent, unique_media_played50_percent, unique_media_played75_percent, unique_media_played100_percent].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Insight.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/insight/lib/line_client_insight/models/get_message_event_response_overview.rb b/lib/clients/insight/lib/line_client_insight/models/get_message_event_response_overview.rb new file mode 100644 index 00000000..ac7e7940 --- /dev/null +++ b/lib/clients/insight/lib/line_client_insight/models/get_message_event_response_overview.rb @@ -0,0 +1,285 @@ +=begin +#LINE Messaging API(Insight) + +#This document describes LINE Messaging API(Insight). + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Insight + # Summary of message statistics. + class GetMessageEventResponseOverview + # Request ID. + attr_accessor :request_id + + # UNIX timestamp for message delivery time in seconds. + attr_accessor :timestamp + + # Number of messages delivered. This property shows values of less than 20. However, if all messages have not been sent, it will be null. + attr_accessor :delivered + + # Number of users who opened the message, meaning they displayed at least 1 bubble. + attr_accessor :unique_impression + + # Number of users who opened any URL in the message. + attr_accessor :unique_click + + # Number of users who started playing any video or audio in the message. + attr_accessor :unique_media_played + + # Number of users who played the entirety of any video or audio in the message. + attr_accessor :unique_media_played100_percent + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'request_id' => :'requestId', + :'timestamp' => :'timestamp', + :'delivered' => :'delivered', + :'unique_impression' => :'uniqueImpression', + :'unique_click' => :'uniqueClick', + :'unique_media_played' => :'uniqueMediaPlayed', + :'unique_media_played100_percent' => :'uniqueMediaPlayed100Percent' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'request_id' => :'String', + :'timestamp' => :'Integer', + :'delivered' => :'Integer', + :'unique_impression' => :'Integer', + :'unique_click' => :'Integer', + :'unique_media_played' => :'Integer', + :'unique_media_played100_percent' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'unique_impression', + :'unique_click', + :'unique_media_played', + :'unique_media_played100_percent' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Insight::GetMessageEventResponseOverview` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Insight::GetMessageEventResponseOverview`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'request_id') + self.request_id = attributes[:'request_id'] + end + + if attributes.key?(:'timestamp') + self.timestamp = attributes[:'timestamp'] + end + + if attributes.key?(:'delivered') + self.delivered = attributes[:'delivered'] + end + + if attributes.key?(:'unique_impression') + self.unique_impression = attributes[:'unique_impression'] + end + + if attributes.key?(:'unique_click') + self.unique_click = attributes[:'unique_click'] + end + + if attributes.key?(:'unique_media_played') + self.unique_media_played = attributes[:'unique_media_played'] + end + + if attributes.key?(:'unique_media_played100_percent') + self.unique_media_played100_percent = attributes[:'unique_media_played100_percent'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + request_id == o.request_id && + timestamp == o.timestamp && + delivered == o.delivered && + unique_impression == o.unique_impression && + unique_click == o.unique_click && + unique_media_played == o.unique_media_played && + unique_media_played100_percent == o.unique_media_played100_percent + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [request_id, timestamp, delivered, unique_impression, unique_click, unique_media_played, unique_media_played100_percent].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Insight.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/insight/lib/line_client_insight/models/get_number_of_followers_response.rb b/lib/clients/insight/lib/line_client_insight/models/get_number_of_followers_response.rb new file mode 100644 index 00000000..93f9d5d1 --- /dev/null +++ b/lib/clients/insight/lib/line_client_insight/models/get_number_of_followers_response.rb @@ -0,0 +1,285 @@ +=begin +#LINE Messaging API(Insight) + +#This document describes LINE Messaging API(Insight). + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Insight + # Get number of followers + class GetNumberOfFollowersResponse + # Calculation status. + attr_accessor :status + + # The number of times, as of the specified date, that a user added this LINE Official Account as a friend for the first time. The number doesn't decrease even if a user later blocks the account or when they delete their LINE account. + attr_accessor :followers + + # The number of users, as of the specified date, that the LINE Official Account can reach through targeted messages based on gender, age, and/or region. This number only includes users who are active on LINE or LINE services and whose demographics have a high level of certainty. + attr_accessor :targeted_reaches + + # The number of users blocking the account as of the specified date. The number decreases when a user unblocks the account. + attr_accessor :blocks + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'status' => :'status', + :'followers' => :'followers', + :'targeted_reaches' => :'targetedReaches', + :'blocks' => :'blocks' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'status' => :'String', + :'followers' => :'Integer', + :'targeted_reaches' => :'Integer', + :'blocks' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Insight::GetNumberOfFollowersResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Insight::GetNumberOfFollowersResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'followers') + self.followers = attributes[:'followers'] + end + + if attributes.key?(:'targeted_reaches') + self.targeted_reaches = attributes[:'targeted_reaches'] + end + + if attributes.key?(:'blocks') + self.blocks = attributes[:'blocks'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + status_validator = EnumAttributeValidator.new('String', ["ready", "unready", "out_of_service"]) + return false unless status_validator.valid?(@status) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] status Object to be assigned + def status=(status) + validator = EnumAttributeValidator.new('String', ["ready", "unready", "out_of_service"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + status == o.status && + followers == o.followers && + targeted_reaches == o.targeted_reaches && + blocks == o.blocks + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [status, followers, targeted_reaches, blocks].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Insight.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/insight/lib/line_client_insight/models/get_number_of_message_deliveries_response.rb b/lib/clients/insight/lib/line_client_insight/models/get_number_of_message_deliveries_response.rb new file mode 100644 index 00000000..77869c11 --- /dev/null +++ b/lib/clients/insight/lib/line_client_insight/models/get_number_of_message_deliveries_response.rb @@ -0,0 +1,355 @@ +=begin +#LINE Messaging API(Insight) + +#This document describes LINE Messaging API(Insight). + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Insight + # Get number of message deliveries + class GetNumberOfMessageDeliveriesResponse + # Status of the counting process. + attr_accessor :status + + # Number of messages sent to all of this LINE Official Account's friends (broadcast messages). + attr_accessor :broadcast + + # Number of messages sent to some of this LINE Official Account's friends, based on specific attributes (targeted messages). + attr_accessor :targeting + + # Number of auto-response messages sent. + attr_accessor :auto_response + + # Number of greeting messages sent. + attr_accessor :welcome_response + + # Number of messages sent from LINE Official Account Manager [Chat screen](https://www.linebiz.com/jp/manual/OfficialAccountManager/chats/) (only available in Japanese). + attr_accessor :chat + + # Number of broadcast messages sent with the `Send broadcast message` Messaging API operation. + attr_accessor :api_broadcast + + # Number of push messages sent with the `Send push message` Messaging API operation. + attr_accessor :api_push + + # Number of multicast messages sent with the `Send multicast message` Messaging API operation. + attr_accessor :api_multicast + + # Number of narrowcast messages sent with the `Send narrowcast message` Messaging API operation. + attr_accessor :api_narrowcast + + # Number of replies sent with the `Send reply message` Messaging API operation. + attr_accessor :api_reply + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'status' => :'status', + :'broadcast' => :'broadcast', + :'targeting' => :'targeting', + :'auto_response' => :'autoResponse', + :'welcome_response' => :'welcomeResponse', + :'chat' => :'chat', + :'api_broadcast' => :'apiBroadcast', + :'api_push' => :'apiPush', + :'api_multicast' => :'apiMulticast', + :'api_narrowcast' => :'apiNarrowcast', + :'api_reply' => :'apiReply' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'status' => :'String', + :'broadcast' => :'Integer', + :'targeting' => :'Integer', + :'auto_response' => :'Integer', + :'welcome_response' => :'Integer', + :'chat' => :'Integer', + :'api_broadcast' => :'Integer', + :'api_push' => :'Integer', + :'api_multicast' => :'Integer', + :'api_narrowcast' => :'Integer', + :'api_reply' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Insight::GetNumberOfMessageDeliveriesResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Insight::GetNumberOfMessageDeliveriesResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'broadcast') + self.broadcast = attributes[:'broadcast'] + end + + if attributes.key?(:'targeting') + self.targeting = attributes[:'targeting'] + end + + if attributes.key?(:'auto_response') + self.auto_response = attributes[:'auto_response'] + end + + if attributes.key?(:'welcome_response') + self.welcome_response = attributes[:'welcome_response'] + end + + if attributes.key?(:'chat') + self.chat = attributes[:'chat'] + end + + if attributes.key?(:'api_broadcast') + self.api_broadcast = attributes[:'api_broadcast'] + end + + if attributes.key?(:'api_push') + self.api_push = attributes[:'api_push'] + end + + if attributes.key?(:'api_multicast') + self.api_multicast = attributes[:'api_multicast'] + end + + if attributes.key?(:'api_narrowcast') + self.api_narrowcast = attributes[:'api_narrowcast'] + end + + if attributes.key?(:'api_reply') + self.api_reply = attributes[:'api_reply'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + status_validator = EnumAttributeValidator.new('String', ["ready", "unready", "out_of_service"]) + return false unless status_validator.valid?(@status) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] status Object to be assigned + def status=(status) + validator = EnumAttributeValidator.new('String', ["ready", "unready", "out_of_service"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + status == o.status && + broadcast == o.broadcast && + targeting == o.targeting && + auto_response == o.auto_response && + welcome_response == o.welcome_response && + chat == o.chat && + api_broadcast == o.api_broadcast && + api_push == o.api_push && + api_multicast == o.api_multicast && + api_narrowcast == o.api_narrowcast && + api_reply == o.api_reply + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [status, broadcast, targeting, auto_response, welcome_response, chat, api_broadcast, api_push, api_multicast, api_narrowcast, api_reply].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Insight.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/insight/lib/line_client_insight/models/get_statistics_per_unit_response.rb b/lib/clients/insight/lib/line_client_insight/models/get_statistics_per_unit_response.rb new file mode 100644 index 00000000..84dcdb38 --- /dev/null +++ b/lib/clients/insight/lib/line_client_insight/models/get_statistics_per_unit_response.rb @@ -0,0 +1,265 @@ +=begin +#LINE Messaging API(Insight) + +#This document describes LINE Messaging API(Insight). + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Insight + # Response object for `get statistics per unit` + class GetStatisticsPerUnitResponse + attr_accessor :overview + + # Array of information about individual message bubbles. + attr_accessor :messages + + # Array of information about opened URLs in the message. + attr_accessor :clicks + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'overview' => :'overview', + :'messages' => :'messages', + :'clicks' => :'clicks' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'overview' => :'GetStatisticsPerUnitResponseOverview', + :'messages' => :'Array', + :'clicks' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Insight::GetStatisticsPerUnitResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Insight::GetStatisticsPerUnitResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'overview') + self.overview = attributes[:'overview'] + else + self.overview = nil + end + + if attributes.key?(:'messages') + if (value = attributes[:'messages']).is_a?(Array) + self.messages = value + end + else + self.messages = nil + end + + if attributes.key?(:'clicks') + if (value = attributes[:'clicks']).is_a?(Array) + self.clicks = value + end + else + self.clicks = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @overview.nil? + invalid_properties.push('invalid value for "overview", overview cannot be nil.') + end + + if @messages.nil? + invalid_properties.push('invalid value for "messages", messages cannot be nil.') + end + + if @clicks.nil? + invalid_properties.push('invalid value for "clicks", clicks cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @overview.nil? + return false if @messages.nil? + return false if @clicks.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + overview == o.overview && + messages == o.messages && + clicks == o.clicks + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [overview, messages, clicks].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Insight.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/insight/lib/line_client_insight/models/get_statistics_per_unit_response_click.rb b/lib/clients/insight/lib/line_client_insight/models/get_statistics_per_unit_response_click.rb new file mode 100644 index 00000000..2971cd54 --- /dev/null +++ b/lib/clients/insight/lib/line_client_insight/models/get_statistics_per_unit_response_click.rb @@ -0,0 +1,277 @@ +=begin +#LINE Messaging API(Insight) + +#This document describes LINE Messaging API(Insight). + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Insight + class GetStatisticsPerUnitResponseClick + # The URL's serial number. + attr_accessor :seq + + # URL. + attr_accessor :url + + # Number of times the URL in the bubble was opened. + attr_accessor :click + + # Number of users that opened the URL in the bubble. + attr_accessor :unique_click + + # Number of users who opened this url through any link in the message. If another message bubble contains the same URL and a user opens both links, it's counted only once. + attr_accessor :unique_click_of_request + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'seq' => :'seq', + :'url' => :'url', + :'click' => :'click', + :'unique_click' => :'uniqueClick', + :'unique_click_of_request' => :'uniqueClickOfRequest' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'seq' => :'Integer', + :'url' => :'String', + :'click' => :'Integer', + :'unique_click' => :'Integer', + :'unique_click_of_request' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'click', + :'unique_click', + :'unique_click_of_request' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Insight::GetStatisticsPerUnitResponseClick` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Insight::GetStatisticsPerUnitResponseClick`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'seq') + self.seq = attributes[:'seq'] + else + self.seq = nil + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + else + self.url = nil + end + + if attributes.key?(:'click') + self.click = attributes[:'click'] + end + + if attributes.key?(:'unique_click') + self.unique_click = attributes[:'unique_click'] + end + + if attributes.key?(:'unique_click_of_request') + self.unique_click_of_request = attributes[:'unique_click_of_request'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @seq.nil? + invalid_properties.push('invalid value for "seq", seq cannot be nil.') + end + + if @url.nil? + invalid_properties.push('invalid value for "url", url cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @seq.nil? + return false if @url.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + seq == o.seq && + url == o.url && + click == o.click && + unique_click == o.unique_click && + unique_click_of_request == o.unique_click_of_request + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [seq, url, click, unique_click, unique_click_of_request].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Insight.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/insight/lib/line_client_insight/models/get_statistics_per_unit_response_message.rb b/lib/clients/insight/lib/line_client_insight/models/get_statistics_per_unit_response_message.rb new file mode 100644 index 00000000..7e602061 --- /dev/null +++ b/lib/clients/insight/lib/line_client_insight/models/get_statistics_per_unit_response_message.rb @@ -0,0 +1,359 @@ +=begin +#LINE Messaging API(Insight) + +#This document describes LINE Messaging API(Insight). + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Insight + class GetStatisticsPerUnitResponseMessage + # Bubble's serial number. + attr_accessor :seq + + # Number of times the bubble was displayed. + attr_accessor :impression + + # Number of times audio or video in the bubble started playing. + attr_accessor :media_played + + # Number of times audio or video in the bubble started playing and was played 25% of the total time. + attr_accessor :media_played25_percent + + # Number of times audio or video in the bubble started playing and was played 50% of the total time. + attr_accessor :media_played50_percent + + # Number of times audio or video in the bubble started playing and was played 75% of the total time. + attr_accessor :media_played75_percent + + # Number of times audio or video in the bubble started playing and was played 100% of the total time. + attr_accessor :media_played100_percent + + # Number of users the bubble was displayed. + attr_accessor :unique_impression + + # Number of users that started playing audio or video in the bubble. + attr_accessor :unique_media_played + + # Number of users that started playing audio or video in the bubble and played 25% of the total time. + attr_accessor :unique_media_played25_percent + + # Number of users that started playing audio or video in the bubble and played 50% of the total time. + attr_accessor :unique_media_played50_percent + + # Number of users that started playing audio or video in the bubble and played 75% of the total time. + attr_accessor :unique_media_played75_percent + + # Number of users that started playing audio or video in the bubble and played 100% of the total time. + attr_accessor :unique_media_played100_percent + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'seq' => :'seq', + :'impression' => :'impression', + :'media_played' => :'mediaPlayed', + :'media_played25_percent' => :'mediaPlayed25Percent', + :'media_played50_percent' => :'mediaPlayed50Percent', + :'media_played75_percent' => :'mediaPlayed75Percent', + :'media_played100_percent' => :'mediaPlayed100Percent', + :'unique_impression' => :'uniqueImpression', + :'unique_media_played' => :'uniqueMediaPlayed', + :'unique_media_played25_percent' => :'uniqueMediaPlayed25Percent', + :'unique_media_played50_percent' => :'uniqueMediaPlayed50Percent', + :'unique_media_played75_percent' => :'uniqueMediaPlayed75Percent', + :'unique_media_played100_percent' => :'uniqueMediaPlayed100Percent' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'seq' => :'Integer', + :'impression' => :'Integer', + :'media_played' => :'Integer', + :'media_played25_percent' => :'Integer', + :'media_played50_percent' => :'Integer', + :'media_played75_percent' => :'Integer', + :'media_played100_percent' => :'Integer', + :'unique_impression' => :'Integer', + :'unique_media_played' => :'Integer', + :'unique_media_played25_percent' => :'Integer', + :'unique_media_played50_percent' => :'Integer', + :'unique_media_played75_percent' => :'Integer', + :'unique_media_played100_percent' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'impression', + :'media_played', + :'media_played25_percent', + :'media_played50_percent', + :'media_played75_percent', + :'media_played100_percent', + :'unique_impression', + :'unique_media_played', + :'unique_media_played25_percent', + :'unique_media_played50_percent', + :'unique_media_played75_percent', + :'unique_media_played100_percent' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Insight::GetStatisticsPerUnitResponseMessage` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Insight::GetStatisticsPerUnitResponseMessage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'seq') + self.seq = attributes[:'seq'] + else + self.seq = nil + end + + if attributes.key?(:'impression') + self.impression = attributes[:'impression'] + end + + if attributes.key?(:'media_played') + self.media_played = attributes[:'media_played'] + end + + if attributes.key?(:'media_played25_percent') + self.media_played25_percent = attributes[:'media_played25_percent'] + end + + if attributes.key?(:'media_played50_percent') + self.media_played50_percent = attributes[:'media_played50_percent'] + end + + if attributes.key?(:'media_played75_percent') + self.media_played75_percent = attributes[:'media_played75_percent'] + end + + if attributes.key?(:'media_played100_percent') + self.media_played100_percent = attributes[:'media_played100_percent'] + end + + if attributes.key?(:'unique_impression') + self.unique_impression = attributes[:'unique_impression'] + end + + if attributes.key?(:'unique_media_played') + self.unique_media_played = attributes[:'unique_media_played'] + end + + if attributes.key?(:'unique_media_played25_percent') + self.unique_media_played25_percent = attributes[:'unique_media_played25_percent'] + end + + if attributes.key?(:'unique_media_played50_percent') + self.unique_media_played50_percent = attributes[:'unique_media_played50_percent'] + end + + if attributes.key?(:'unique_media_played75_percent') + self.unique_media_played75_percent = attributes[:'unique_media_played75_percent'] + end + + if attributes.key?(:'unique_media_played100_percent') + self.unique_media_played100_percent = attributes[:'unique_media_played100_percent'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @seq.nil? + invalid_properties.push('invalid value for "seq", seq cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @seq.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + seq == o.seq && + impression == o.impression && + media_played == o.media_played && + media_played25_percent == o.media_played25_percent && + media_played50_percent == o.media_played50_percent && + media_played75_percent == o.media_played75_percent && + media_played100_percent == o.media_played100_percent && + unique_impression == o.unique_impression && + unique_media_played == o.unique_media_played && + unique_media_played25_percent == o.unique_media_played25_percent && + unique_media_played50_percent == o.unique_media_played50_percent && + unique_media_played75_percent == o.unique_media_played75_percent && + unique_media_played100_percent == o.unique_media_played100_percent + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [seq, impression, media_played, media_played25_percent, media_played50_percent, media_played75_percent, media_played100_percent, unique_impression, unique_media_played, unique_media_played25_percent, unique_media_played50_percent, unique_media_played75_percent, unique_media_played100_percent].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Insight.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/insight/lib/line_client_insight/models/get_statistics_per_unit_response_overview.rb b/lib/clients/insight/lib/line_client_insight/models/get_statistics_per_unit_response_overview.rb new file mode 100644 index 00000000..95424675 --- /dev/null +++ b/lib/clients/insight/lib/line_client_insight/models/get_statistics_per_unit_response_overview.rb @@ -0,0 +1,255 @@ +=begin +#LINE Messaging API(Insight) + +#This document describes LINE Messaging API(Insight). + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Insight + # Statistics related to messages. + class GetStatisticsPerUnitResponseOverview + # Number of users who opened the message, meaning they displayed at least 1 bubble. + attr_accessor :unique_impression + + # Number of users who opened any URL in the message. + attr_accessor :unique_click + + # Number of users who started playing any video or audio in the message. + attr_accessor :unique_media_played + + # Number of users who played the entirety of any video or audio in the message. + attr_accessor :unique_media_played100_percent + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'unique_impression' => :'uniqueImpression', + :'unique_click' => :'uniqueClick', + :'unique_media_played' => :'uniqueMediaPlayed', + :'unique_media_played100_percent' => :'uniqueMediaPlayed100Percent' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'unique_impression' => :'Integer', + :'unique_click' => :'Integer', + :'unique_media_played' => :'Integer', + :'unique_media_played100_percent' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'unique_impression', + :'unique_click', + :'unique_media_played', + :'unique_media_played100_percent' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Insight::GetStatisticsPerUnitResponseOverview` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Insight::GetStatisticsPerUnitResponseOverview`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'unique_impression') + self.unique_impression = attributes[:'unique_impression'] + end + + if attributes.key?(:'unique_click') + self.unique_click = attributes[:'unique_click'] + end + + if attributes.key?(:'unique_media_played') + self.unique_media_played = attributes[:'unique_media_played'] + end + + if attributes.key?(:'unique_media_played100_percent') + self.unique_media_played100_percent = attributes[:'unique_media_played100_percent'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + unique_impression == o.unique_impression && + unique_click == o.unique_click && + unique_media_played == o.unique_media_played && + unique_media_played100_percent == o.unique_media_played100_percent + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [unique_impression, unique_click, unique_media_played, unique_media_played100_percent].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Insight.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/insight/lib/line_client_insight/models/subscription_period_tile.rb b/lib/clients/insight/lib/line_client_insight/models/subscription_period_tile.rb new file mode 100644 index 00000000..8ac145dc --- /dev/null +++ b/lib/clients/insight/lib/line_client_insight/models/subscription_period_tile.rb @@ -0,0 +1,264 @@ +=begin +#LINE Messaging API(Insight) + +#This document describes LINE Messaging API(Insight). + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Insight + class SubscriptionPeriodTile + # Subscription period. Possible values: `within7days`, `within90days`, `unknown` etc. + attr_accessor :subscription_period + + # Percentage. Possible values: [0.0,100.0] e.g. 0, 2.9, 37.6. + attr_accessor :percentage + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'subscription_period' => :'subscriptionPeriod', + :'percentage' => :'percentage' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'subscription_period' => :'String', + :'percentage' => :'Float' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Insight::SubscriptionPeriodTile` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Insight::SubscriptionPeriodTile`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'subscription_period') + self.subscription_period = attributes[:'subscription_period'] + end + + if attributes.key?(:'percentage') + self.percentage = attributes[:'percentage'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + subscription_period_validator = EnumAttributeValidator.new('String', ["within7days", "within30days", "within90days", "within180days", "within365days", "over365days", "unknown"]) + return false unless subscription_period_validator.valid?(@subscription_period) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] subscription_period Object to be assigned + def subscription_period=(subscription_period) + validator = EnumAttributeValidator.new('String', ["within7days", "within30days", "within90days", "within180days", "within365days", "over365days", "unknown"]) + unless validator.valid?(subscription_period) + fail ArgumentError, "invalid value for \"subscription_period\", must be one of #{validator.allowable_values}." + end + @subscription_period = subscription_period + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + subscription_period == o.subscription_period && + percentage == o.percentage + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [subscription_period, percentage].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Insight.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/insight/lib/line_client_insight/version.rb b/lib/clients/insight/lib/line_client_insight/version.rb new file mode 100644 index 00000000..a4bec330 --- /dev/null +++ b/lib/clients/insight/lib/line_client_insight/version.rb @@ -0,0 +1,15 @@ +=begin +#LINE Messaging API(Insight) + +#This document describes LINE Messaging API(Insight). + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::Insight + VERSION = '2.0.0' +end diff --git a/lib/clients/liff/.gitignore b/lib/clients/liff/.gitignore new file mode 100644 index 00000000..05a17cb8 --- /dev/null +++ b/lib/clients/liff/.gitignore @@ -0,0 +1,39 @@ +# Generated by: https://openapi-generator.tech +# + +*.gem +*.rbc +/.config +/coverage/ +/InstalledFiles +/pkg/ +/spec/reports/ +/spec/examples.txt +/test/tmp/ +/test/version_tmp/ +/tmp/ + +## Specific to RubyMotion: +.dat* +.repl_history +build/ + +## Documentation cache and generated files: +/.yardoc/ +/_yardoc/ +/doc/ +/rdoc/ + +## Environment normalization: +/.bundle/ +/vendor/bundle +/lib/bundler/man/ + +# for a library or gem, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# Gemfile.lock +# .ruby-version +# .ruby-gemset + +# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: +.rvmrc diff --git a/lib/clients/liff/.openapi-generator/FILES b/lib/clients/liff/.openapi-generator/FILES new file mode 100644 index 00000000..d8932dbd --- /dev/null +++ b/lib/clients/liff/.openapi-generator/FILES @@ -0,0 +1,38 @@ +.gitignore +.gitlab-ci.yml +.rspec +.rubocop.yml +.travis.yml +Gemfile +README.md +Rakefile +docs/AddLiffAppRequest.md +docs/AddLiffAppResponse.md +docs/GetAllLiffAppsResponse.md +docs/LiffApi.md +docs/LiffApp.md +docs/LiffBotPrompt.md +docs/LiffFeatures.md +docs/LiffScope.md +docs/LiffView.md +docs/UpdateLiffAppRequest.md +git_push.sh +lib/line_client_liff.rb +lib/line_client_liff/api/liff_api.rb +lib/line_client_liff/api_client.rb +lib/line_client_liff/api_error.rb +lib/line_client_liff/configuration.rb +lib/line_client_liff/models/add_liff_app_request.rb +lib/line_client_liff/models/add_liff_app_response.rb +lib/line_client_liff/models/get_all_liff_apps_response.rb +lib/line_client_liff/models/liff_app.rb +lib/line_client_liff/models/liff_bot_prompt.rb +lib/line_client_liff/models/liff_features.rb +lib/line_client_liff/models/liff_scope.rb +lib/line_client_liff/models/liff_view.rb +lib/line_client_liff/models/update_liff_app_request.rb +lib/line_client_liff/version.rb +line_client_liff.gemspec +spec/api_client_spec.rb +spec/configuration_spec.rb +spec/spec_helper.rb diff --git a/lib/clients/liff/.openapi-generator/VERSION b/lib/clients/liff/.openapi-generator/VERSION new file mode 100644 index 00000000..41225218 --- /dev/null +++ b/lib/clients/liff/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.0.0 \ No newline at end of file diff --git a/lib/clients/liff/README.md b/lib/clients/liff/README.md new file mode 100644 index 00000000..046dc6fe --- /dev/null +++ b/lib/clients/liff/README.md @@ -0,0 +1,109 @@ +# LINE::Client::Liff + +LIFF Server API. + +This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 1.0 +- Package version: 2.0.0 +- Build package: org.openapitools.codegen.languages.RubyClientCodegen + +## Installation + +### Build a gem + +To build the Ruby code into a gem: + +```shell +gem build line-bot-api.gemspec +``` + +Then either install the gem locally: + +```shell +gem install ./line-bot-api-2.0.0.gem +``` + +(for development, run `gem install --dev ./line-bot-api-2.0.0.gem` to install the development dependencies) + +or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/). + +Finally add this to the Gemfile: + + gem 'line-bot-api', '~> 2.0.0' + +### Install from Git + +If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile: + + gem 'line-bot-api', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git' + +### Include the Ruby code directly + +Include the Ruby code directly using `-I` as follows: + +```shell +ruby -Ilib script.rb +``` + +## Getting Started + +Please follow the [installation](#installation) procedure and then run the following code: + +```ruby +# Load the gem +require 'line-bot-api' + +# Setup authorization +LINE::Client::Liff.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' + # Configure a proc to get access tokens in lieu of the static access_token configuration + config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' } +end + +api_instance = LINE::Client::Liff::LiffApi.new +add_liff_app_request = LINE::Client::Liff::AddLiffAppRequest.new({view: LINE::Client::Liff::LiffView.new({type: 'compact', url: 'url_example'})}) # AddLiffAppRequest | + +begin + result = api_instance.add_liff_app(add_liff_app_request) + p result +rescue LINE::Client::Liff::ApiError => e + puts "Exception when calling LiffApi->add_liff_app: #{e}" +end + +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://api.line.me* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*LINE::Client::Liff::LiffApi* | [**add_liff_app**](docs/LiffApi.md#add_liff_app) | **POST** /liff/v1/apps | +*LINE::Client::Liff::LiffApi* | [**delete_liff_app**](docs/LiffApi.md#delete_liff_app) | **DELETE** /liff/v1/apps/{liffId} | Delete LIFF app from a channel +*LINE::Client::Liff::LiffApi* | [**get_all_liff_apps**](docs/LiffApi.md#get_all_liff_apps) | **GET** /liff/v1/apps | Get all LIFF apps +*LINE::Client::Liff::LiffApi* | [**update_liff_app**](docs/LiffApi.md#update_liff_app) | **PUT** /liff/v1/apps/{liffId} | + + +## Documentation for Models + + - [LINE::Client::Liff::AddLiffAppRequest](docs/AddLiffAppRequest.md) + - [LINE::Client::Liff::AddLiffAppResponse](docs/AddLiffAppResponse.md) + - [LINE::Client::Liff::GetAllLiffAppsResponse](docs/GetAllLiffAppsResponse.md) + - [LINE::Client::Liff::LiffApp](docs/LiffApp.md) + - [LINE::Client::Liff::LiffBotPrompt](docs/LiffBotPrompt.md) + - [LINE::Client::Liff::LiffFeatures](docs/LiffFeatures.md) + - [LINE::Client::Liff::LiffScope](docs/LiffScope.md) + - [LINE::Client::Liff::LiffView](docs/LiffView.md) + - [LINE::Client::Liff::UpdateLiffAppRequest](docs/UpdateLiffAppRequest.md) + + +## Documentation for Authorization + + +Authentication schemes defined for the API: +### Bearer + +- **Type**: Bearer authentication + diff --git a/lib/clients/liff/docs/AddLiffAppRequest.md b/lib/clients/liff/docs/AddLiffAppRequest.md new file mode 100644 index 00000000..7e18ef20 --- /dev/null +++ b/lib/clients/liff/docs/AddLiffAppRequest.md @@ -0,0 +1,28 @@ +# LINE::Client::Liff::AddLiffAppRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **view** | [**LiffView**](LiffView.md) | | | +| **description** | **String** | Name of the LIFF app. The LIFF app name can't include \"LINE\" or similar strings, or inappropriate strings. | [optional] | +| **features** | [**LiffFeatures**](LiffFeatures.md) | | [optional] | +| **permanent_link_pattern** | **String** | How additional information in LIFF URLs is handled. Specify `concat`. | [optional] | +| **scope** | [**Array<LiffScope>**](LiffScope.md) | | [optional] | +| **bot_prompt** | [**LiffBotPrompt**](LiffBotPrompt.md) | | [optional] | + +## Example + +```ruby +require 'line_client_liff' + +instance = LINE::Client::Liff::AddLiffAppRequest.new( + view: null, + description: null, + features: null, + permanent_link_pattern: null, + scope: null, + bot_prompt: null +) +``` + diff --git a/lib/clients/liff/docs/AddLiffAppResponse.md b/lib/clients/liff/docs/AddLiffAppResponse.md new file mode 100644 index 00000000..59de548a --- /dev/null +++ b/lib/clients/liff/docs/AddLiffAppResponse.md @@ -0,0 +1,18 @@ +# LINE::Client::Liff::AddLiffAppResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **liff_id** | **String** | | | + +## Example + +```ruby +require 'line_client_liff' + +instance = LINE::Client::Liff::AddLiffAppResponse.new( + liff_id: null +) +``` + diff --git a/lib/clients/liff/docs/GetAllLiffAppsResponse.md b/lib/clients/liff/docs/GetAllLiffAppsResponse.md new file mode 100644 index 00000000..fff70b96 --- /dev/null +++ b/lib/clients/liff/docs/GetAllLiffAppsResponse.md @@ -0,0 +1,18 @@ +# LINE::Client::Liff::GetAllLiffAppsResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **apps** | [**Array<LiffApp>**](LiffApp.md) | | [optional] | + +## Example + +```ruby +require 'line_client_liff' + +instance = LINE::Client::Liff::GetAllLiffAppsResponse.new( + apps: null +) +``` + diff --git a/lib/clients/liff/docs/LiffApi.md b/lib/clients/liff/docs/LiffApi.md new file mode 100644 index 00000000..891b5254 --- /dev/null +++ b/lib/clients/liff/docs/LiffApi.md @@ -0,0 +1,284 @@ +# LINE::Client::Liff::LiffApi + +All URIs are relative to *https://api.line.me* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**add_liff_app**](LiffApi.md#add_liff_app) | **POST** /liff/v1/apps | | +| [**delete_liff_app**](LiffApi.md#delete_liff_app) | **DELETE** /liff/v1/apps/{liffId} | Delete LIFF app from a channel | +| [**get_all_liff_apps**](LiffApi.md#get_all_liff_apps) | **GET** /liff/v1/apps | Get all LIFF apps | +| [**update_liff_app**](LiffApi.md#update_liff_app) | **PUT** /liff/v1/apps/{liffId} | | + + +## add_liff_app + +> add_liff_app(add_liff_app_request) + + + +Adding the LIFF app to a channel + +### Examples + +```ruby +require 'time' +require 'line_client_liff' +# setup authorization +LINE::Client::Liff.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::Liff::LiffApi.new +add_liff_app_request = LINE::Client::Liff::AddLiffAppRequest.new({view: LINE::Client::Liff::LiffView.new({type: 'compact', url: 'url_example'})}) # AddLiffAppRequest | + +begin + + result = api_instance.add_liff_app(add_liff_app_request) + p result +rescue LINE::Client::Liff::ApiError => e + puts "Error when calling LiffApi->add_liff_app: #{e}" +end +``` + +#### Using the add_liff_app_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> add_liff_app_with_http_info(add_liff_app_request) + +```ruby +begin + + data, status_code, headers = api_instance.add_liff_app_with_http_info(add_liff_app_request) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::Liff::ApiError => e + puts "Error when calling LiffApi->add_liff_app_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **add_liff_app_request** | [**AddLiffAppRequest**](AddLiffAppRequest.md) | | | + +### Return type + +[**AddLiffAppResponse**](AddLiffAppResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## delete_liff_app + +> delete_liff_app(liff_id) + +Delete LIFF app from a channel + +Deletes a LIFF app from a channel. + +### Examples + +```ruby +require 'time' +require 'line_client_liff' +# setup authorization +LINE::Client::Liff.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::Liff::LiffApi.new +liff_id = 'liff_id_example' # String | ID of the LIFF app to be updated + +begin + # Delete LIFF app from a channel + api_instance.delete_liff_app(liff_id) +rescue LINE::Client::Liff::ApiError => e + puts "Error when calling LiffApi->delete_liff_app: #{e}" +end +``` + +#### Using the delete_liff_app_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> delete_liff_app_with_http_info(liff_id) + +```ruby +begin + # Delete LIFF app from a channel + data, status_code, headers = api_instance.delete_liff_app_with_http_info(liff_id) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::Liff::ApiError => e + puts "Error when calling LiffApi->delete_liff_app_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **liff_id** | **String** | ID of the LIFF app to be updated | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## get_all_liff_apps + +> get_all_liff_apps + +Get all LIFF apps + +Gets information on all the LIFF apps added to the channel. + +### Examples + +```ruby +require 'time' +require 'line_client_liff' +# setup authorization +LINE::Client::Liff.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::Liff::LiffApi.new + +begin + # Get all LIFF apps + result = api_instance.get_all_liff_apps + p result +rescue LINE::Client::Liff::ApiError => e + puts "Error when calling LiffApi->get_all_liff_apps: #{e}" +end +``` + +#### Using the get_all_liff_apps_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_all_liff_apps_with_http_info + +```ruby +begin + # Get all LIFF apps + data, status_code, headers = api_instance.get_all_liff_apps_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::Liff::ApiError => e + puts "Error when calling LiffApi->get_all_liff_apps_with_http_info: #{e}" +end +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**GetAllLiffAppsResponse**](GetAllLiffAppsResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## update_liff_app + +> update_liff_app(liff_id, update_liff_app_request) + + + +Update LIFF app settings + +### Examples + +```ruby +require 'time' +require 'line_client_liff' +# setup authorization +LINE::Client::Liff.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::Liff::LiffApi.new +liff_id = 'liff_id_example' # String | ID of the LIFF app to be updated +update_liff_app_request = LINE::Client::Liff::UpdateLiffAppRequest.new # UpdateLiffAppRequest | + +begin + + api_instance.update_liff_app(liff_id, update_liff_app_request) +rescue LINE::Client::Liff::ApiError => e + puts "Error when calling LiffApi->update_liff_app: #{e}" +end +``` + +#### Using the update_liff_app_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> update_liff_app_with_http_info(liff_id, update_liff_app_request) + +```ruby +begin + + data, status_code, headers = api_instance.update_liff_app_with_http_info(liff_id, update_liff_app_request) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::Liff::ApiError => e + puts "Error when calling LiffApi->update_liff_app_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **liff_id** | **String** | ID of the LIFF app to be updated | | +| **update_liff_app_request** | [**UpdateLiffAppRequest**](UpdateLiffAppRequest.md) | | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + diff --git a/lib/clients/liff/docs/LiffApp.md b/lib/clients/liff/docs/LiffApp.md new file mode 100644 index 00000000..989a1a0f --- /dev/null +++ b/lib/clients/liff/docs/LiffApp.md @@ -0,0 +1,30 @@ +# LINE::Client::Liff::LiffApp + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **liff_id** | **String** | LIFF app ID | [optional] | +| **view** | [**LiffView**](LiffView.md) | | [optional] | +| **description** | **String** | Name of the LIFF app | [optional] | +| **features** | [**LiffFeatures**](LiffFeatures.md) | | [optional] | +| **permanent_link_pattern** | **String** | How additional information in LIFF URLs is handled. concat is returned. | [optional] | +| **scope** | [**Array<LiffScope>**](LiffScope.md) | | [optional] | +| **bot_prompt** | [**LiffBotPrompt**](LiffBotPrompt.md) | | [optional] | + +## Example + +```ruby +require 'line_client_liff' + +instance = LINE::Client::Liff::LiffApp.new( + liff_id: null, + view: null, + description: null, + features: null, + permanent_link_pattern: null, + scope: null, + bot_prompt: null +) +``` + diff --git a/lib/clients/liff/docs/LiffBotPrompt.md b/lib/clients/liff/docs/LiffBotPrompt.md new file mode 100644 index 00000000..31bf03ba --- /dev/null +++ b/lib/clients/liff/docs/LiffBotPrompt.md @@ -0,0 +1,15 @@ +# LINE::Client::Liff::LiffBotPrompt + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_liff' + +instance = LINE::Client::Liff::LiffBotPrompt.new() +``` + diff --git a/lib/clients/liff/docs/LiffFeatures.md b/lib/clients/liff/docs/LiffFeatures.md new file mode 100644 index 00000000..23c7a0a6 --- /dev/null +++ b/lib/clients/liff/docs/LiffFeatures.md @@ -0,0 +1,20 @@ +# LINE::Client::Liff::LiffFeatures + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **ble** | **Boolean** | `true` if the LIFF app supports Bluetooth® Low Energy for LINE Things. `false` otherwise. | [optional] | +| **qr_code** | **Boolean** | `true` to use the 2D code reader in the LIFF app. false otherwise. The default value is `false`. | [optional][default to false] | + +## Example + +```ruby +require 'line_client_liff' + +instance = LINE::Client::Liff::LiffFeatures.new( + ble: null, + qr_code: null +) +``` + diff --git a/lib/clients/liff/docs/LiffScope.md b/lib/clients/liff/docs/LiffScope.md new file mode 100644 index 00000000..47494241 --- /dev/null +++ b/lib/clients/liff/docs/LiffScope.md @@ -0,0 +1,15 @@ +# LINE::Client::Liff::LiffScope + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_liff' + +instance = LINE::Client::Liff::LiffScope.new() +``` + diff --git a/lib/clients/liff/docs/LiffView.md b/lib/clients/liff/docs/LiffView.md new file mode 100644 index 00000000..36f74229 --- /dev/null +++ b/lib/clients/liff/docs/LiffView.md @@ -0,0 +1,22 @@ +# LINE::Client::Liff::LiffView + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | Size of the LIFF app view. Specify one of these values: - compact - tall - full | | +| **url** | **String** | Endpoint URL. This is the URL of the web app that implements the LIFF app (e.g. https://example.com). Used when the LIFF app is launched using the LIFF URL. The URL scheme must be https. URL fragments (#URL-fragment) can't be specified. | | +| **module_mode** | **Boolean** | `true` to use the LIFF app in modular mode. When in modular mode, the action button in the header is not displayed. | [optional] | + +## Example + +```ruby +require 'line_client_liff' + +instance = LINE::Client::Liff::LiffView.new( + type: null, + url: null, + module_mode: null +) +``` + diff --git a/lib/clients/liff/docs/UpdateLiffAppRequest.md b/lib/clients/liff/docs/UpdateLiffAppRequest.md new file mode 100644 index 00000000..a1c77c2b --- /dev/null +++ b/lib/clients/liff/docs/UpdateLiffAppRequest.md @@ -0,0 +1,28 @@ +# LINE::Client::Liff::UpdateLiffAppRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **view** | [**LiffView**](LiffView.md) | | [optional] | +| **description** | **String** | Name of the LIFF app. The LIFF app name can't include \"LINE\" or similar strings, or inappropriate strings. | [optional] | +| **features** | [**LiffFeatures**](LiffFeatures.md) | | [optional] | +| **permanent_link_pattern** | **String** | How additional information in LIFF URLs is handled. Specify `concat`. | [optional] | +| **scope** | [**Array<LiffScope>**](LiffScope.md) | | [optional] | +| **bot_prompt** | [**LiffBotPrompt**](LiffBotPrompt.md) | | [optional] | + +## Example + +```ruby +require 'line_client_liff' + +instance = LINE::Client::Liff::UpdateLiffAppRequest.new( + view: null, + description: null, + features: null, + permanent_link_pattern: null, + scope: null, + bot_prompt: null +) +``` + diff --git a/lib/clients/liff/lib/line_client_liff.rb b/lib/clients/liff/lib/line_client_liff.rb new file mode 100644 index 00000000..f4b4bd65 --- /dev/null +++ b/lib/clients/liff/lib/line_client_liff.rb @@ -0,0 +1,49 @@ +=begin +#LIFF server API + +#LIFF Server API. + +The version of the OpenAPI document: 1.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +# Common files +require 'line_client_liff/api_client' +require 'line_client_liff/api_error' +require 'line_client_liff/version' +require 'line_client_liff/configuration' + +# Models +require 'line_client_liff/models/add_liff_app_request' +require 'line_client_liff/models/add_liff_app_response' +require 'line_client_liff/models/get_all_liff_apps_response' +require 'line_client_liff/models/liff_app' +require 'line_client_liff/models/liff_bot_prompt' +require 'line_client_liff/models/liff_features' +require 'line_client_liff/models/liff_scope' +require 'line_client_liff/models/liff_view' +require 'line_client_liff/models/update_liff_app_request' + +# APIs +require 'line_client_liff/api/liff_api' + +module LINE::Client::Liff + class << self + # Customize default settings for the SDK using block. + # LINE::Client::Liff.configure do |config| + # config.username = "xxx" + # config.password = "xxx" + # end + # If no block given, return the default Configuration object. + def configure + if block_given? + yield(Configuration.default) + else + Configuration.default + end + end + end +end diff --git a/lib/clients/liff/lib/line_client_liff/api/liff_api.rb b/lib/clients/liff/lib/line_client_liff/api/liff_api.rb new file mode 100644 index 00000000..8d0a17c9 --- /dev/null +++ b/lib/clients/liff/lib/line_client_liff/api/liff_api.rb @@ -0,0 +1,276 @@ +=begin +#LIFF server API + +#LIFF Server API. + +The version of the OpenAPI document: 1.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'cgi' + +module LINE::Client::Liff + class LiffApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Adding the LIFF app to a channel + # @param add_liff_app_request [AddLiffAppRequest] + # @param [Hash] opts the optional parameters + # @return [AddLiffAppResponse] + def add_liff_app(add_liff_app_request, opts = {}) + data, _status_code, _headers = add_liff_app_with_http_info(add_liff_app_request, opts) + data + end + + # Adding the LIFF app to a channel + # @param add_liff_app_request [AddLiffAppRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(AddLiffAppResponse, Integer, Hash)>] AddLiffAppResponse data, response status code and response headers + def add_liff_app_with_http_info(add_liff_app_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LiffApi.add_liff_app ...' + end + # verify the required parameter 'add_liff_app_request' is set + if @api_client.config.client_side_validation && add_liff_app_request.nil? + fail ArgumentError, "Missing the required parameter 'add_liff_app_request' when calling LiffApi.add_liff_app" + end + # resource path + local_var_path = '/liff/v1/apps' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(add_liff_app_request) + + # return_type + return_type = opts[:debug_return_type] || 'AddLiffAppResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"LiffApi.add_liff_app", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LiffApi#add_liff_app\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete LIFF app from a channel + # Deletes a LIFF app from a channel. + # @param liff_id [String] ID of the LIFF app to be updated + # @param [Hash] opts the optional parameters + # @return [nil] + def delete_liff_app(liff_id, opts = {}) + delete_liff_app_with_http_info(liff_id, opts) + nil + end + + # Delete LIFF app from a channel + # Deletes a LIFF app from a channel. + # @param liff_id [String] ID of the LIFF app to be updated + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_liff_app_with_http_info(liff_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LiffApi.delete_liff_app ...' + end + # verify the required parameter 'liff_id' is set + if @api_client.config.client_side_validation && liff_id.nil? + fail ArgumentError, "Missing the required parameter 'liff_id' when calling LiffApi.delete_liff_app" + end + # resource path + local_var_path = '/liff/v1/apps/{liffId}'.sub('{' + 'liffId' + '}', CGI.escape(liff_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"LiffApi.delete_liff_app", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LiffApi#delete_liff_app\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get all LIFF apps + # Gets information on all the LIFF apps added to the channel. + # @param [Hash] opts the optional parameters + # @return [GetAllLiffAppsResponse] + def get_all_liff_apps(opts = {}) + data, _status_code, _headers = get_all_liff_apps_with_http_info(opts) + data + end + + # Get all LIFF apps + # Gets information on all the LIFF apps added to the channel. + # @param [Hash] opts the optional parameters + # @return [Array<(GetAllLiffAppsResponse, Integer, Hash)>] GetAllLiffAppsResponse data, response status code and response headers + def get_all_liff_apps_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LiffApi.get_all_liff_apps ...' + end + # resource path + local_var_path = '/liff/v1/apps' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetAllLiffAppsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"LiffApi.get_all_liff_apps", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LiffApi#get_all_liff_apps\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update LIFF app settings + # @param liff_id [String] ID of the LIFF app to be updated + # @param update_liff_app_request [UpdateLiffAppRequest] + # @param [Hash] opts the optional parameters + # @return [nil] + def update_liff_app(liff_id, update_liff_app_request, opts = {}) + update_liff_app_with_http_info(liff_id, update_liff_app_request, opts) + nil + end + + # Update LIFF app settings + # @param liff_id [String] ID of the LIFF app to be updated + # @param update_liff_app_request [UpdateLiffAppRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def update_liff_app_with_http_info(liff_id, update_liff_app_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LiffApi.update_liff_app ...' + end + # verify the required parameter 'liff_id' is set + if @api_client.config.client_side_validation && liff_id.nil? + fail ArgumentError, "Missing the required parameter 'liff_id' when calling LiffApi.update_liff_app" + end + # verify the required parameter 'update_liff_app_request' is set + if @api_client.config.client_side_validation && update_liff_app_request.nil? + fail ArgumentError, "Missing the required parameter 'update_liff_app_request' when calling LiffApi.update_liff_app" + end + # resource path + local_var_path = '/liff/v1/apps/{liffId}'.sub('{' + 'liffId' + '}', CGI.escape(liff_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(update_liff_app_request) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"LiffApi.update_liff_app", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LiffApi#update_liff_app\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/clients/liff/lib/line_client_liff/api_client.rb b/lib/clients/liff/lib/line_client_liff/api_client.rb new file mode 100644 index 00000000..7d927558 --- /dev/null +++ b/lib/clients/liff/lib/line_client_liff/api_client.rb @@ -0,0 +1,392 @@ +=begin +#LIFF server API + +#LIFF Server API. + +The version of the OpenAPI document: 1.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'json' +require 'logger' +require 'tempfile' +require 'time' +require 'typhoeus' + +module LINE::Client::Liff + class ApiClient + # The Configuration object holding settings to be used in the API client. + attr_accessor :config + + # Defines the headers to be used in HTTP requests of all API calls by default. + # + # @return [Hash] + attr_accessor :default_headers + + # Initializes the ApiClient + # @option config [Configuration] Configuration for initializing the object, default to Configuration.default + def initialize(config = Configuration.default) + @config = config + @user_agent = "LINE-BotSDK-Ruby/2.0.0" + @default_headers = { + 'Content-Type' => 'application/json', + 'User-Agent' => @user_agent + } + end + + def self.default + @@default ||= ApiClient.new + end + + # Call an API with given options. + # + # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: + # the data deserialized from response body (could be nil), response status code and response headers. + def call_api(http_method, path, opts = {}) + request = build_request(http_method, path, opts) + response = request.run + + if @config.debugging + @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" + end + + unless response.success? + if response.timed_out? + fail ApiError.new('Connection timed out') + elsif response.code == 0 + # Errors from libcurl will be made visible here + fail ApiError.new(:code => 0, + :message => response.return_message) + else + fail ApiError.new(:code => response.code, + :response_headers => response.headers, + :response_body => response.body), + response.status_message + end + end + + if opts[:return_type] + data = deserialize(response, opts[:return_type]) + else + data = nil + end + return data, response.code, response.headers + end + + # Builds the HTTP request + # + # @param [String] http_method HTTP method/verb (e.g. POST) + # @param [String] path URL path (e.g. /account/new) + # @option opts [Hash] :header_params Header parameters + # @option opts [Hash] :query_params Query parameters + # @option opts [Hash] :form_params Query parameters + # @option opts [Object] :body HTTP body (JSON/XML) + # @return [Typhoeus::Request] A Typhoeus Request + def build_request(http_method, path, opts = {}) + url = build_request_url(path, opts) + http_method = http_method.to_sym.downcase + + header_params = @default_headers.merge(opts[:header_params] || {}) + query_params = opts[:query_params] || {} + form_params = opts[:form_params] || {} + follow_location = opts[:follow_location] || true + + update_params_for_auth! header_params, query_params, opts[:auth_names] + + # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false) + _verify_ssl_host = @config.verify_ssl_host ? 2 : 0 + + req_opts = { + :method => http_method, + :headers => header_params, + :params => query_params, + :params_encoding => @config.params_encoding, + :timeout => @config.timeout, + :ssl_verifypeer => @config.verify_ssl, + :ssl_verifyhost => _verify_ssl_host, + :sslcert => @config.cert_file, + :sslkey => @config.key_file, + :verbose => @config.debugging, + :followlocation => follow_location + } + + # set custom cert, if provided + req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert + + if [:post, :patch, :put, :delete].include?(http_method) + req_body = build_request_body(header_params, form_params, opts[:body]) + req_opts.update :body => req_body + if @config.debugging + @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n" + end + end + + request = Typhoeus::Request.new(url, req_opts) + download_file(request) if opts[:return_type] == 'File' + request + end + + # Builds the HTTP request body + # + # @param [Hash] header_params Header parameters + # @param [Hash] form_params Query parameters + # @param [Object] body HTTP body (JSON/XML) + # @return [String] HTTP body data in the form of string + def build_request_body(header_params, form_params, body) + # http form + if header_params['Content-Type'] == 'application/x-www-form-urlencoded' || + header_params['Content-Type'] == 'multipart/form-data' + data = {} + form_params.each do |key, value| + case value + when ::File, ::Array, nil + # let typhoeus handle File, Array and nil parameters + data[key] = value + else + data[key] = value.to_s + end + end + elsif body + data = body.is_a?(String) ? body : body.to_json + else + data = nil + end + data + end + + # Save response body into a file in (the defined) temporary folder, using the filename + # from the "Content-Disposition" header if provided, otherwise a random filename. + # The response body is written to the file in chunks in order to handle files which + # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby + # process can use. + # + # @see Configuration#temp_folder_path + def download_file(request) + tempfile = nil + encoding = nil + request.on_headers do |response| + content_disposition = response.headers['Content-Disposition'] + if content_disposition && content_disposition =~ /filename=/i + filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1] + prefix = sanitize_filename(filename) + else + prefix = 'download-' + end + prefix = prefix + '-' unless prefix.end_with?('-') + encoding = response.body.encoding + tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) + @tempfile = tempfile + end + request.on_body do |chunk| + chunk.force_encoding(encoding) + tempfile.write(chunk) + end + request.on_complete do |response| + if tempfile + tempfile.close + @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ + "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ + "will be deleted automatically with GC. It's also recommended to delete the temp file "\ + "explicitly with `tempfile.delete`" + end + end + end + + # Check if the given MIME is a JSON MIME. + # JSON MIME examples: + # application/json + # application/json; charset=UTF8 + # APPLICATION/JSON + # */* + # @param [String] mime MIME + # @return [Boolean] True if the MIME is application/json + def json_mime?(mime) + (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + end + + # Deserialize the response to the given return type. + # + # @param [Response] response HTTP response + # @param [String] return_type some examples: "User", "Array", "Hash" + def deserialize(response, return_type) + body = response.body + + # handle file downloading - return the File instance processed in request callbacks + # note that response body is empty when the file is written in chunks in request on_body callback + return @tempfile if return_type == 'File' + + return nil if body.nil? || body.empty? + + # return response body directly for String return type + return body if return_type == 'String' + + # ensuring a default content type + content_type = response.headers['Content-Type'] || 'application/json' + + fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type) + + begin + data = JSON.parse("[#{body}]", :symbolize_names => true)[0] + rescue JSON::ParserError => e + if %w(String Date Time).include?(return_type) + data = body + else + raise e + end + end + + convert_to_type data, return_type + end + + # Convert data to the given return type. + # @param [Object] data Data to be converted + # @param [String] return_type Return type + # @return [Mixed] Data in a particular type + def convert_to_type(data, return_type) + return nil if data.nil? + case return_type + when 'String' + data.to_s + when 'Integer' + data.to_i + when 'Float' + data.to_f + when 'Boolean' + data == true + when 'Time' + # parse date time (expecting ISO 8601 format) + Time.parse data + when 'Date' + # parse date time (expecting ISO 8601 format) + Date.parse data + when 'Object' + # generic object (usually a Hash), return directly + data + when /\AArray<(.+)>\z/ + # e.g. Array + sub_type = $1 + data.map { |item| convert_to_type(item, sub_type) } + when /\AHash\\z/ + # e.g. Hash + sub_type = $1 + {}.tap do |hash| + data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } + end + else + # models (e.g. Pet) or oneOf + klass = LINE::Client::Liff.const_get(return_type) + klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + end + end + + # Sanitize filename by removing path. + # e.g. ../../sun.gif becomes sun.gif + # + # @param [String] filename the filename to be sanitized + # @return [String] the sanitized filename + def sanitize_filename(filename) + filename.gsub(/.*[\/\\]/, '') + end + + def build_request_url(path, opts = {}) + # Add leading and trailing slashes to path + path = "/#{path}".gsub(/\/+/, '/') + @config.base_url(opts[:operation]) + path + end + + # Update header and query params based on authentication settings. + # + # @param [Hash] header_params Header parameters + # @param [Hash] query_params Query parameters + # @param [String] auth_names Authentication scheme name + def update_params_for_auth!(header_params, query_params, auth_names) + Array(auth_names).each do |auth_name| + auth_setting = @config.auth_settings[auth_name] + next unless auth_setting + case auth_setting[:in] + when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] + when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] + else fail ArgumentError, 'Authentication token must be in `query` or `header`' + end + end + end + + # Sets user agent in HTTP header + # + # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0) + def user_agent=(user_agent) + @user_agent = user_agent + @default_headers['User-Agent'] = @user_agent + end + + # Return Accept header based on an array of accepts provided. + # @param [Array] accepts array for Accept + # @return [String] the Accept header (e.g. application/json) + def select_header_accept(accepts) + return nil if accepts.nil? || accepts.empty? + # use JSON when present, otherwise use all of the provided + json_accept = accepts.find { |s| json_mime?(s) } + json_accept || accepts.join(',') + end + + # Return Content-Type header based on an array of content types provided. + # @param [Array] content_types array for Content-Type + # @return [String] the Content-Type header (e.g. application/json) + def select_header_content_type(content_types) + # return nil by default + return if content_types.nil? || content_types.empty? + # use JSON when present, otherwise use the first one + json_content_type = content_types.find { |s| json_mime?(s) } + json_content_type || content_types.first + end + + # Convert object (array, hash, object, etc) to JSON string. + # @param [Object] model object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_http_body(model) + return model if model.nil? || model.is_a?(String) + local_body = nil + if model.is_a?(Array) + local_body = model.map { |m| object_to_hash(m) } + else + local_body = object_to_hash(model) + end + local_body.to_json + end + + # Convert object(non-array) to hash. + # @param [Object] obj object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_hash(obj) + if obj.respond_to?(:to_hash) + obj.to_hash + else + obj + end + end + + # Build parameter value according to the given collection format. + # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi + def build_collection_param(param, collection_format) + case collection_format + when :csv + param.join(',') + when :ssv + param.join(' ') + when :tsv + param.join("\t") + when :pipes + param.join('|') + when :multi + # return the array directly as typhoeus will handle it as expected + param + else + fail "unknown collection format: #{collection_format.inspect}" + end + end + end +end diff --git a/lib/clients/liff/lib/line_client_liff/api_error.rb b/lib/clients/liff/lib/line_client_liff/api_error.rb new file mode 100644 index 00000000..2da78519 --- /dev/null +++ b/lib/clients/liff/lib/line_client_liff/api_error.rb @@ -0,0 +1,58 @@ +=begin +#LIFF server API + +#LIFF Server API. + +The version of the OpenAPI document: 1.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::Liff + class ApiError < StandardError + attr_reader :code, :response_headers, :response_body + + # Usage examples: + # ApiError.new + # ApiError.new("message") + # ApiError.new(:code => 500, :response_headers => {}, :response_body => "") + # ApiError.new(:code => 404, :message => "Not Found") + def initialize(arg = nil) + if arg.is_a? Hash + if arg.key?(:message) || arg.key?('message') + super(arg[:message] || arg['message']) + else + super arg + end + + arg.each do |k, v| + instance_variable_set "@#{k}", v + end + else + super arg + @message = arg + end + end + + # Override to_s to display a friendly error message + def to_s + message + end + + def message + if @message.nil? + msg = "Error message: the server returns an error" + else + msg = @message + end + + msg += "\nHTTP status code: #{code}" if code + msg += "\nResponse headers: #{response_headers}" if response_headers + msg += "\nResponse body: #{response_body}" if response_body + + msg + end + end +end diff --git a/lib/clients/liff/lib/line_client_liff/configuration.rb b/lib/clients/liff/lib/line_client_liff/configuration.rb new file mode 100644 index 00000000..fb93acd4 --- /dev/null +++ b/lib/clients/liff/lib/line_client_liff/configuration.rb @@ -0,0 +1,297 @@ +=begin +#LIFF server API + +#LIFF Server API. + +The version of the OpenAPI document: 1.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::Liff + class Configuration + # Defines url scheme + attr_accessor :scheme + + # Defines url host + attr_accessor :host + + # Defines url base path + attr_accessor :base_path + + # Define server configuration index + attr_accessor :server_index + + # Define server operation configuration index + attr_accessor :server_operation_index + + # Default server variables + attr_accessor :server_variables + + # Default server operation variables + attr_accessor :server_operation_variables + + # Defines API keys used with API Key authentications. + # + # @return [Hash] key: parameter name, value: parameter value (API key) + # + # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string) + # config.api_key['api_key'] = 'xxx' + attr_accessor :api_key + + # Defines API key prefixes used with API Key authentications. + # + # @return [Hash] key: parameter name, value: API key prefix + # + # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers) + # config.api_key_prefix['api_key'] = 'Token' + attr_accessor :api_key_prefix + + # Defines the username used with HTTP basic authentication. + # + # @return [String] + attr_accessor :username + + # Defines the password used with HTTP basic authentication. + # + # @return [String] + attr_accessor :password + + # Defines the access token (Bearer) used with OAuth2. + attr_accessor :access_token + + # Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2. + # Overrides the access_token if set + # @return [Proc] + attr_accessor :access_token_getter + + # Set this to return data as binary instead of downloading a temp file. When enabled (set to true) + # HTTP responses with return type `File` will be returned as a stream of binary data. + # Default to false. + attr_accessor :return_binary_data + + # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response + # details will be logged with `logger.debug` (see the `logger` attribute). + # Default to false. + # + # @return [true, false] + attr_accessor :debugging + + # Defines the logger used for debugging. + # Default to `Rails.logger` (when in Rails) or logging to STDOUT. + # + # @return [#debug] + attr_accessor :logger + + # Defines the temporary folder to store downloaded files + # (for API endpoints that have file response). + # Default to use `Tempfile`. + # + # @return [String] + attr_accessor :temp_folder_path + + # The time limit for HTTP request in seconds. + # Default to 0 (never times out). + attr_accessor :timeout + + # Set this to false to skip client side validation in the operation. + # Default to true. + # @return [true, false] + attr_accessor :client_side_validation + + ### TLS/SSL setting + # Set this to false to skip verifying SSL certificate when calling API from https server. + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl + + ### TLS/SSL setting + # Set this to false to skip verifying SSL host name + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl_host + + ### TLS/SSL setting + # Set this to customize the certificate file to verify the peer. + # + # @return [String] the path to the certificate file + # + # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code: + # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145 + attr_accessor :ssl_ca_cert + + ### TLS/SSL setting + # Client certificate file (for client certificate) + attr_accessor :cert_file + + ### TLS/SSL setting + # Client private key file (for client certificate) + attr_accessor :key_file + + # Set this to customize parameters encoding of array parameter with multi collectionFormat. + # Default to nil. + # + # @see The params_encoding option of Ethon. Related source code: + # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 + attr_accessor :params_encoding + + + attr_accessor :inject_format + + attr_accessor :force_ending_format + + def initialize + @scheme = 'https' + @host = 'api.line.me' + @base_path = '' + @server_index = nil + @server_operation_index = {} + @server_variables = {} + @server_operation_variables = {} + @api_key = {} + @api_key_prefix = {} + @client_side_validation = true + @verify_ssl = true + @verify_ssl_host = true + @cert_file = nil + @key_file = nil + @timeout = 0 + @params_encoding = nil + @debugging = false + @inject_format = false + @force_ending_format = false + @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) + + yield(self) if block_given? + end + + # The default Configuration object. + def self.default + @@default ||= Configuration.new + end + + def configure + yield(self) if block_given? + end + + def scheme=(scheme) + # remove :// from scheme + @scheme = scheme.sub(/:\/\//, '') + end + + def host=(host) + # remove http(s):// and anything after a slash + @host = host.sub(/https?:\/\//, '').split('/').first + end + + def base_path=(base_path) + # Add leading and trailing slashes to base_path + @base_path = "/#{base_path}".gsub(/\/+/, '/') + @base_path = '' if @base_path == '/' + end + + # Returns base URL for specified operation based on server settings + def base_url(operation = nil) + if operation_server_settings.key?(operation) then + index = server_operation_index.fetch(operation, server_index) + server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) + else + server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil) + end + end + + # Gets API key (with prefix if set). + # @param [String] param_name the parameter name of API key auth + def api_key_with_prefix(param_name, param_alias = nil) + key = @api_key[param_name] + key = @api_key.fetch(param_alias, key) unless param_alias.nil? + if @api_key_prefix[param_name] + "#{@api_key_prefix[param_name]} #{key}" + else + key + end + end + + # Gets access_token using access_token_getter or uses the static access_token + def access_token_with_refresh + return access_token if access_token_getter.nil? + access_token_getter.call + end + + # Gets Basic Auth token string + def basic_auth_token + 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") + end + + # Returns Auth Settings hash for api client. + def auth_settings + { + 'Bearer' => + { + type: 'bearer', + in: 'header', + key: 'Authorization', + value: "Bearer #{access_token_with_refresh}" + }, + } + end + + # Returns an array of Server setting + def server_settings + [ + { + url: "https://api.line.me", + description: "No description provided", + } + ] + end + + def operation_server_settings + { + } + end + + # Returns URL based on server settings + # + # @param index array index of the server settings + # @param variables hash of variable and the corresponding value + def server_url(index, variables = {}, servers = nil) + servers = server_settings if servers == nil + + # check array index out of bound + if (index.nil? || index < 0 || index >= servers.size) + fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}" + end + + server = servers[index] + url = server[:url] + + return url unless server.key? :variables + + # go through variable and assign a value + server[:variables].each do |name, variable| + if variables.key?(name) + if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name])) + url.gsub! "{" + name.to_s + "}", variables[name] + else + fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}." + end + else + # use default value + url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] + end + end + + url + end + + end +end diff --git a/lib/clients/liff/lib/line_client_liff/models/add_liff_app_request.rb b/lib/clients/liff/lib/line_client_liff/models/add_liff_app_request.rb new file mode 100644 index 00000000..0c76bd85 --- /dev/null +++ b/lib/clients/liff/lib/line_client_liff/models/add_liff_app_request.rb @@ -0,0 +1,297 @@ +=begin +#LIFF server API + +#LIFF Server API. + +The version of the OpenAPI document: 1.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Liff + class AddLiffAppRequest + attr_accessor :view + + # Name of the LIFF app. The LIFF app name can't include \"LINE\" or similar strings, or inappropriate strings. + attr_accessor :description + + attr_accessor :features + + # How additional information in LIFF URLs is handled. Specify `concat`. + attr_accessor :permanent_link_pattern + + attr_accessor :scope + + attr_accessor :bot_prompt + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'view' => :'view', + :'description' => :'description', + :'features' => :'features', + :'permanent_link_pattern' => :'permanentLinkPattern', + :'scope' => :'scope', + :'bot_prompt' => :'botPrompt' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'view' => :'LiffView', + :'description' => :'String', + :'features' => :'LiffFeatures', + :'permanent_link_pattern' => :'String', + :'scope' => :'Array', + :'bot_prompt' => :'LiffBotPrompt' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Liff::AddLiffAppRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Liff::AddLiffAppRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'view') + self.view = attributes[:'view'] + else + self.view = nil + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'features') + self.features = attributes[:'features'] + end + + if attributes.key?(:'permanent_link_pattern') + self.permanent_link_pattern = attributes[:'permanent_link_pattern'] + end + + if attributes.key?(:'scope') + if (value = attributes[:'scope']).is_a?(Array) + self.scope = value + end + end + + if attributes.key?(:'bot_prompt') + self.bot_prompt = attributes[:'bot_prompt'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @view.nil? + invalid_properties.push('invalid value for "view", view cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @view.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + view == o.view && + description == o.description && + features == o.features && + permanent_link_pattern == o.permanent_link_pattern && + scope == o.scope && + bot_prompt == o.bot_prompt + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [view, description, features, permanent_link_pattern, scope, bot_prompt].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Liff.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/liff/lib/line_client_liff/models/add_liff_app_response.rb b/lib/clients/liff/lib/line_client_liff/models/add_liff_app_response.rb new file mode 100644 index 00000000..8f60e8c7 --- /dev/null +++ b/lib/clients/liff/lib/line_client_liff/models/add_liff_app_response.rb @@ -0,0 +1,226 @@ +=begin +#LIFF server API + +#LIFF Server API. + +The version of the OpenAPI document: 1.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Liff + class AddLiffAppResponse + attr_accessor :liff_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'liff_id' => :'liffId' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'liff_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Liff::AddLiffAppResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Liff::AddLiffAppResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'liff_id') + self.liff_id = attributes[:'liff_id'] + else + self.liff_id = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @liff_id.nil? + invalid_properties.push('invalid value for "liff_id", liff_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @liff_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + liff_id == o.liff_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [liff_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Liff.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/liff/lib/line_client_liff/models/get_all_liff_apps_response.rb b/lib/clients/liff/lib/line_client_liff/models/get_all_liff_apps_response.rb new file mode 100644 index 00000000..47802d70 --- /dev/null +++ b/lib/clients/liff/lib/line_client_liff/models/get_all_liff_apps_response.rb @@ -0,0 +1,221 @@ +=begin +#LIFF server API + +#LIFF Server API. + +The version of the OpenAPI document: 1.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Liff + class GetAllLiffAppsResponse + attr_accessor :apps + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'apps' => :'apps' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'apps' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Liff::GetAllLiffAppsResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Liff::GetAllLiffAppsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'apps') + if (value = attributes[:'apps']).is_a?(Array) + self.apps = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + apps == o.apps + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [apps].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Liff.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/liff/lib/line_client_liff/models/liff_app.rb b/lib/clients/liff/lib/line_client_liff/models/liff_app.rb new file mode 100644 index 00000000..7be1fb69 --- /dev/null +++ b/lib/clients/liff/lib/line_client_liff/models/liff_app.rb @@ -0,0 +1,300 @@ +=begin +#LIFF server API + +#LIFF Server API. + +The version of the OpenAPI document: 1.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Liff + class LiffApp + # LIFF app ID + attr_accessor :liff_id + + attr_accessor :view + + # Name of the LIFF app + attr_accessor :description + + attr_accessor :features + + # How additional information in LIFF URLs is handled. concat is returned. + attr_accessor :permanent_link_pattern + + attr_accessor :scope + + attr_accessor :bot_prompt + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'liff_id' => :'liffId', + :'view' => :'view', + :'description' => :'description', + :'features' => :'features', + :'permanent_link_pattern' => :'permanentLinkPattern', + :'scope' => :'scope', + :'bot_prompt' => :'botPrompt' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'liff_id' => :'String', + :'view' => :'LiffView', + :'description' => :'String', + :'features' => :'LiffFeatures', + :'permanent_link_pattern' => :'String', + :'scope' => :'Array', + :'bot_prompt' => :'LiffBotPrompt' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Liff::LiffApp` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Liff::LiffApp`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'liff_id') + self.liff_id = attributes[:'liff_id'] + end + + if attributes.key?(:'view') + self.view = attributes[:'view'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'features') + self.features = attributes[:'features'] + end + + if attributes.key?(:'permanent_link_pattern') + self.permanent_link_pattern = attributes[:'permanent_link_pattern'] + end + + if attributes.key?(:'scope') + if (value = attributes[:'scope']).is_a?(Array) + self.scope = value + end + end + + if attributes.key?(:'bot_prompt') + self.bot_prompt = attributes[:'bot_prompt'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + liff_id == o.liff_id && + view == o.view && + description == o.description && + features == o.features && + permanent_link_pattern == o.permanent_link_pattern && + scope == o.scope && + bot_prompt == o.bot_prompt + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [liff_id, view, description, features, permanent_link_pattern, scope, bot_prompt].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Liff.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/liff/lib/line_client_liff/models/liff_bot_prompt.rb b/lib/clients/liff/lib/line_client_liff/models/liff_bot_prompt.rb new file mode 100644 index 00000000..c63ba079 --- /dev/null +++ b/lib/clients/liff/lib/line_client_liff/models/liff_bot_prompt.rb @@ -0,0 +1,41 @@ +=begin +#LIFF server API + +#LIFF Server API. + +The version of the OpenAPI document: 1.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Liff + class LiffBotPrompt + NORMAL = "normal".freeze + AGGRESSIVE = "aggressive".freeze + NONE = "none".freeze + + def self.all_vars + @all_vars ||= [NORMAL, AGGRESSIVE, NONE].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if LiffBotPrompt.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #LiffBotPrompt" + end + end +end diff --git a/lib/clients/liff/lib/line_client_liff/models/liff_features.rb b/lib/clients/liff/lib/line_client_liff/models/liff_features.rb new file mode 100644 index 00000000..b7e3a481 --- /dev/null +++ b/lib/clients/liff/lib/line_client_liff/models/liff_features.rb @@ -0,0 +1,232 @@ +=begin +#LIFF server API + +#LIFF Server API. + +The version of the OpenAPI document: 1.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Liff + class LiffFeatures + # `true` if the LIFF app supports Bluetooth® Low Energy for LINE Things. `false` otherwise. + attr_accessor :ble + + # `true` to use the 2D code reader in the LIFF app. false otherwise. The default value is `false`. + attr_accessor :qr_code + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'ble' => :'ble', + :'qr_code' => :'qrCode' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'ble' => :'Boolean', + :'qr_code' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Liff::LiffFeatures` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Liff::LiffFeatures`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'ble') + self.ble = attributes[:'ble'] + end + + if attributes.key?(:'qr_code') + self.qr_code = attributes[:'qr_code'] + else + self.qr_code = false + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + ble == o.ble && + qr_code == o.qr_code + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [ble, qr_code].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Liff.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/liff/lib/line_client_liff/models/liff_scope.rb b/lib/clients/liff/lib/line_client_liff/models/liff_scope.rb new file mode 100644 index 00000000..be7643be --- /dev/null +++ b/lib/clients/liff/lib/line_client_liff/models/liff_scope.rb @@ -0,0 +1,42 @@ +=begin +#LIFF server API + +#LIFF Server API. + +The version of the OpenAPI document: 1.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Liff + class LiffScope + OPENID = "openid".freeze + EMAIL = "email".freeze + PROFILE = "profile".freeze + CHAT_MESSAGE_WRITE = "chat_message.write".freeze + + def self.all_vars + @all_vars ||= [OPENID, EMAIL, PROFILE, CHAT_MESSAGE_WRITE].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if LiffScope.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #LiffScope" + end + end +end diff --git a/lib/clients/liff/lib/line_client_liff/models/liff_view.rb b/lib/clients/liff/lib/line_client_liff/models/liff_view.rb new file mode 100644 index 00000000..1ac646a7 --- /dev/null +++ b/lib/clients/liff/lib/line_client_liff/models/liff_view.rb @@ -0,0 +1,288 @@ +=begin +#LIFF server API + +#LIFF Server API. + +The version of the OpenAPI document: 1.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Liff + class LiffView + # Size of the LIFF app view. Specify one of these values: - compact - tall - full + attr_accessor :type + + # Endpoint URL. This is the URL of the web app that implements the LIFF app (e.g. https://example.com). Used when the LIFF app is launched using the LIFF URL. The URL scheme must be https. URL fragments (#URL-fragment) can't be specified. + attr_accessor :url + + # `true` to use the LIFF app in modular mode. When in modular mode, the action button in the header is not displayed. + attr_accessor :module_mode + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'url' => :'url', + :'module_mode' => :'moduleMode' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'url' => :'String', + :'module_mode' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Liff::LiffView` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Liff::LiffView`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = nil + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + else + self.url = nil + end + + if attributes.key?(:'module_mode') + self.module_mode = attributes[:'module_mode'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + if @url.nil? + invalid_properties.push('invalid value for "url", url cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @type.nil? + type_validator = EnumAttributeValidator.new('String', ["compact", "tall", "full"]) + return false unless type_validator.valid?(@type) + return false if @url.nil? + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] type Object to be assigned + def type=(type) + validator = EnumAttributeValidator.new('String', ["compact", "tall", "full"]) + unless validator.valid?(type) + fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + url == o.url && + module_mode == o.module_mode + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, url, module_mode].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Liff.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/liff/lib/line_client_liff/models/update_liff_app_request.rb b/lib/clients/liff/lib/line_client_liff/models/update_liff_app_request.rb new file mode 100644 index 00000000..5f894d8f --- /dev/null +++ b/lib/clients/liff/lib/line_client_liff/models/update_liff_app_request.rb @@ -0,0 +1,290 @@ +=begin +#LIFF server API + +#LIFF Server API. + +The version of the OpenAPI document: 1.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Liff + class UpdateLiffAppRequest + attr_accessor :view + + # Name of the LIFF app. The LIFF app name can't include \"LINE\" or similar strings, or inappropriate strings. + attr_accessor :description + + attr_accessor :features + + # How additional information in LIFF URLs is handled. Specify `concat`. + attr_accessor :permanent_link_pattern + + attr_accessor :scope + + attr_accessor :bot_prompt + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'view' => :'view', + :'description' => :'description', + :'features' => :'features', + :'permanent_link_pattern' => :'permanentLinkPattern', + :'scope' => :'scope', + :'bot_prompt' => :'botPrompt' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'view' => :'LiffView', + :'description' => :'String', + :'features' => :'LiffFeatures', + :'permanent_link_pattern' => :'String', + :'scope' => :'Array', + :'bot_prompt' => :'LiffBotPrompt' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Liff::UpdateLiffAppRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Liff::UpdateLiffAppRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'view') + self.view = attributes[:'view'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'features') + self.features = attributes[:'features'] + end + + if attributes.key?(:'permanent_link_pattern') + self.permanent_link_pattern = attributes[:'permanent_link_pattern'] + end + + if attributes.key?(:'scope') + if (value = attributes[:'scope']).is_a?(Array) + self.scope = value + end + end + + if attributes.key?(:'bot_prompt') + self.bot_prompt = attributes[:'bot_prompt'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + view == o.view && + description == o.description && + features == o.features && + permanent_link_pattern == o.permanent_link_pattern && + scope == o.scope && + bot_prompt == o.bot_prompt + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [view, description, features, permanent_link_pattern, scope, bot_prompt].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Liff.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/liff/lib/line_client_liff/version.rb b/lib/clients/liff/lib/line_client_liff/version.rb new file mode 100644 index 00000000..960b37f6 --- /dev/null +++ b/lib/clients/liff/lib/line_client_liff/version.rb @@ -0,0 +1,15 @@ +=begin +#LIFF server API + +#LIFF Server API. + +The version of the OpenAPI document: 1.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::Liff + VERSION = '2.0.0' +end diff --git a/lib/clients/manage-audience/.gitignore b/lib/clients/manage-audience/.gitignore new file mode 100644 index 00000000..05a17cb8 --- /dev/null +++ b/lib/clients/manage-audience/.gitignore @@ -0,0 +1,39 @@ +# Generated by: https://openapi-generator.tech +# + +*.gem +*.rbc +/.config +/coverage/ +/InstalledFiles +/pkg/ +/spec/reports/ +/spec/examples.txt +/test/tmp/ +/test/version_tmp/ +/tmp/ + +## Specific to RubyMotion: +.dat* +.repl_history +build/ + +## Documentation cache and generated files: +/.yardoc/ +/_yardoc/ +/doc/ +/rdoc/ + +## Environment normalization: +/.bundle/ +/vendor/bundle +/lib/bundler/man/ + +# for a library or gem, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# Gemfile.lock +# .ruby-version +# .ruby-gemset + +# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: +.rvmrc diff --git a/lib/clients/manage-audience/.openapi-generator/FILES b/lib/clients/manage-audience/.openapi-generator/FILES new file mode 100644 index 00000000..6fb02c10 --- /dev/null +++ b/lib/clients/manage-audience/.openapi-generator/FILES @@ -0,0 +1,74 @@ +.gitignore +.gitlab-ci.yml +.rspec +.rubocop.yml +.travis.yml +Gemfile +README.md +Rakefile +docs/AddAudienceToAudienceGroupRequest.md +docs/Audience.md +docs/AudienceGroup.md +docs/AudienceGroupAuthorityLevel.md +docs/AudienceGroupCreateRoute.md +docs/AudienceGroupFailedType.md +docs/AudienceGroupJob.md +docs/AudienceGroupJobFailedType.md +docs/AudienceGroupJobStatus.md +docs/AudienceGroupJobType.md +docs/AudienceGroupPermission.md +docs/AudienceGroupStatus.md +docs/AudienceGroupType.md +docs/CreateAudienceGroupRequest.md +docs/CreateAudienceGroupResponse.md +docs/CreateClickBasedAudienceGroupRequest.md +docs/CreateClickBasedAudienceGroupResponse.md +docs/CreateImpBasedAudienceGroupRequest.md +docs/CreateImpBasedAudienceGroupResponse.md +docs/ErrorDetail.md +docs/ErrorResponse.md +docs/GetAudienceDataResponse.md +docs/GetAudienceGroupAuthorityLevelResponse.md +docs/GetAudienceGroupsResponse.md +docs/ManageAudienceApi.md +docs/ManageAudienceBlobApi.md +docs/UpdateAudienceGroupAuthorityLevelRequest.md +docs/UpdateAudienceGroupDescriptionRequest.md +git_push.sh +lib/line_client_manage_audience.rb +lib/line_client_manage_audience/api/manage_audience_api.rb +lib/line_client_manage_audience/api/manage_audience_blob_api.rb +lib/line_client_manage_audience/api_client.rb +lib/line_client_manage_audience/api_error.rb +lib/line_client_manage_audience/configuration.rb +lib/line_client_manage_audience/models/add_audience_to_audience_group_request.rb +lib/line_client_manage_audience/models/audience.rb +lib/line_client_manage_audience/models/audience_group.rb +lib/line_client_manage_audience/models/audience_group_authority_level.rb +lib/line_client_manage_audience/models/audience_group_create_route.rb +lib/line_client_manage_audience/models/audience_group_failed_type.rb +lib/line_client_manage_audience/models/audience_group_job.rb +lib/line_client_manage_audience/models/audience_group_job_failed_type.rb +lib/line_client_manage_audience/models/audience_group_job_status.rb +lib/line_client_manage_audience/models/audience_group_job_type.rb +lib/line_client_manage_audience/models/audience_group_permission.rb +lib/line_client_manage_audience/models/audience_group_status.rb +lib/line_client_manage_audience/models/audience_group_type.rb +lib/line_client_manage_audience/models/create_audience_group_request.rb +lib/line_client_manage_audience/models/create_audience_group_response.rb +lib/line_client_manage_audience/models/create_click_based_audience_group_request.rb +lib/line_client_manage_audience/models/create_click_based_audience_group_response.rb +lib/line_client_manage_audience/models/create_imp_based_audience_group_request.rb +lib/line_client_manage_audience/models/create_imp_based_audience_group_response.rb +lib/line_client_manage_audience/models/error_detail.rb +lib/line_client_manage_audience/models/error_response.rb +lib/line_client_manage_audience/models/get_audience_data_response.rb +lib/line_client_manage_audience/models/get_audience_group_authority_level_response.rb +lib/line_client_manage_audience/models/get_audience_groups_response.rb +lib/line_client_manage_audience/models/update_audience_group_authority_level_request.rb +lib/line_client_manage_audience/models/update_audience_group_description_request.rb +lib/line_client_manage_audience/version.rb +line_client_manage_audience.gemspec +spec/api_client_spec.rb +spec/configuration_spec.rb +spec/spec_helper.rb diff --git a/lib/clients/manage-audience/.openapi-generator/VERSION b/lib/clients/manage-audience/.openapi-generator/VERSION new file mode 100644 index 00000000..41225218 --- /dev/null +++ b/lib/clients/manage-audience/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.0.0 \ No newline at end of file diff --git a/lib/clients/manage-audience/README.md b/lib/clients/manage-audience/README.md new file mode 100644 index 00000000..c450f4ed --- /dev/null +++ b/lib/clients/manage-audience/README.md @@ -0,0 +1,134 @@ +# LINE::Client::ManageAudience + +This document describes LINE Messaging API. + +This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 0.0.1 +- Package version: 2.0.0 +- Build package: org.openapitools.codegen.languages.RubyClientCodegen + +## Installation + +### Build a gem + +To build the Ruby code into a gem: + +```shell +gem build line-bot-api.gemspec +``` + +Then either install the gem locally: + +```shell +gem install ./line-bot-api-2.0.0.gem +``` + +(for development, run `gem install --dev ./line-bot-api-2.0.0.gem` to install the development dependencies) + +or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/). + +Finally add this to the Gemfile: + + gem 'line-bot-api', '~> 2.0.0' + +### Install from Git + +If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile: + + gem 'line-bot-api', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git' + +### Include the Ruby code directly + +Include the Ruby code directly using `-I` as follows: + +```shell +ruby -Ilib script.rb +``` + +## Getting Started + +Please follow the [installation](#installation) procedure and then run the following code: + +```ruby +# Load the gem +require 'line-bot-api' + +# Setup authorization +LINE::Client::ManageAudience.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' + # Configure a proc to get access tokens in lieu of the static access_token configuration + config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' } +end + +api_instance = LINE::Client::ManageAudience::ManageAudienceApi.new +audience_group_id = 789 # Integer | The audience ID. + +begin + api_instance.activate_audience_group(audience_group_id) +rescue LINE::Client::ManageAudience::ApiError => e + puts "Exception when calling ManageAudienceApi->activate_audience_group: #{e}" +end + +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://api.line.me* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*LINE::Client::ManageAudience::ManageAudienceApi* | [**activate_audience_group**](docs/ManageAudienceApi.md#activate_audience_group) | **PUT** /v2/bot/audienceGroup/{audienceGroupId}/activate | +*LINE::Client::ManageAudience::ManageAudienceApi* | [**add_audience_to_audience_group**](docs/ManageAudienceApi.md#add_audience_to_audience_group) | **PUT** /v2/bot/audienceGroup/upload | +*LINE::Client::ManageAudience::ManageAudienceApi* | [**create_audience_group**](docs/ManageAudienceApi.md#create_audience_group) | **POST** /v2/bot/audienceGroup/upload | +*LINE::Client::ManageAudience::ManageAudienceApi* | [**create_click_based_audience_group**](docs/ManageAudienceApi.md#create_click_based_audience_group) | **POST** /v2/bot/audienceGroup/click | +*LINE::Client::ManageAudience::ManageAudienceApi* | [**create_imp_based_audience_group**](docs/ManageAudienceApi.md#create_imp_based_audience_group) | **POST** /v2/bot/audienceGroup/imp | +*LINE::Client::ManageAudience::ManageAudienceApi* | [**delete_audience_group**](docs/ManageAudienceApi.md#delete_audience_group) | **DELETE** /v2/bot/audienceGroup/{audienceGroupId} | +*LINE::Client::ManageAudience::ManageAudienceApi* | [**get_audience_data**](docs/ManageAudienceApi.md#get_audience_data) | **GET** /v2/bot/audienceGroup/{audienceGroupId} | +*LINE::Client::ManageAudience::ManageAudienceApi* | [**get_audience_group_authority_level**](docs/ManageAudienceApi.md#get_audience_group_authority_level) | **GET** /v2/bot/audienceGroup/authorityLevel | +*LINE::Client::ManageAudience::ManageAudienceApi* | [**get_audience_groups**](docs/ManageAudienceApi.md#get_audience_groups) | **GET** /v2/bot/audienceGroup/list | +*LINE::Client::ManageAudience::ManageAudienceApi* | [**update_audience_group_authority_level**](docs/ManageAudienceApi.md#update_audience_group_authority_level) | **PUT** /v2/bot/audienceGroup/authorityLevel | +*LINE::Client::ManageAudience::ManageAudienceApi* | [**update_audience_group_description**](docs/ManageAudienceApi.md#update_audience_group_description) | **PUT** /v2/bot/audienceGroup/{audienceGroupId}/updateDescription | +*LINE::Client::ManageAudience::ManageAudienceBlobApi* | [**add_user_ids_to_audience**](docs/ManageAudienceBlobApi.md#add_user_ids_to_audience) | **PUT** /v2/bot/audienceGroup/upload/byFile | +*LINE::Client::ManageAudience::ManageAudienceBlobApi* | [**create_audience_for_uploading_user_ids**](docs/ManageAudienceBlobApi.md#create_audience_for_uploading_user_ids) | **POST** /v2/bot/audienceGroup/upload/byFile | + + +## Documentation for Models + + - [LINE::Client::ManageAudience::AddAudienceToAudienceGroupRequest](docs/AddAudienceToAudienceGroupRequest.md) + - [LINE::Client::ManageAudience::Audience](docs/Audience.md) + - [LINE::Client::ManageAudience::AudienceGroup](docs/AudienceGroup.md) + - [LINE::Client::ManageAudience::AudienceGroupAuthorityLevel](docs/AudienceGroupAuthorityLevel.md) + - [LINE::Client::ManageAudience::AudienceGroupCreateRoute](docs/AudienceGroupCreateRoute.md) + - [LINE::Client::ManageAudience::AudienceGroupFailedType](docs/AudienceGroupFailedType.md) + - [LINE::Client::ManageAudience::AudienceGroupJob](docs/AudienceGroupJob.md) + - [LINE::Client::ManageAudience::AudienceGroupJobFailedType](docs/AudienceGroupJobFailedType.md) + - [LINE::Client::ManageAudience::AudienceGroupJobStatus](docs/AudienceGroupJobStatus.md) + - [LINE::Client::ManageAudience::AudienceGroupJobType](docs/AudienceGroupJobType.md) + - [LINE::Client::ManageAudience::AudienceGroupPermission](docs/AudienceGroupPermission.md) + - [LINE::Client::ManageAudience::AudienceGroupStatus](docs/AudienceGroupStatus.md) + - [LINE::Client::ManageAudience::AudienceGroupType](docs/AudienceGroupType.md) + - [LINE::Client::ManageAudience::CreateAudienceGroupRequest](docs/CreateAudienceGroupRequest.md) + - [LINE::Client::ManageAudience::CreateAudienceGroupResponse](docs/CreateAudienceGroupResponse.md) + - [LINE::Client::ManageAudience::CreateClickBasedAudienceGroupRequest](docs/CreateClickBasedAudienceGroupRequest.md) + - [LINE::Client::ManageAudience::CreateClickBasedAudienceGroupResponse](docs/CreateClickBasedAudienceGroupResponse.md) + - [LINE::Client::ManageAudience::CreateImpBasedAudienceGroupRequest](docs/CreateImpBasedAudienceGroupRequest.md) + - [LINE::Client::ManageAudience::CreateImpBasedAudienceGroupResponse](docs/CreateImpBasedAudienceGroupResponse.md) + - [LINE::Client::ManageAudience::ErrorDetail](docs/ErrorDetail.md) + - [LINE::Client::ManageAudience::ErrorResponse](docs/ErrorResponse.md) + - [LINE::Client::ManageAudience::GetAudienceDataResponse](docs/GetAudienceDataResponse.md) + - [LINE::Client::ManageAudience::GetAudienceGroupAuthorityLevelResponse](docs/GetAudienceGroupAuthorityLevelResponse.md) + - [LINE::Client::ManageAudience::GetAudienceGroupsResponse](docs/GetAudienceGroupsResponse.md) + - [LINE::Client::ManageAudience::UpdateAudienceGroupAuthorityLevelRequest](docs/UpdateAudienceGroupAuthorityLevelRequest.md) + - [LINE::Client::ManageAudience::UpdateAudienceGroupDescriptionRequest](docs/UpdateAudienceGroupDescriptionRequest.md) + + +## Documentation for Authorization + + +Authentication schemes defined for the API: +### Bearer + +- **Type**: Bearer authentication + diff --git a/lib/clients/manage-audience/docs/AddAudienceToAudienceGroupRequest.md b/lib/clients/manage-audience/docs/AddAudienceToAudienceGroupRequest.md new file mode 100644 index 00000000..9de13d84 --- /dev/null +++ b/lib/clients/manage-audience/docs/AddAudienceToAudienceGroupRequest.md @@ -0,0 +1,22 @@ +# LINE::Client::ManageAudience::AddAudienceToAudienceGroupRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **audience_group_id** | **Integer** | The audience ID. | [optional] | +| **upload_description** | **String** | The audience's name. | [optional] | +| **audiences** | [**Array<Audience>**](Audience.md) | An array of up to 10,000 user IDs or IFAs. | [optional] | + +## Example + +```ruby +require 'line_client_manage_audience' + +instance = LINE::Client::ManageAudience::AddAudienceToAudienceGroupRequest.new( + audience_group_id: null, + upload_description: null, + audiences: null +) +``` + diff --git a/lib/clients/manage-audience/docs/Audience.md b/lib/clients/manage-audience/docs/Audience.md new file mode 100644 index 00000000..81c87de7 --- /dev/null +++ b/lib/clients/manage-audience/docs/Audience.md @@ -0,0 +1,18 @@ +# LINE::Client::ManageAudience::Audience + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | A user ID or IFA. You can specify an empty array. | [optional] | + +## Example + +```ruby +require 'line_client_manage_audience' + +instance = LINE::Client::ManageAudience::Audience.new( + id: null +) +``` + diff --git a/lib/clients/manage-audience/docs/AudienceGroup.md b/lib/clients/manage-audience/docs/AudienceGroup.md new file mode 100644 index 00000000..00580f80 --- /dev/null +++ b/lib/clients/manage-audience/docs/AudienceGroup.md @@ -0,0 +1,40 @@ +# LINE::Client::ManageAudience::AudienceGroup + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **audience_group_id** | **Integer** | The audience ID. | [optional] | +| **type** | [**AudienceGroupType**](AudienceGroupType.md) | | [optional] | +| **description** | **String** | The audience's name. | [optional] | +| **status** | [**AudienceGroupStatus**](AudienceGroupStatus.md) | | [optional] | +| **failed_type** | [**AudienceGroupFailedType**](AudienceGroupFailedType.md) | | [optional] | +| **audience_count** | **Integer** | The number of users included in the audience. | [optional] | +| **created** | **Integer** | When the audience was created (in UNIX time). | [optional] | +| **request_id** | **String** | The request ID that was specified when the audience was created. This is only included when `audienceGroup.type` is CLICK or IMP. | [optional] | +| **click_url** | **String** | The URL that was specified when the audience was created. This is only included when `audienceGroup.type` is CLICK and link URL is specified. | [optional] | +| **is_ifa_audience** | **Boolean** | The value indicating the type of account to be sent, as specified when creating the audience for uploading user IDs. | [optional] | +| **permission** | [**AudienceGroupPermission**](AudienceGroupPermission.md) | | [optional] | +| **create_route** | [**AudienceGroupCreateRoute**](AudienceGroupCreateRoute.md) | | [optional] | + +## Example + +```ruby +require 'line_client_manage_audience' + +instance = LINE::Client::ManageAudience::AudienceGroup.new( + audience_group_id: null, + type: null, + description: null, + status: null, + failed_type: null, + audience_count: null, + created: null, + request_id: null, + click_url: null, + is_ifa_audience: null, + permission: null, + create_route: null +) +``` + diff --git a/lib/clients/manage-audience/docs/AudienceGroupAuthorityLevel.md b/lib/clients/manage-audience/docs/AudienceGroupAuthorityLevel.md new file mode 100644 index 00000000..95fad41b --- /dev/null +++ b/lib/clients/manage-audience/docs/AudienceGroupAuthorityLevel.md @@ -0,0 +1,15 @@ +# LINE::Client::ManageAudience::AudienceGroupAuthorityLevel + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_manage_audience' + +instance = LINE::Client::ManageAudience::AudienceGroupAuthorityLevel.new() +``` + diff --git a/lib/clients/manage-audience/docs/AudienceGroupCreateRoute.md b/lib/clients/manage-audience/docs/AudienceGroupCreateRoute.md new file mode 100644 index 00000000..880280df --- /dev/null +++ b/lib/clients/manage-audience/docs/AudienceGroupCreateRoute.md @@ -0,0 +1,15 @@ +# LINE::Client::ManageAudience::AudienceGroupCreateRoute + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_manage_audience' + +instance = LINE::Client::ManageAudience::AudienceGroupCreateRoute.new() +``` + diff --git a/lib/clients/manage-audience/docs/AudienceGroupFailedType.md b/lib/clients/manage-audience/docs/AudienceGroupFailedType.md new file mode 100644 index 00000000..7235a13f --- /dev/null +++ b/lib/clients/manage-audience/docs/AudienceGroupFailedType.md @@ -0,0 +1,15 @@ +# LINE::Client::ManageAudience::AudienceGroupFailedType + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_manage_audience' + +instance = LINE::Client::ManageAudience::AudienceGroupFailedType.new() +``` + diff --git a/lib/clients/manage-audience/docs/AudienceGroupJob.md b/lib/clients/manage-audience/docs/AudienceGroupJob.md new file mode 100644 index 00000000..444e95ba --- /dev/null +++ b/lib/clients/manage-audience/docs/AudienceGroupJob.md @@ -0,0 +1,32 @@ +# LINE::Client::ManageAudience::AudienceGroupJob + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **audience_group_job_id** | **Integer** | A job ID. | [optional] | +| **audience_group_id** | **Integer** | An audience ID. | [optional] | +| **description** | **String** | The job's description. | [optional] | +| **type** | [**AudienceGroupJobType**](AudienceGroupJobType.md) | | [optional] | +| **job_status** | [**AudienceGroupJobStatus**](AudienceGroupJobStatus.md) | | [optional] | +| **failed_type** | [**AudienceGroupJobFailedType**](AudienceGroupJobFailedType.md) | | [optional] | +| **audience_count** | **Integer** | The number of accounts (recipients) that were added or removed. | [optional] | +| **created** | **Integer** | When the job was created (in UNIX time). | [optional] | + +## Example + +```ruby +require 'line_client_manage_audience' + +instance = LINE::Client::ManageAudience::AudienceGroupJob.new( + audience_group_job_id: null, + audience_group_id: null, + description: null, + type: null, + job_status: null, + failed_type: null, + audience_count: null, + created: null +) +``` + diff --git a/lib/clients/manage-audience/docs/AudienceGroupJobFailedType.md b/lib/clients/manage-audience/docs/AudienceGroupJobFailedType.md new file mode 100644 index 00000000..69492d72 --- /dev/null +++ b/lib/clients/manage-audience/docs/AudienceGroupJobFailedType.md @@ -0,0 +1,15 @@ +# LINE::Client::ManageAudience::AudienceGroupJobFailedType + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_manage_audience' + +instance = LINE::Client::ManageAudience::AudienceGroupJobFailedType.new() +``` + diff --git a/lib/clients/manage-audience/docs/AudienceGroupJobStatus.md b/lib/clients/manage-audience/docs/AudienceGroupJobStatus.md new file mode 100644 index 00000000..45d9cb87 --- /dev/null +++ b/lib/clients/manage-audience/docs/AudienceGroupJobStatus.md @@ -0,0 +1,15 @@ +# LINE::Client::ManageAudience::AudienceGroupJobStatus + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_manage_audience' + +instance = LINE::Client::ManageAudience::AudienceGroupJobStatus.new() +``` + diff --git a/lib/clients/manage-audience/docs/AudienceGroupJobType.md b/lib/clients/manage-audience/docs/AudienceGroupJobType.md new file mode 100644 index 00000000..788822d9 --- /dev/null +++ b/lib/clients/manage-audience/docs/AudienceGroupJobType.md @@ -0,0 +1,15 @@ +# LINE::Client::ManageAudience::AudienceGroupJobType + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_manage_audience' + +instance = LINE::Client::ManageAudience::AudienceGroupJobType.new() +``` + diff --git a/lib/clients/manage-audience/docs/AudienceGroupPermission.md b/lib/clients/manage-audience/docs/AudienceGroupPermission.md new file mode 100644 index 00000000..8016ed9a --- /dev/null +++ b/lib/clients/manage-audience/docs/AudienceGroupPermission.md @@ -0,0 +1,15 @@ +# LINE::Client::ManageAudience::AudienceGroupPermission + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_manage_audience' + +instance = LINE::Client::ManageAudience::AudienceGroupPermission.new() +``` + diff --git a/lib/clients/manage-audience/docs/AudienceGroupStatus.md b/lib/clients/manage-audience/docs/AudienceGroupStatus.md new file mode 100644 index 00000000..908d9051 --- /dev/null +++ b/lib/clients/manage-audience/docs/AudienceGroupStatus.md @@ -0,0 +1,15 @@ +# LINE::Client::ManageAudience::AudienceGroupStatus + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_manage_audience' + +instance = LINE::Client::ManageAudience::AudienceGroupStatus.new() +``` + diff --git a/lib/clients/manage-audience/docs/AudienceGroupType.md b/lib/clients/manage-audience/docs/AudienceGroupType.md new file mode 100644 index 00000000..40ccb545 --- /dev/null +++ b/lib/clients/manage-audience/docs/AudienceGroupType.md @@ -0,0 +1,15 @@ +# LINE::Client::ManageAudience::AudienceGroupType + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_manage_audience' + +instance = LINE::Client::ManageAudience::AudienceGroupType.new() +``` + diff --git a/lib/clients/manage-audience/docs/CreateAudienceGroupRequest.md b/lib/clients/manage-audience/docs/CreateAudienceGroupRequest.md new file mode 100644 index 00000000..2e1d9b80 --- /dev/null +++ b/lib/clients/manage-audience/docs/CreateAudienceGroupRequest.md @@ -0,0 +1,24 @@ +# LINE::Client::ManageAudience::CreateAudienceGroupRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **description** | **String** | The audience's name. This is case-insensitive, meaning AUDIENCE and audience are considered identical. Max character limit: 120 | [optional] | +| **is_ifa_audience** | **Boolean** | To specify recipients by IFAs: set true. To specify recipients by user IDs: set false or omit isIfaAudience property. | [optional] | +| **upload_description** | **String** | The description to register for the job (in jobs[].description). | [optional] | +| **audiences** | [**Array<Audience>**](Audience.md) | An array of user IDs or IFAs. Max number: 10,000 | [optional] | + +## Example + +```ruby +require 'line_client_manage_audience' + +instance = LINE::Client::ManageAudience::CreateAudienceGroupRequest.new( + description: null, + is_ifa_audience: null, + upload_description: null, + audiences: null +) +``` + diff --git a/lib/clients/manage-audience/docs/CreateAudienceGroupResponse.md b/lib/clients/manage-audience/docs/CreateAudienceGroupResponse.md new file mode 100644 index 00000000..b8dedacc --- /dev/null +++ b/lib/clients/manage-audience/docs/CreateAudienceGroupResponse.md @@ -0,0 +1,32 @@ +# LINE::Client::ManageAudience::CreateAudienceGroupResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **audience_group_id** | **Integer** | The audience ID. | [optional] | +| **create_route** | **String** | How the audience was created. `MESSAGING_API`: An audience created with Messaging API. | [optional] | +| **type** | [**AudienceGroupType**](AudienceGroupType.md) | | [optional] | +| **description** | **String** | The audience's name. | [optional] | +| **created** | **Integer** | When the audience was created (in UNIX time). | [optional] | +| **permission** | **String** | Audience's update permission. Audiences linked to the same channel will be READ_WRITE. `READ`: Can use only. `READ_WRITE`: Can use and update. | [optional] | +| **expire_timestamp** | **Float** | Time of audience expiration. Only returned for specific audiences. | [optional] | +| **is_ifa_audience** | **Boolean** | The value indicating the type of account to be sent, as specified when creating the audience for uploading user IDs. One of: `true`: Accounts are specified with IFAs. `false` (default): Accounts are specified with user IDs. | [optional] | + +## Example + +```ruby +require 'line_client_manage_audience' + +instance = LINE::Client::ManageAudience::CreateAudienceGroupResponse.new( + audience_group_id: null, + create_route: null, + type: null, + description: null, + created: null, + permission: null, + expire_timestamp: null, + is_ifa_audience: null +) +``` + diff --git a/lib/clients/manage-audience/docs/CreateClickBasedAudienceGroupRequest.md b/lib/clients/manage-audience/docs/CreateClickBasedAudienceGroupRequest.md new file mode 100644 index 00000000..cbcb2a1a --- /dev/null +++ b/lib/clients/manage-audience/docs/CreateClickBasedAudienceGroupRequest.md @@ -0,0 +1,22 @@ +# LINE::Client::ManageAudience::CreateClickBasedAudienceGroupRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **description** | **String** | The audience's name. This is case-insensitive, meaning AUDIENCE and audience are considered identical. Max character limit: 120 | [optional] | +| **request_id** | **String** | The request ID of a broadcast or narrowcast message sent in the past 60 days. Each Messaging API request has a request ID. | [optional] | +| **click_url** | **String** | The URL clicked by the user. If empty, users who clicked any URL in the message are added to the list of recipients. Max character limit: 2,000 | [optional] | + +## Example + +```ruby +require 'line_client_manage_audience' + +instance = LINE::Client::ManageAudience::CreateClickBasedAudienceGroupRequest.new( + description: null, + request_id: null, + click_url: null +) +``` + diff --git a/lib/clients/manage-audience/docs/CreateClickBasedAudienceGroupResponse.md b/lib/clients/manage-audience/docs/CreateClickBasedAudienceGroupResponse.md new file mode 100644 index 00000000..e42ab3f3 --- /dev/null +++ b/lib/clients/manage-audience/docs/CreateClickBasedAudienceGroupResponse.md @@ -0,0 +1,36 @@ +# LINE::Client::ManageAudience::CreateClickBasedAudienceGroupResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **audience_group_id** | **Integer** | The audience ID. | [optional] | +| **type** | [**AudienceGroupType**](AudienceGroupType.md) | | [optional] | +| **description** | **String** | The audience's name. | [optional] | +| **created** | **Integer** | When the audience was created (in UNIX time). | [optional] | +| **request_id** | **String** | The request ID that was specified when the audience was created. | [optional] | +| **click_url** | **String** | The URL that was specified when the audience was created. | [optional] | +| **create_route** | **String** | How the audience was created. `MESSAGING_API`: An audience created with Messaging API. | [optional] | +| **permission** | **String** | Audience's update permission. Audiences linked to the same channel will be READ_WRITE. - `READ`: Can use only. - `READ_WRITE`: Can use and update. | [optional] | +| **expire_timestamp** | **Integer** | Time of audience expiration. Only returned for specific audiences. | [optional] | +| **is_ifa_audience** | **Boolean** | The value indicating the type of account to be sent, as specified when creating the audience for uploading user IDs. One of: true: Accounts are specified with IFAs. false (default): Accounts are specified with user IDs. | [optional][default to false] | + +## Example + +```ruby +require 'line_client_manage_audience' + +instance = LINE::Client::ManageAudience::CreateClickBasedAudienceGroupResponse.new( + audience_group_id: null, + type: null, + description: null, + created: null, + request_id: null, + click_url: null, + create_route: null, + permission: null, + expire_timestamp: null, + is_ifa_audience: null +) +``` + diff --git a/lib/clients/manage-audience/docs/CreateImpBasedAudienceGroupRequest.md b/lib/clients/manage-audience/docs/CreateImpBasedAudienceGroupRequest.md new file mode 100644 index 00000000..1bbaaf83 --- /dev/null +++ b/lib/clients/manage-audience/docs/CreateImpBasedAudienceGroupRequest.md @@ -0,0 +1,20 @@ +# LINE::Client::ManageAudience::CreateImpBasedAudienceGroupRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **description** | **String** | The audience's name. This is case-insensitive, meaning `AUDIENCE` and `audience` are considered identical. Max character limit: 120 | [optional] | +| **request_id** | **String** | The request ID of a broadcast or narrowcast message sent in the past 60 days. Each Messaging API request has a request ID. | [optional] | + +## Example + +```ruby +require 'line_client_manage_audience' + +instance = LINE::Client::ManageAudience::CreateImpBasedAudienceGroupRequest.new( + description: null, + request_id: null +) +``` + diff --git a/lib/clients/manage-audience/docs/CreateImpBasedAudienceGroupResponse.md b/lib/clients/manage-audience/docs/CreateImpBasedAudienceGroupResponse.md new file mode 100644 index 00000000..c16a80d7 --- /dev/null +++ b/lib/clients/manage-audience/docs/CreateImpBasedAudienceGroupResponse.md @@ -0,0 +1,26 @@ +# LINE::Client::ManageAudience::CreateImpBasedAudienceGroupResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **audience_group_id** | **Integer** | The audience ID. | [optional] | +| **type** | [**AudienceGroupType**](AudienceGroupType.md) | | [optional] | +| **description** | **String** | The audience's name. | [optional] | +| **created** | **Integer** | When the audience was created (in UNIX time). | [optional] | +| **request_id** | **String** | The request ID that was specified when the audience was created. | [optional] | + +## Example + +```ruby +require 'line_client_manage_audience' + +instance = LINE::Client::ManageAudience::CreateImpBasedAudienceGroupResponse.new( + audience_group_id: null, + type: null, + description: null, + created: null, + request_id: null +) +``` + diff --git a/lib/clients/manage-audience/docs/ErrorDetail.md b/lib/clients/manage-audience/docs/ErrorDetail.md new file mode 100644 index 00000000..97f6960c --- /dev/null +++ b/lib/clients/manage-audience/docs/ErrorDetail.md @@ -0,0 +1,20 @@ +# LINE::Client::ManageAudience::ErrorDetail + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **message** | **String** | Details of the error. Not included in the response under certain situations. | [optional] | +| **property** | **String** | Location of where the error occurred. Returns the JSON field name or query parameter name of the request. Not included in the response under certain situations. | [optional] | + +## Example + +```ruby +require 'line_client_manage_audience' + +instance = LINE::Client::ManageAudience::ErrorDetail.new( + message: null, + property: null +) +``` + diff --git a/lib/clients/manage-audience/docs/ErrorResponse.md b/lib/clients/manage-audience/docs/ErrorResponse.md new file mode 100644 index 00000000..bdfb63ed --- /dev/null +++ b/lib/clients/manage-audience/docs/ErrorResponse.md @@ -0,0 +1,20 @@ +# LINE::Client::ManageAudience::ErrorResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **message** | **String** | Message containing information about the error. | | +| **details** | [**Array<ErrorDetail>**](ErrorDetail.md) | An array of error details. If the array is empty, this property will not be included in the response. | [optional] | + +## Example + +```ruby +require 'line_client_manage_audience' + +instance = LINE::Client::ManageAudience::ErrorResponse.new( + message: null, + details: null +) +``` + diff --git a/lib/clients/manage-audience/docs/GetAudienceDataResponse.md b/lib/clients/manage-audience/docs/GetAudienceDataResponse.md new file mode 100644 index 00000000..3a5a8e80 --- /dev/null +++ b/lib/clients/manage-audience/docs/GetAudienceDataResponse.md @@ -0,0 +1,20 @@ +# LINE::Client::ManageAudience::GetAudienceDataResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **audience_group** | [**AudienceGroup**](AudienceGroup.md) | | [optional] | +| **jobs** | [**Array<AudienceGroupJob>**](AudienceGroupJob.md) | An array of jobs. This array is used to keep track of each attempt to add new user IDs or IFAs to an audience for uploading user IDs. Empty array is returned for any other type of audience. Max: 50 | [optional] | + +## Example + +```ruby +require 'line_client_manage_audience' + +instance = LINE::Client::ManageAudience::GetAudienceDataResponse.new( + audience_group: null, + jobs: null +) +``` + diff --git a/lib/clients/manage-audience/docs/GetAudienceGroupAuthorityLevelResponse.md b/lib/clients/manage-audience/docs/GetAudienceGroupAuthorityLevelResponse.md new file mode 100644 index 00000000..5923767a --- /dev/null +++ b/lib/clients/manage-audience/docs/GetAudienceGroupAuthorityLevelResponse.md @@ -0,0 +1,18 @@ +# LINE::Client::ManageAudience::GetAudienceGroupAuthorityLevelResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **authority_level** | [**AudienceGroupAuthorityLevel**](AudienceGroupAuthorityLevel.md) | | [optional] | + +## Example + +```ruby +require 'line_client_manage_audience' + +instance = LINE::Client::ManageAudience::GetAudienceGroupAuthorityLevelResponse.new( + authority_level: null +) +``` + diff --git a/lib/clients/manage-audience/docs/GetAudienceGroupsResponse.md b/lib/clients/manage-audience/docs/GetAudienceGroupsResponse.md new file mode 100644 index 00000000..454f5e1d --- /dev/null +++ b/lib/clients/manage-audience/docs/GetAudienceGroupsResponse.md @@ -0,0 +1,28 @@ +# LINE::Client::ManageAudience::GetAudienceGroupsResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **audience_groups** | [**Array<AudienceGroup>**](AudienceGroup.md) | An array of audience data. If there are no audiences that match the specified filter, an empty array will be returned. | [optional] | +| **has_next_page** | **Boolean** | true when this is not the last page. | [optional] | +| **total_count** | **Integer** | The total number of audiences that can be returned with the specified filter. | [optional] | +| **read_write_audience_group_total_count** | **Integer** | Of the audiences you can get with the specified filter, the number of audiences with the update permission set to READ_WRITE. | [optional] | +| **page** | **Integer** | The current page number. | [optional] | +| **size** | **Integer** | The maximum number of audiences on the current page. | [optional] | + +## Example + +```ruby +require 'line_client_manage_audience' + +instance = LINE::Client::ManageAudience::GetAudienceGroupsResponse.new( + audience_groups: null, + has_next_page: null, + total_count: null, + read_write_audience_group_total_count: null, + page: null, + size: null +) +``` + diff --git a/lib/clients/manage-audience/docs/ManageAudienceApi.md b/lib/clients/manage-audience/docs/ManageAudienceApi.md new file mode 100644 index 00000000..30a50baf --- /dev/null +++ b/lib/clients/manage-audience/docs/ManageAudienceApi.md @@ -0,0 +1,783 @@ +# LINE::Client::ManageAudience::ManageAudienceApi + +All URIs are relative to *https://api.line.me* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**activate_audience_group**](ManageAudienceApi.md#activate_audience_group) | **PUT** /v2/bot/audienceGroup/{audienceGroupId}/activate | | +| [**add_audience_to_audience_group**](ManageAudienceApi.md#add_audience_to_audience_group) | **PUT** /v2/bot/audienceGroup/upload | | +| [**create_audience_group**](ManageAudienceApi.md#create_audience_group) | **POST** /v2/bot/audienceGroup/upload | | +| [**create_click_based_audience_group**](ManageAudienceApi.md#create_click_based_audience_group) | **POST** /v2/bot/audienceGroup/click | | +| [**create_imp_based_audience_group**](ManageAudienceApi.md#create_imp_based_audience_group) | **POST** /v2/bot/audienceGroup/imp | | +| [**delete_audience_group**](ManageAudienceApi.md#delete_audience_group) | **DELETE** /v2/bot/audienceGroup/{audienceGroupId} | | +| [**get_audience_data**](ManageAudienceApi.md#get_audience_data) | **GET** /v2/bot/audienceGroup/{audienceGroupId} | | +| [**get_audience_group_authority_level**](ManageAudienceApi.md#get_audience_group_authority_level) | **GET** /v2/bot/audienceGroup/authorityLevel | | +| [**get_audience_groups**](ManageAudienceApi.md#get_audience_groups) | **GET** /v2/bot/audienceGroup/list | | +| [**update_audience_group_authority_level**](ManageAudienceApi.md#update_audience_group_authority_level) | **PUT** /v2/bot/audienceGroup/authorityLevel | | +| [**update_audience_group_description**](ManageAudienceApi.md#update_audience_group_description) | **PUT** /v2/bot/audienceGroup/{audienceGroupId}/updateDescription | | + + +## activate_audience_group + +> activate_audience_group(audience_group_id) + + + +Activate audience + +### Examples + +```ruby +require 'time' +require 'line_client_manage_audience' +# setup authorization +LINE::Client::ManageAudience.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::ManageAudience::ManageAudienceApi.new +audience_group_id = 789 # Integer | The audience ID. + +begin + + api_instance.activate_audience_group(audience_group_id) +rescue LINE::Client::ManageAudience::ApiError => e + puts "Error when calling ManageAudienceApi->activate_audience_group: #{e}" +end +``` + +#### Using the activate_audience_group_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> activate_audience_group_with_http_info(audience_group_id) + +```ruby +begin + + data, status_code, headers = api_instance.activate_audience_group_with_http_info(audience_group_id) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::ManageAudience::ApiError => e + puts "Error when calling ManageAudienceApi->activate_audience_group_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **audience_group_id** | **Integer** | The audience ID. | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## add_audience_to_audience_group + +> add_audience_to_audience_group(add_audience_to_audience_group_request) + + + +Add user IDs or Identifiers for Advertisers (IFAs) to an audience for uploading user IDs (by JSON) + +### Examples + +```ruby +require 'time' +require 'line_client_manage_audience' +# setup authorization +LINE::Client::ManageAudience.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::ManageAudience::ManageAudienceApi.new +add_audience_to_audience_group_request = LINE::Client::ManageAudience::AddAudienceToAudienceGroupRequest.new # AddAudienceToAudienceGroupRequest | + +begin + + api_instance.add_audience_to_audience_group(add_audience_to_audience_group_request) +rescue LINE::Client::ManageAudience::ApiError => e + puts "Error when calling ManageAudienceApi->add_audience_to_audience_group: #{e}" +end +``` + +#### Using the add_audience_to_audience_group_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> add_audience_to_audience_group_with_http_info(add_audience_to_audience_group_request) + +```ruby +begin + + data, status_code, headers = api_instance.add_audience_to_audience_group_with_http_info(add_audience_to_audience_group_request) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::ManageAudience::ApiError => e + puts "Error when calling ManageAudienceApi->add_audience_to_audience_group_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **add_audience_to_audience_group_request** | [**AddAudienceToAudienceGroupRequest**](AddAudienceToAudienceGroupRequest.md) | | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## create_audience_group + +> create_audience_group(create_audience_group_request) + + + +Create audience for uploading user IDs (by JSON) + +### Examples + +```ruby +require 'time' +require 'line_client_manage_audience' +# setup authorization +LINE::Client::ManageAudience.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::ManageAudience::ManageAudienceApi.new +create_audience_group_request = LINE::Client::ManageAudience::CreateAudienceGroupRequest.new # CreateAudienceGroupRequest | + +begin + + result = api_instance.create_audience_group(create_audience_group_request) + p result +rescue LINE::Client::ManageAudience::ApiError => e + puts "Error when calling ManageAudienceApi->create_audience_group: #{e}" +end +``` + +#### Using the create_audience_group_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_audience_group_with_http_info(create_audience_group_request) + +```ruby +begin + + data, status_code, headers = api_instance.create_audience_group_with_http_info(create_audience_group_request) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::ManageAudience::ApiError => e + puts "Error when calling ManageAudienceApi->create_audience_group_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **create_audience_group_request** | [**CreateAudienceGroupRequest**](CreateAudienceGroupRequest.md) | | | + +### Return type + +[**CreateAudienceGroupResponse**](CreateAudienceGroupResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## create_click_based_audience_group + +> create_click_based_audience_group(create_click_based_audience_group_request) + + + +Create audience for click-based retargeting + +### Examples + +```ruby +require 'time' +require 'line_client_manage_audience' +# setup authorization +LINE::Client::ManageAudience.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::ManageAudience::ManageAudienceApi.new +create_click_based_audience_group_request = LINE::Client::ManageAudience::CreateClickBasedAudienceGroupRequest.new # CreateClickBasedAudienceGroupRequest | + +begin + + result = api_instance.create_click_based_audience_group(create_click_based_audience_group_request) + p result +rescue LINE::Client::ManageAudience::ApiError => e + puts "Error when calling ManageAudienceApi->create_click_based_audience_group: #{e}" +end +``` + +#### Using the create_click_based_audience_group_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_click_based_audience_group_with_http_info(create_click_based_audience_group_request) + +```ruby +begin + + data, status_code, headers = api_instance.create_click_based_audience_group_with_http_info(create_click_based_audience_group_request) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::ManageAudience::ApiError => e + puts "Error when calling ManageAudienceApi->create_click_based_audience_group_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **create_click_based_audience_group_request** | [**CreateClickBasedAudienceGroupRequest**](CreateClickBasedAudienceGroupRequest.md) | | | + +### Return type + +[**CreateClickBasedAudienceGroupResponse**](CreateClickBasedAudienceGroupResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## create_imp_based_audience_group + +> create_imp_based_audience_group(create_imp_based_audience_group_request) + + + +Create audience for impression-based retargeting + +### Examples + +```ruby +require 'time' +require 'line_client_manage_audience' +# setup authorization +LINE::Client::ManageAudience.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::ManageAudience::ManageAudienceApi.new +create_imp_based_audience_group_request = LINE::Client::ManageAudience::CreateImpBasedAudienceGroupRequest.new # CreateImpBasedAudienceGroupRequest | + +begin + + result = api_instance.create_imp_based_audience_group(create_imp_based_audience_group_request) + p result +rescue LINE::Client::ManageAudience::ApiError => e + puts "Error when calling ManageAudienceApi->create_imp_based_audience_group: #{e}" +end +``` + +#### Using the create_imp_based_audience_group_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_imp_based_audience_group_with_http_info(create_imp_based_audience_group_request) + +```ruby +begin + + data, status_code, headers = api_instance.create_imp_based_audience_group_with_http_info(create_imp_based_audience_group_request) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::ManageAudience::ApiError => e + puts "Error when calling ManageAudienceApi->create_imp_based_audience_group_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **create_imp_based_audience_group_request** | [**CreateImpBasedAudienceGroupRequest**](CreateImpBasedAudienceGroupRequest.md) | | | + +### Return type + +[**CreateImpBasedAudienceGroupResponse**](CreateImpBasedAudienceGroupResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## delete_audience_group + +> delete_audience_group(audience_group_id) + + + +Delete audience + +### Examples + +```ruby +require 'time' +require 'line_client_manage_audience' +# setup authorization +LINE::Client::ManageAudience.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::ManageAudience::ManageAudienceApi.new +audience_group_id = 789 # Integer | The audience ID. + +begin + + api_instance.delete_audience_group(audience_group_id) +rescue LINE::Client::ManageAudience::ApiError => e + puts "Error when calling ManageAudienceApi->delete_audience_group: #{e}" +end +``` + +#### Using the delete_audience_group_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> delete_audience_group_with_http_info(audience_group_id) + +```ruby +begin + + data, status_code, headers = api_instance.delete_audience_group_with_http_info(audience_group_id) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::ManageAudience::ApiError => e + puts "Error when calling ManageAudienceApi->delete_audience_group_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **audience_group_id** | **Integer** | The audience ID. | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## get_audience_data + +> get_audience_data(audience_group_id) + + + +Gets audience data. + +### Examples + +```ruby +require 'time' +require 'line_client_manage_audience' +# setup authorization +LINE::Client::ManageAudience.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::ManageAudience::ManageAudienceApi.new +audience_group_id = 789 # Integer | The audience ID. + +begin + + result = api_instance.get_audience_data(audience_group_id) + p result +rescue LINE::Client::ManageAudience::ApiError => e + puts "Error when calling ManageAudienceApi->get_audience_data: #{e}" +end +``` + +#### Using the get_audience_data_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_audience_data_with_http_info(audience_group_id) + +```ruby +begin + + data, status_code, headers = api_instance.get_audience_data_with_http_info(audience_group_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::ManageAudience::ApiError => e + puts "Error when calling ManageAudienceApi->get_audience_data_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **audience_group_id** | **Integer** | The audience ID. | | + +### Return type + +[**GetAudienceDataResponse**](GetAudienceDataResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_audience_group_authority_level + +> get_audience_group_authority_level + + + +Get the authority level of the audience + +### Examples + +```ruby +require 'time' +require 'line_client_manage_audience' +# setup authorization +LINE::Client::ManageAudience.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::ManageAudience::ManageAudienceApi.new + +begin + + result = api_instance.get_audience_group_authority_level + p result +rescue LINE::Client::ManageAudience::ApiError => e + puts "Error when calling ManageAudienceApi->get_audience_group_authority_level: #{e}" +end +``` + +#### Using the get_audience_group_authority_level_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_audience_group_authority_level_with_http_info + +```ruby +begin + + data, status_code, headers = api_instance.get_audience_group_authority_level_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::ManageAudience::ApiError => e + puts "Error when calling ManageAudienceApi->get_audience_group_authority_level_with_http_info: #{e}" +end +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**GetAudienceGroupAuthorityLevelResponse**](GetAudienceGroupAuthorityLevelResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_audience_groups + +> get_audience_groups(page, opts) + + + +Gets data for more than one audience. + +### Examples + +```ruby +require 'time' +require 'line_client_manage_audience' +# setup authorization +LINE::Client::ManageAudience.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::ManageAudience::ManageAudienceApi.new +page = 789 # Integer | The page to return when getting (paginated) results. Must be 1 or higher. +opts = { + description: 'description_example', # String | The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. + status: LINE::Client::ManageAudience::AudienceGroupStatus::IN_PROGRESS, # AudienceGroupStatus | The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. + size: 20, # Integer | The number of audiences per page. Default: 20 Max: 40 + includes_external_public_groups: true, # Boolean | true (default): Get public audiences created in all channels linked to the same bot. false: Get audiences created in the same channel. + create_route: LINE::Client::ManageAudience::AudienceGroupCreateRoute::OA_MANAGER # AudienceGroupCreateRoute | How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. +} + +begin + + result = api_instance.get_audience_groups(page, opts) + p result +rescue LINE::Client::ManageAudience::ApiError => e + puts "Error when calling ManageAudienceApi->get_audience_groups: #{e}" +end +``` + +#### Using the get_audience_groups_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_audience_groups_with_http_info(page, opts) + +```ruby +begin + + data, status_code, headers = api_instance.get_audience_groups_with_http_info(page, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::ManageAudience::ApiError => e + puts "Error when calling ManageAudienceApi->get_audience_groups_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **page** | **Integer** | The page to return when getting (paginated) results. Must be 1 or higher. | | +| **description** | **String** | The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. | [optional] | +| **status** | [**AudienceGroupStatus**](.md) | The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. | [optional] | +| **size** | **Integer** | The number of audiences per page. Default: 20 Max: 40 | [optional] | +| **includes_external_public_groups** | **Boolean** | true (default): Get public audiences created in all channels linked to the same bot. false: Get audiences created in the same channel. | [optional] | +| **create_route** | [**AudienceGroupCreateRoute**](.md) | How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. | [optional] | + +### Return type + +[**GetAudienceGroupsResponse**](GetAudienceGroupsResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## update_audience_group_authority_level + +> update_audience_group_authority_level(update_audience_group_authority_level_request) + + + +Change the authority level of the audience + +### Examples + +```ruby +require 'time' +require 'line_client_manage_audience' +# setup authorization +LINE::Client::ManageAudience.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::ManageAudience::ManageAudienceApi.new +update_audience_group_authority_level_request = LINE::Client::ManageAudience::UpdateAudienceGroupAuthorityLevelRequest.new # UpdateAudienceGroupAuthorityLevelRequest | + +begin + + api_instance.update_audience_group_authority_level(update_audience_group_authority_level_request) +rescue LINE::Client::ManageAudience::ApiError => e + puts "Error when calling ManageAudienceApi->update_audience_group_authority_level: #{e}" +end +``` + +#### Using the update_audience_group_authority_level_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> update_audience_group_authority_level_with_http_info(update_audience_group_authority_level_request) + +```ruby +begin + + data, status_code, headers = api_instance.update_audience_group_authority_level_with_http_info(update_audience_group_authority_level_request) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::ManageAudience::ApiError => e + puts "Error when calling ManageAudienceApi->update_audience_group_authority_level_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **update_audience_group_authority_level_request** | [**UpdateAudienceGroupAuthorityLevelRequest**](UpdateAudienceGroupAuthorityLevelRequest.md) | | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## update_audience_group_description + +> update_audience_group_description(audience_group_id, update_audience_group_description_request) + + + +Renames an existing audience. + +### Examples + +```ruby +require 'time' +require 'line_client_manage_audience' +# setup authorization +LINE::Client::ManageAudience.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::ManageAudience::ManageAudienceApi.new +audience_group_id = 789 # Integer | The audience ID. +update_audience_group_description_request = LINE::Client::ManageAudience::UpdateAudienceGroupDescriptionRequest.new # UpdateAudienceGroupDescriptionRequest | + +begin + + api_instance.update_audience_group_description(audience_group_id, update_audience_group_description_request) +rescue LINE::Client::ManageAudience::ApiError => e + puts "Error when calling ManageAudienceApi->update_audience_group_description: #{e}" +end +``` + +#### Using the update_audience_group_description_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> update_audience_group_description_with_http_info(audience_group_id, update_audience_group_description_request) + +```ruby +begin + + data, status_code, headers = api_instance.update_audience_group_description_with_http_info(audience_group_id, update_audience_group_description_request) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::ManageAudience::ApiError => e + puts "Error when calling ManageAudienceApi->update_audience_group_description_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **audience_group_id** | **Integer** | The audience ID. | | +| **update_audience_group_description_request** | [**UpdateAudienceGroupDescriptionRequest**](UpdateAudienceGroupDescriptionRequest.md) | | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + diff --git a/lib/clients/manage-audience/docs/ManageAudienceBlobApi.md b/lib/clients/manage-audience/docs/ManageAudienceBlobApi.md new file mode 100644 index 00000000..358fde38 --- /dev/null +++ b/lib/clients/manage-audience/docs/ManageAudienceBlobApi.md @@ -0,0 +1,160 @@ +# LINE::Client::ManageAudience::ManageAudienceBlobApi + +All URIs are relative to *https://api.line.me* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**add_user_ids_to_audience**](ManageAudienceBlobApi.md#add_user_ids_to_audience) | **PUT** /v2/bot/audienceGroup/upload/byFile | | +| [**create_audience_for_uploading_user_ids**](ManageAudienceBlobApi.md#create_audience_for_uploading_user_ids) | **POST** /v2/bot/audienceGroup/upload/byFile | | + + +## add_user_ids_to_audience + +> add_user_ids_to_audience(file, opts) + + + +Add user IDs or Identifiers for Advertisers (IFAs) to an audience for uploading user IDs (by file). + +### Examples + +```ruby +require 'time' +require 'line_client_manage_audience' +# setup authorization +LINE::Client::ManageAudience.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::ManageAudience::ManageAudienceBlobApi.new +file = File.new('/path/to/some/file') # File | A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 +opts = { + audience_group_id: 789, # Integer | The audience ID. + upload_description: 'upload_description_example' # String | The description to register with the job +} + +begin + + api_instance.add_user_ids_to_audience(file, opts) +rescue LINE::Client::ManageAudience::ApiError => e + puts "Error when calling ManageAudienceBlobApi->add_user_ids_to_audience: #{e}" +end +``` + +#### Using the add_user_ids_to_audience_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> add_user_ids_to_audience_with_http_info(file, opts) + +```ruby +begin + + data, status_code, headers = api_instance.add_user_ids_to_audience_with_http_info(file, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::ManageAudience::ApiError => e + puts "Error when calling ManageAudienceBlobApi->add_user_ids_to_audience_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **file** | **File** | A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 | | +| **audience_group_id** | **Integer** | The audience ID. | [optional] | +| **upload_description** | **String** | The description to register with the job | [optional] | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: multipart/form-data +- **Accept**: Not defined + + +## create_audience_for_uploading_user_ids + +> create_audience_for_uploading_user_ids(file, opts) + + + +Create audience for uploading user IDs (by file). + +### Examples + +```ruby +require 'time' +require 'line_client_manage_audience' +# setup authorization +LINE::Client::ManageAudience.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::ManageAudience::ManageAudienceBlobApi.new +file = File.new('/path/to/some/file') # File | A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 +opts = { + description: 'description_example', # String | The audience's name. This is case-insensitive, meaning AUDIENCE and audience are considered identical. Max character limit: 120 + is_ifa_audience: true, # Boolean | To specify recipients by IFAs: set `true`. To specify recipients by user IDs: set `false` or omit isIfaAudience property. + upload_description: 'upload_description_example' # String | The description to register for the job (in `jobs[].description`). +} + +begin + + result = api_instance.create_audience_for_uploading_user_ids(file, opts) + p result +rescue LINE::Client::ManageAudience::ApiError => e + puts "Error when calling ManageAudienceBlobApi->create_audience_for_uploading_user_ids: #{e}" +end +``` + +#### Using the create_audience_for_uploading_user_ids_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_audience_for_uploading_user_ids_with_http_info(file, opts) + +```ruby +begin + + data, status_code, headers = api_instance.create_audience_for_uploading_user_ids_with_http_info(file, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::ManageAudience::ApiError => e + puts "Error when calling ManageAudienceBlobApi->create_audience_for_uploading_user_ids_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **file** | **File** | A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 | | +| **description** | **String** | The audience's name. This is case-insensitive, meaning AUDIENCE and audience are considered identical. Max character limit: 120 | [optional] | +| **is_ifa_audience** | **Boolean** | To specify recipients by IFAs: set `true`. To specify recipients by user IDs: set `false` or omit isIfaAudience property. | [optional] | +| **upload_description** | **String** | The description to register for the job (in `jobs[].description`). | [optional] | + +### Return type + +[**CreateAudienceGroupResponse**](CreateAudienceGroupResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: multipart/form-data +- **Accept**: application/json + diff --git a/lib/clients/manage-audience/docs/UpdateAudienceGroupAuthorityLevelRequest.md b/lib/clients/manage-audience/docs/UpdateAudienceGroupAuthorityLevelRequest.md new file mode 100644 index 00000000..6a8a03d4 --- /dev/null +++ b/lib/clients/manage-audience/docs/UpdateAudienceGroupAuthorityLevelRequest.md @@ -0,0 +1,18 @@ +# LINE::Client::ManageAudience::UpdateAudienceGroupAuthorityLevelRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **authority_level** | [**AudienceGroupAuthorityLevel**](AudienceGroupAuthorityLevel.md) | | [optional] | + +## Example + +```ruby +require 'line_client_manage_audience' + +instance = LINE::Client::ManageAudience::UpdateAudienceGroupAuthorityLevelRequest.new( + authority_level: null +) +``` + diff --git a/lib/clients/manage-audience/docs/UpdateAudienceGroupDescriptionRequest.md b/lib/clients/manage-audience/docs/UpdateAudienceGroupDescriptionRequest.md new file mode 100644 index 00000000..61c5e17a --- /dev/null +++ b/lib/clients/manage-audience/docs/UpdateAudienceGroupDescriptionRequest.md @@ -0,0 +1,18 @@ +# LINE::Client::ManageAudience::UpdateAudienceGroupDescriptionRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **description** | **String** | The audience's name. This is case-insensitive, meaning AUDIENCE and audience are considered identical. Max character limit: 120 | [optional] | + +## Example + +```ruby +require 'line_client_manage_audience' + +instance = LINE::Client::ManageAudience::UpdateAudienceGroupDescriptionRequest.new( + description: null +) +``` + diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience.rb b/lib/clients/manage-audience/lib/line_client_manage_audience.rb new file mode 100644 index 00000000..80ea08e9 --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience.rb @@ -0,0 +1,67 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +# Common files +require 'line_client_manage_audience/api_client' +require 'line_client_manage_audience/api_error' +require 'line_client_manage_audience/version' +require 'line_client_manage_audience/configuration' + +# Models +require 'line_client_manage_audience/models/add_audience_to_audience_group_request' +require 'line_client_manage_audience/models/audience' +require 'line_client_manage_audience/models/audience_group' +require 'line_client_manage_audience/models/audience_group_authority_level' +require 'line_client_manage_audience/models/audience_group_create_route' +require 'line_client_manage_audience/models/audience_group_failed_type' +require 'line_client_manage_audience/models/audience_group_job' +require 'line_client_manage_audience/models/audience_group_job_failed_type' +require 'line_client_manage_audience/models/audience_group_job_status' +require 'line_client_manage_audience/models/audience_group_job_type' +require 'line_client_manage_audience/models/audience_group_permission' +require 'line_client_manage_audience/models/audience_group_status' +require 'line_client_manage_audience/models/audience_group_type' +require 'line_client_manage_audience/models/create_audience_group_request' +require 'line_client_manage_audience/models/create_audience_group_response' +require 'line_client_manage_audience/models/create_click_based_audience_group_request' +require 'line_client_manage_audience/models/create_click_based_audience_group_response' +require 'line_client_manage_audience/models/create_imp_based_audience_group_request' +require 'line_client_manage_audience/models/create_imp_based_audience_group_response' +require 'line_client_manage_audience/models/error_detail' +require 'line_client_manage_audience/models/error_response' +require 'line_client_manage_audience/models/get_audience_data_response' +require 'line_client_manage_audience/models/get_audience_group_authority_level_response' +require 'line_client_manage_audience/models/get_audience_groups_response' +require 'line_client_manage_audience/models/update_audience_group_authority_level_request' +require 'line_client_manage_audience/models/update_audience_group_description_request' + +# APIs +require 'line_client_manage_audience/api/manage_audience_api' +require 'line_client_manage_audience/api/manage_audience_blob_api' + +module LINE::Client::ManageAudience + class << self + # Customize default settings for the SDK using block. + # LINE::Client::ManageAudience.configure do |config| + # config.username = "xxx" + # config.password = "xxx" + # end + # If no block given, return the default Configuration object. + def configure + if block_given? + yield(Configuration.default) + else + Configuration.default + end + end + end +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/api/manage_audience_api.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/api/manage_audience_api.rb new file mode 100644 index 00000000..02494e39 --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/api/manage_audience_api.rb @@ -0,0 +1,737 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'cgi' + +module LINE::Client::ManageAudience + class ManageAudienceApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Activate audience + # @param audience_group_id [Integer] The audience ID. + # @param [Hash] opts the optional parameters + # @return [nil] + def activate_audience_group(audience_group_id, opts = {}) + activate_audience_group_with_http_info(audience_group_id, opts) + nil + end + + # Activate audience + # @param audience_group_id [Integer] The audience ID. + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def activate_audience_group_with_http_info(audience_group_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ManageAudienceApi.activate_audience_group ...' + end + # verify the required parameter 'audience_group_id' is set + if @api_client.config.client_side_validation && audience_group_id.nil? + fail ArgumentError, "Missing the required parameter 'audience_group_id' when calling ManageAudienceApi.activate_audience_group" + end + # resource path + local_var_path = '/v2/bot/audienceGroup/{audienceGroupId}/activate'.sub('{' + 'audienceGroupId' + '}', CGI.escape(audience_group_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"ManageAudienceApi.activate_audience_group", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ManageAudienceApi#activate_audience_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Add user IDs or Identifiers for Advertisers (IFAs) to an audience for uploading user IDs (by JSON) + # @param add_audience_to_audience_group_request [AddAudienceToAudienceGroupRequest] + # @param [Hash] opts the optional parameters + # @return [nil] + def add_audience_to_audience_group(add_audience_to_audience_group_request, opts = {}) + add_audience_to_audience_group_with_http_info(add_audience_to_audience_group_request, opts) + nil + end + + # Add user IDs or Identifiers for Advertisers (IFAs) to an audience for uploading user IDs (by JSON) + # @param add_audience_to_audience_group_request [AddAudienceToAudienceGroupRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def add_audience_to_audience_group_with_http_info(add_audience_to_audience_group_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ManageAudienceApi.add_audience_to_audience_group ...' + end + # verify the required parameter 'add_audience_to_audience_group_request' is set + if @api_client.config.client_side_validation && add_audience_to_audience_group_request.nil? + fail ArgumentError, "Missing the required parameter 'add_audience_to_audience_group_request' when calling ManageAudienceApi.add_audience_to_audience_group" + end + # resource path + local_var_path = '/v2/bot/audienceGroup/upload' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(add_audience_to_audience_group_request) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"ManageAudienceApi.add_audience_to_audience_group", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ManageAudienceApi#add_audience_to_audience_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create audience for uploading user IDs (by JSON) + # @param create_audience_group_request [CreateAudienceGroupRequest] + # @param [Hash] opts the optional parameters + # @return [CreateAudienceGroupResponse] + def create_audience_group(create_audience_group_request, opts = {}) + data, _status_code, _headers = create_audience_group_with_http_info(create_audience_group_request, opts) + data + end + + # Create audience for uploading user IDs (by JSON) + # @param create_audience_group_request [CreateAudienceGroupRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(CreateAudienceGroupResponse, Integer, Hash)>] CreateAudienceGroupResponse data, response status code and response headers + def create_audience_group_with_http_info(create_audience_group_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ManageAudienceApi.create_audience_group ...' + end + # verify the required parameter 'create_audience_group_request' is set + if @api_client.config.client_side_validation && create_audience_group_request.nil? + fail ArgumentError, "Missing the required parameter 'create_audience_group_request' when calling ManageAudienceApi.create_audience_group" + end + # resource path + local_var_path = '/v2/bot/audienceGroup/upload' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(create_audience_group_request) + + # return_type + return_type = opts[:debug_return_type] || 'CreateAudienceGroupResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"ManageAudienceApi.create_audience_group", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ManageAudienceApi#create_audience_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create audience for click-based retargeting + # @param create_click_based_audience_group_request [CreateClickBasedAudienceGroupRequest] + # @param [Hash] opts the optional parameters + # @return [CreateClickBasedAudienceGroupResponse] + def create_click_based_audience_group(create_click_based_audience_group_request, opts = {}) + data, _status_code, _headers = create_click_based_audience_group_with_http_info(create_click_based_audience_group_request, opts) + data + end + + # Create audience for click-based retargeting + # @param create_click_based_audience_group_request [CreateClickBasedAudienceGroupRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(CreateClickBasedAudienceGroupResponse, Integer, Hash)>] CreateClickBasedAudienceGroupResponse data, response status code and response headers + def create_click_based_audience_group_with_http_info(create_click_based_audience_group_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ManageAudienceApi.create_click_based_audience_group ...' + end + # verify the required parameter 'create_click_based_audience_group_request' is set + if @api_client.config.client_side_validation && create_click_based_audience_group_request.nil? + fail ArgumentError, "Missing the required parameter 'create_click_based_audience_group_request' when calling ManageAudienceApi.create_click_based_audience_group" + end + # resource path + local_var_path = '/v2/bot/audienceGroup/click' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(create_click_based_audience_group_request) + + # return_type + return_type = opts[:debug_return_type] || 'CreateClickBasedAudienceGroupResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"ManageAudienceApi.create_click_based_audience_group", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ManageAudienceApi#create_click_based_audience_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create audience for impression-based retargeting + # @param create_imp_based_audience_group_request [CreateImpBasedAudienceGroupRequest] + # @param [Hash] opts the optional parameters + # @return [CreateImpBasedAudienceGroupResponse] + def create_imp_based_audience_group(create_imp_based_audience_group_request, opts = {}) + data, _status_code, _headers = create_imp_based_audience_group_with_http_info(create_imp_based_audience_group_request, opts) + data + end + + # Create audience for impression-based retargeting + # @param create_imp_based_audience_group_request [CreateImpBasedAudienceGroupRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(CreateImpBasedAudienceGroupResponse, Integer, Hash)>] CreateImpBasedAudienceGroupResponse data, response status code and response headers + def create_imp_based_audience_group_with_http_info(create_imp_based_audience_group_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ManageAudienceApi.create_imp_based_audience_group ...' + end + # verify the required parameter 'create_imp_based_audience_group_request' is set + if @api_client.config.client_side_validation && create_imp_based_audience_group_request.nil? + fail ArgumentError, "Missing the required parameter 'create_imp_based_audience_group_request' when calling ManageAudienceApi.create_imp_based_audience_group" + end + # resource path + local_var_path = '/v2/bot/audienceGroup/imp' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(create_imp_based_audience_group_request) + + # return_type + return_type = opts[:debug_return_type] || 'CreateImpBasedAudienceGroupResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"ManageAudienceApi.create_imp_based_audience_group", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ManageAudienceApi#create_imp_based_audience_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete audience + # @param audience_group_id [Integer] The audience ID. + # @param [Hash] opts the optional parameters + # @return [nil] + def delete_audience_group(audience_group_id, opts = {}) + delete_audience_group_with_http_info(audience_group_id, opts) + nil + end + + # Delete audience + # @param audience_group_id [Integer] The audience ID. + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_audience_group_with_http_info(audience_group_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ManageAudienceApi.delete_audience_group ...' + end + # verify the required parameter 'audience_group_id' is set + if @api_client.config.client_side_validation && audience_group_id.nil? + fail ArgumentError, "Missing the required parameter 'audience_group_id' when calling ManageAudienceApi.delete_audience_group" + end + # resource path + local_var_path = '/v2/bot/audienceGroup/{audienceGroupId}'.sub('{' + 'audienceGroupId' + '}', CGI.escape(audience_group_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"ManageAudienceApi.delete_audience_group", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ManageAudienceApi#delete_audience_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Gets audience data. + # @param audience_group_id [Integer] The audience ID. + # @param [Hash] opts the optional parameters + # @return [GetAudienceDataResponse] + def get_audience_data(audience_group_id, opts = {}) + data, _status_code, _headers = get_audience_data_with_http_info(audience_group_id, opts) + data + end + + # Gets audience data. + # @param audience_group_id [Integer] The audience ID. + # @param [Hash] opts the optional parameters + # @return [Array<(GetAudienceDataResponse, Integer, Hash)>] GetAudienceDataResponse data, response status code and response headers + def get_audience_data_with_http_info(audience_group_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ManageAudienceApi.get_audience_data ...' + end + # verify the required parameter 'audience_group_id' is set + if @api_client.config.client_side_validation && audience_group_id.nil? + fail ArgumentError, "Missing the required parameter 'audience_group_id' when calling ManageAudienceApi.get_audience_data" + end + # resource path + local_var_path = '/v2/bot/audienceGroup/{audienceGroupId}'.sub('{' + 'audienceGroupId' + '}', CGI.escape(audience_group_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetAudienceDataResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"ManageAudienceApi.get_audience_data", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ManageAudienceApi#get_audience_data\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get the authority level of the audience + # @param [Hash] opts the optional parameters + # @return [GetAudienceGroupAuthorityLevelResponse] + def get_audience_group_authority_level(opts = {}) + data, _status_code, _headers = get_audience_group_authority_level_with_http_info(opts) + data + end + + # Get the authority level of the audience + # @param [Hash] opts the optional parameters + # @return [Array<(GetAudienceGroupAuthorityLevelResponse, Integer, Hash)>] GetAudienceGroupAuthorityLevelResponse data, response status code and response headers + def get_audience_group_authority_level_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ManageAudienceApi.get_audience_group_authority_level ...' + end + # resource path + local_var_path = '/v2/bot/audienceGroup/authorityLevel' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetAudienceGroupAuthorityLevelResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"ManageAudienceApi.get_audience_group_authority_level", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ManageAudienceApi#get_audience_group_authority_level\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Gets data for more than one audience. + # @param page [Integer] The page to return when getting (paginated) results. Must be 1 or higher. + # @param [Hash] opts the optional parameters + # @option opts [String] :description The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. + # @option opts [AudienceGroupStatus] :status The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. + # @option opts [Integer] :size The number of audiences per page. Default: 20 Max: 40 + # @option opts [Boolean] :includes_external_public_groups true (default): Get public audiences created in all channels linked to the same bot. false: Get audiences created in the same channel. + # @option opts [AudienceGroupCreateRoute] :create_route How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. + # @return [GetAudienceGroupsResponse] + def get_audience_groups(page, opts = {}) + data, _status_code, _headers = get_audience_groups_with_http_info(page, opts) + data + end + + # Gets data for more than one audience. + # @param page [Integer] The page to return when getting (paginated) results. Must be 1 or higher. + # @param [Hash] opts the optional parameters + # @option opts [String] :description The name of the audience(s) to return. You can search for partial matches. This is case-insensitive, meaning AUDIENCE and audience are considered identical. If omitted, the name of the audience(s) will not be used as a search criterion. + # @option opts [AudienceGroupStatus] :status The status of the audience(s) to return. If omitted, the status of the audience(s) will not be used as a search criterion. + # @option opts [Integer] :size The number of audiences per page. Default: 20 Max: 40 + # @option opts [Boolean] :includes_external_public_groups true (default): Get public audiences created in all channels linked to the same bot. false: Get audiences created in the same channel. + # @option opts [AudienceGroupCreateRoute] :create_route How the audience was created. If omitted, all audiences are included. `OA_MANAGER`: Return only audiences created with LINE Official Account Manager (opens new window). `MESSAGING_API`: Return only audiences created with Messaging API. + # @return [Array<(GetAudienceGroupsResponse, Integer, Hash)>] GetAudienceGroupsResponse data, response status code and response headers + def get_audience_groups_with_http_info(page, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ManageAudienceApi.get_audience_groups ...' + end + # verify the required parameter 'page' is set + if @api_client.config.client_side_validation && page.nil? + fail ArgumentError, "Missing the required parameter 'page' when calling ManageAudienceApi.get_audience_groups" + end + if @api_client.config.client_side_validation && page < 1 + fail ArgumentError, 'invalid value for "page" when calling ManageAudienceApi.get_audience_groups, must be greater than or equal to 1.' + end + + if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] > 40 + fail ArgumentError, 'invalid value for "opts[:"size"]" when calling ManageAudienceApi.get_audience_groups, must be smaller than or equal to 40.' + end + + # resource path + local_var_path = '/v2/bot/audienceGroup/list' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page'] = page + query_params[:'description'] = opts[:'description'] if !opts[:'description'].nil? + query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil? + query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil? + query_params[:'includesExternalPublicGroups'] = opts[:'includes_external_public_groups'] if !opts[:'includes_external_public_groups'].nil? + query_params[:'createRoute'] = opts[:'create_route'] if !opts[:'create_route'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetAudienceGroupsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"ManageAudienceApi.get_audience_groups", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ManageAudienceApi#get_audience_groups\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Change the authority level of the audience + # @param update_audience_group_authority_level_request [UpdateAudienceGroupAuthorityLevelRequest] + # @param [Hash] opts the optional parameters + # @return [nil] + def update_audience_group_authority_level(update_audience_group_authority_level_request, opts = {}) + update_audience_group_authority_level_with_http_info(update_audience_group_authority_level_request, opts) + nil + end + + # Change the authority level of the audience + # @param update_audience_group_authority_level_request [UpdateAudienceGroupAuthorityLevelRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def update_audience_group_authority_level_with_http_info(update_audience_group_authority_level_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ManageAudienceApi.update_audience_group_authority_level ...' + end + # verify the required parameter 'update_audience_group_authority_level_request' is set + if @api_client.config.client_side_validation && update_audience_group_authority_level_request.nil? + fail ArgumentError, "Missing the required parameter 'update_audience_group_authority_level_request' when calling ManageAudienceApi.update_audience_group_authority_level" + end + # resource path + local_var_path = '/v2/bot/audienceGroup/authorityLevel' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(update_audience_group_authority_level_request) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"ManageAudienceApi.update_audience_group_authority_level", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ManageAudienceApi#update_audience_group_authority_level\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Renames an existing audience. + # @param audience_group_id [Integer] The audience ID. + # @param update_audience_group_description_request [UpdateAudienceGroupDescriptionRequest] + # @param [Hash] opts the optional parameters + # @return [nil] + def update_audience_group_description(audience_group_id, update_audience_group_description_request, opts = {}) + update_audience_group_description_with_http_info(audience_group_id, update_audience_group_description_request, opts) + nil + end + + # Renames an existing audience. + # @param audience_group_id [Integer] The audience ID. + # @param update_audience_group_description_request [UpdateAudienceGroupDescriptionRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def update_audience_group_description_with_http_info(audience_group_id, update_audience_group_description_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ManageAudienceApi.update_audience_group_description ...' + end + # verify the required parameter 'audience_group_id' is set + if @api_client.config.client_side_validation && audience_group_id.nil? + fail ArgumentError, "Missing the required parameter 'audience_group_id' when calling ManageAudienceApi.update_audience_group_description" + end + # verify the required parameter 'update_audience_group_description_request' is set + if @api_client.config.client_side_validation && update_audience_group_description_request.nil? + fail ArgumentError, "Missing the required parameter 'update_audience_group_description_request' when calling ManageAudienceApi.update_audience_group_description" + end + # resource path + local_var_path = '/v2/bot/audienceGroup/{audienceGroupId}/updateDescription'.sub('{' + 'audienceGroupId' + '}', CGI.escape(audience_group_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(update_audience_group_description_request) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"ManageAudienceApi.update_audience_group_description", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ManageAudienceApi#update_audience_group_description\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/api/manage_audience_blob_api.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/api/manage_audience_blob_api.rb new file mode 100644 index 00000000..55cd1e0d --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/api/manage_audience_blob_api.rb @@ -0,0 +1,173 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'cgi' + +module LINE::Client::ManageAudience + class ManageAudienceBlobApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Add user IDs or Identifiers for Advertisers (IFAs) to an audience for uploading user IDs (by file). + # @param file [File] A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 + # @param [Hash] opts the optional parameters + # @option opts [Integer] :audience_group_id The audience ID. + # @option opts [String] :upload_description The description to register with the job + # @return [nil] + def add_user_ids_to_audience(file, opts = {}) + add_user_ids_to_audience_with_http_info(file, opts) + nil + end + + # Add user IDs or Identifiers for Advertisers (IFAs) to an audience for uploading user IDs (by file). + # @param file [File] A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 + # @param [Hash] opts the optional parameters + # @option opts [Integer] :audience_group_id The audience ID. + # @option opts [String] :upload_description The description to register with the job + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def add_user_ids_to_audience_with_http_info(file, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ManageAudienceBlobApi.add_user_ids_to_audience ...' + end + # verify the required parameter 'file' is set + if @api_client.config.client_side_validation && file.nil? + fail ArgumentError, "Missing the required parameter 'file' when calling ManageAudienceBlobApi.add_user_ids_to_audience" + end + # resource path + local_var_path = '/v2/bot/audienceGroup/upload/byFile' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['multipart/form-data']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + form_params['file'] = file + form_params['audienceGroupId'] = opts[:'audience_group_id'] if !opts[:'audience_group_id'].nil? + form_params['uploadDescription'] = opts[:'upload_description'] if !opts[:'upload_description'].nil? + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"ManageAudienceBlobApi.add_user_ids_to_audience", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ManageAudienceBlobApi#add_user_ids_to_audience\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create audience for uploading user IDs (by file). + # @param file [File] A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 + # @param [Hash] opts the optional parameters + # @option opts [String] :description The audience's name. This is case-insensitive, meaning AUDIENCE and audience are considered identical. Max character limit: 120 + # @option opts [Boolean] :is_ifa_audience To specify recipients by IFAs: set `true`. To specify recipients by user IDs: set `false` or omit isIfaAudience property. + # @option opts [String] :upload_description The description to register for the job (in `jobs[].description`). + # @return [CreateAudienceGroupResponse] + def create_audience_for_uploading_user_ids(file, opts = {}) + data, _status_code, _headers = create_audience_for_uploading_user_ids_with_http_info(file, opts) + data + end + + # Create audience for uploading user IDs (by file). + # @param file [File] A text file with one user ID or IFA entered per line. Specify text/plain as Content-Type. Max file number: 1 Max number: 1,500,000 + # @param [Hash] opts the optional parameters + # @option opts [String] :description The audience's name. This is case-insensitive, meaning AUDIENCE and audience are considered identical. Max character limit: 120 + # @option opts [Boolean] :is_ifa_audience To specify recipients by IFAs: set `true`. To specify recipients by user IDs: set `false` or omit isIfaAudience property. + # @option opts [String] :upload_description The description to register for the job (in `jobs[].description`). + # @return [Array<(CreateAudienceGroupResponse, Integer, Hash)>] CreateAudienceGroupResponse data, response status code and response headers + def create_audience_for_uploading_user_ids_with_http_info(file, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ManageAudienceBlobApi.create_audience_for_uploading_user_ids ...' + end + # verify the required parameter 'file' is set + if @api_client.config.client_side_validation && file.nil? + fail ArgumentError, "Missing the required parameter 'file' when calling ManageAudienceBlobApi.create_audience_for_uploading_user_ids" + end + if @api_client.config.client_side_validation && !opts[:'description'].nil? && opts[:'description'].to_s.length > 120 + fail ArgumentError, 'invalid value for "opts[:"description"]" when calling ManageAudienceBlobApi.create_audience_for_uploading_user_ids, the character length must be smaller than or equal to 120.' + end + + # resource path + local_var_path = '/v2/bot/audienceGroup/upload/byFile' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['multipart/form-data']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + form_params['file'] = file + form_params['description'] = opts[:'description'] if !opts[:'description'].nil? + form_params['isIfaAudience'] = opts[:'is_ifa_audience'] if !opts[:'is_ifa_audience'].nil? + form_params['uploadDescription'] = opts[:'upload_description'] if !opts[:'upload_description'].nil? + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'CreateAudienceGroupResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"ManageAudienceBlobApi.create_audience_for_uploading_user_ids", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ManageAudienceBlobApi#create_audience_for_uploading_user_ids\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/api_client.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/api_client.rb new file mode 100644 index 00000000..3beada4c --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/api_client.rb @@ -0,0 +1,392 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'json' +require 'logger' +require 'tempfile' +require 'time' +require 'typhoeus' + +module LINE::Client::ManageAudience + class ApiClient + # The Configuration object holding settings to be used in the API client. + attr_accessor :config + + # Defines the headers to be used in HTTP requests of all API calls by default. + # + # @return [Hash] + attr_accessor :default_headers + + # Initializes the ApiClient + # @option config [Configuration] Configuration for initializing the object, default to Configuration.default + def initialize(config = Configuration.default) + @config = config + @user_agent = "LINE-BotSDK-Ruby/2.0.0" + @default_headers = { + 'Content-Type' => 'application/json', + 'User-Agent' => @user_agent + } + end + + def self.default + @@default ||= ApiClient.new + end + + # Call an API with given options. + # + # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: + # the data deserialized from response body (could be nil), response status code and response headers. + def call_api(http_method, path, opts = {}) + request = build_request(http_method, path, opts) + response = request.run + + if @config.debugging + @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" + end + + unless response.success? + if response.timed_out? + fail ApiError.new('Connection timed out') + elsif response.code == 0 + # Errors from libcurl will be made visible here + fail ApiError.new(:code => 0, + :message => response.return_message) + else + fail ApiError.new(:code => response.code, + :response_headers => response.headers, + :response_body => response.body), + response.status_message + end + end + + if opts[:return_type] + data = deserialize(response, opts[:return_type]) + else + data = nil + end + return data, response.code, response.headers + end + + # Builds the HTTP request + # + # @param [String] http_method HTTP method/verb (e.g. POST) + # @param [String] path URL path (e.g. /account/new) + # @option opts [Hash] :header_params Header parameters + # @option opts [Hash] :query_params Query parameters + # @option opts [Hash] :form_params Query parameters + # @option opts [Object] :body HTTP body (JSON/XML) + # @return [Typhoeus::Request] A Typhoeus Request + def build_request(http_method, path, opts = {}) + url = build_request_url(path, opts) + http_method = http_method.to_sym.downcase + + header_params = @default_headers.merge(opts[:header_params] || {}) + query_params = opts[:query_params] || {} + form_params = opts[:form_params] || {} + follow_location = opts[:follow_location] || true + + update_params_for_auth! header_params, query_params, opts[:auth_names] + + # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false) + _verify_ssl_host = @config.verify_ssl_host ? 2 : 0 + + req_opts = { + :method => http_method, + :headers => header_params, + :params => query_params, + :params_encoding => @config.params_encoding, + :timeout => @config.timeout, + :ssl_verifypeer => @config.verify_ssl, + :ssl_verifyhost => _verify_ssl_host, + :sslcert => @config.cert_file, + :sslkey => @config.key_file, + :verbose => @config.debugging, + :followlocation => follow_location + } + + # set custom cert, if provided + req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert + + if [:post, :patch, :put, :delete].include?(http_method) + req_body = build_request_body(header_params, form_params, opts[:body]) + req_opts.update :body => req_body + if @config.debugging + @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n" + end + end + + request = Typhoeus::Request.new(url, req_opts) + download_file(request) if opts[:return_type] == 'File' + request + end + + # Builds the HTTP request body + # + # @param [Hash] header_params Header parameters + # @param [Hash] form_params Query parameters + # @param [Object] body HTTP body (JSON/XML) + # @return [String] HTTP body data in the form of string + def build_request_body(header_params, form_params, body) + # http form + if header_params['Content-Type'] == 'application/x-www-form-urlencoded' || + header_params['Content-Type'] == 'multipart/form-data' + data = {} + form_params.each do |key, value| + case value + when ::File, ::Array, nil + # let typhoeus handle File, Array and nil parameters + data[key] = value + else + data[key] = value.to_s + end + end + elsif body + data = body.is_a?(String) ? body : body.to_json + else + data = nil + end + data + end + + # Save response body into a file in (the defined) temporary folder, using the filename + # from the "Content-Disposition" header if provided, otherwise a random filename. + # The response body is written to the file in chunks in order to handle files which + # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby + # process can use. + # + # @see Configuration#temp_folder_path + def download_file(request) + tempfile = nil + encoding = nil + request.on_headers do |response| + content_disposition = response.headers['Content-Disposition'] + if content_disposition && content_disposition =~ /filename=/i + filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1] + prefix = sanitize_filename(filename) + else + prefix = 'download-' + end + prefix = prefix + '-' unless prefix.end_with?('-') + encoding = response.body.encoding + tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) + @tempfile = tempfile + end + request.on_body do |chunk| + chunk.force_encoding(encoding) + tempfile.write(chunk) + end + request.on_complete do |response| + if tempfile + tempfile.close + @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ + "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ + "will be deleted automatically with GC. It's also recommended to delete the temp file "\ + "explicitly with `tempfile.delete`" + end + end + end + + # Check if the given MIME is a JSON MIME. + # JSON MIME examples: + # application/json + # application/json; charset=UTF8 + # APPLICATION/JSON + # */* + # @param [String] mime MIME + # @return [Boolean] True if the MIME is application/json + def json_mime?(mime) + (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + end + + # Deserialize the response to the given return type. + # + # @param [Response] response HTTP response + # @param [String] return_type some examples: "User", "Array", "Hash" + def deserialize(response, return_type) + body = response.body + + # handle file downloading - return the File instance processed in request callbacks + # note that response body is empty when the file is written in chunks in request on_body callback + return @tempfile if return_type == 'File' + + return nil if body.nil? || body.empty? + + # return response body directly for String return type + return body if return_type == 'String' + + # ensuring a default content type + content_type = response.headers['Content-Type'] || 'application/json' + + fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type) + + begin + data = JSON.parse("[#{body}]", :symbolize_names => true)[0] + rescue JSON::ParserError => e + if %w(String Date Time).include?(return_type) + data = body + else + raise e + end + end + + convert_to_type data, return_type + end + + # Convert data to the given return type. + # @param [Object] data Data to be converted + # @param [String] return_type Return type + # @return [Mixed] Data in a particular type + def convert_to_type(data, return_type) + return nil if data.nil? + case return_type + when 'String' + data.to_s + when 'Integer' + data.to_i + when 'Float' + data.to_f + when 'Boolean' + data == true + when 'Time' + # parse date time (expecting ISO 8601 format) + Time.parse data + when 'Date' + # parse date time (expecting ISO 8601 format) + Date.parse data + when 'Object' + # generic object (usually a Hash), return directly + data + when /\AArray<(.+)>\z/ + # e.g. Array + sub_type = $1 + data.map { |item| convert_to_type(item, sub_type) } + when /\AHash\\z/ + # e.g. Hash + sub_type = $1 + {}.tap do |hash| + data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } + end + else + # models (e.g. Pet) or oneOf + klass = LINE::Client::ManageAudience.const_get(return_type) + klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + end + end + + # Sanitize filename by removing path. + # e.g. ../../sun.gif becomes sun.gif + # + # @param [String] filename the filename to be sanitized + # @return [String] the sanitized filename + def sanitize_filename(filename) + filename.gsub(/.*[\/\\]/, '') + end + + def build_request_url(path, opts = {}) + # Add leading and trailing slashes to path + path = "/#{path}".gsub(/\/+/, '/') + @config.base_url(opts[:operation]) + path + end + + # Update header and query params based on authentication settings. + # + # @param [Hash] header_params Header parameters + # @param [Hash] query_params Query parameters + # @param [String] auth_names Authentication scheme name + def update_params_for_auth!(header_params, query_params, auth_names) + Array(auth_names).each do |auth_name| + auth_setting = @config.auth_settings[auth_name] + next unless auth_setting + case auth_setting[:in] + when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] + when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] + else fail ArgumentError, 'Authentication token must be in `query` or `header`' + end + end + end + + # Sets user agent in HTTP header + # + # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0) + def user_agent=(user_agent) + @user_agent = user_agent + @default_headers['User-Agent'] = @user_agent + end + + # Return Accept header based on an array of accepts provided. + # @param [Array] accepts array for Accept + # @return [String] the Accept header (e.g. application/json) + def select_header_accept(accepts) + return nil if accepts.nil? || accepts.empty? + # use JSON when present, otherwise use all of the provided + json_accept = accepts.find { |s| json_mime?(s) } + json_accept || accepts.join(',') + end + + # Return Content-Type header based on an array of content types provided. + # @param [Array] content_types array for Content-Type + # @return [String] the Content-Type header (e.g. application/json) + def select_header_content_type(content_types) + # return nil by default + return if content_types.nil? || content_types.empty? + # use JSON when present, otherwise use the first one + json_content_type = content_types.find { |s| json_mime?(s) } + json_content_type || content_types.first + end + + # Convert object (array, hash, object, etc) to JSON string. + # @param [Object] model object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_http_body(model) + return model if model.nil? || model.is_a?(String) + local_body = nil + if model.is_a?(Array) + local_body = model.map { |m| object_to_hash(m) } + else + local_body = object_to_hash(model) + end + local_body.to_json + end + + # Convert object(non-array) to hash. + # @param [Object] obj object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_hash(obj) + if obj.respond_to?(:to_hash) + obj.to_hash + else + obj + end + end + + # Build parameter value according to the given collection format. + # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi + def build_collection_param(param, collection_format) + case collection_format + when :csv + param.join(',') + when :ssv + param.join(' ') + when :tsv + param.join("\t") + when :pipes + param.join('|') + when :multi + # return the array directly as typhoeus will handle it as expected + param + else + fail "unknown collection format: #{collection_format.inspect}" + end + end + end +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/api_error.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/api_error.rb new file mode 100644 index 00000000..ca5565da --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/api_error.rb @@ -0,0 +1,58 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::ManageAudience + class ApiError < StandardError + attr_reader :code, :response_headers, :response_body + + # Usage examples: + # ApiError.new + # ApiError.new("message") + # ApiError.new(:code => 500, :response_headers => {}, :response_body => "") + # ApiError.new(:code => 404, :message => "Not Found") + def initialize(arg = nil) + if arg.is_a? Hash + if arg.key?(:message) || arg.key?('message') + super(arg[:message] || arg['message']) + else + super arg + end + + arg.each do |k, v| + instance_variable_set "@#{k}", v + end + else + super arg + @message = arg + end + end + + # Override to_s to display a friendly error message + def to_s + message + end + + def message + if @message.nil? + msg = "Error message: the server returns an error" + else + msg = @message + end + + msg += "\nHTTP status code: #{code}" if code + msg += "\nResponse headers: #{response_headers}" if response_headers + msg += "\nResponse body: #{response_body}" if response_body + + msg + end + end +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/configuration.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/configuration.rb new file mode 100644 index 00000000..c9ea6025 --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/configuration.rb @@ -0,0 +1,309 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::ManageAudience + class Configuration + # Defines url scheme + attr_accessor :scheme + + # Defines url host + attr_accessor :host + + # Defines url base path + attr_accessor :base_path + + # Define server configuration index + attr_accessor :server_index + + # Define server operation configuration index + attr_accessor :server_operation_index + + # Default server variables + attr_accessor :server_variables + + # Default server operation variables + attr_accessor :server_operation_variables + + # Defines API keys used with API Key authentications. + # + # @return [Hash] key: parameter name, value: parameter value (API key) + # + # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string) + # config.api_key['api_key'] = 'xxx' + attr_accessor :api_key + + # Defines API key prefixes used with API Key authentications. + # + # @return [Hash] key: parameter name, value: API key prefix + # + # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers) + # config.api_key_prefix['api_key'] = 'Token' + attr_accessor :api_key_prefix + + # Defines the username used with HTTP basic authentication. + # + # @return [String] + attr_accessor :username + + # Defines the password used with HTTP basic authentication. + # + # @return [String] + attr_accessor :password + + # Defines the access token (Bearer) used with OAuth2. + attr_accessor :access_token + + # Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2. + # Overrides the access_token if set + # @return [Proc] + attr_accessor :access_token_getter + + # Set this to return data as binary instead of downloading a temp file. When enabled (set to true) + # HTTP responses with return type `File` will be returned as a stream of binary data. + # Default to false. + attr_accessor :return_binary_data + + # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response + # details will be logged with `logger.debug` (see the `logger` attribute). + # Default to false. + # + # @return [true, false] + attr_accessor :debugging + + # Defines the logger used for debugging. + # Default to `Rails.logger` (when in Rails) or logging to STDOUT. + # + # @return [#debug] + attr_accessor :logger + + # Defines the temporary folder to store downloaded files + # (for API endpoints that have file response). + # Default to use `Tempfile`. + # + # @return [String] + attr_accessor :temp_folder_path + + # The time limit for HTTP request in seconds. + # Default to 0 (never times out). + attr_accessor :timeout + + # Set this to false to skip client side validation in the operation. + # Default to true. + # @return [true, false] + attr_accessor :client_side_validation + + ### TLS/SSL setting + # Set this to false to skip verifying SSL certificate when calling API from https server. + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl + + ### TLS/SSL setting + # Set this to false to skip verifying SSL host name + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl_host + + ### TLS/SSL setting + # Set this to customize the certificate file to verify the peer. + # + # @return [String] the path to the certificate file + # + # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code: + # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145 + attr_accessor :ssl_ca_cert + + ### TLS/SSL setting + # Client certificate file (for client certificate) + attr_accessor :cert_file + + ### TLS/SSL setting + # Client private key file (for client certificate) + attr_accessor :key_file + + # Set this to customize parameters encoding of array parameter with multi collectionFormat. + # Default to nil. + # + # @see The params_encoding option of Ethon. Related source code: + # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 + attr_accessor :params_encoding + + + attr_accessor :inject_format + + attr_accessor :force_ending_format + + def initialize + @scheme = 'https' + @host = 'api.line.me' + @base_path = '' + @server_index = nil + @server_operation_index = {} + @server_variables = {} + @server_operation_variables = {} + @api_key = {} + @api_key_prefix = {} + @client_side_validation = true + @verify_ssl = true + @verify_ssl_host = true + @cert_file = nil + @key_file = nil + @timeout = 0 + @params_encoding = nil + @debugging = false + @inject_format = false + @force_ending_format = false + @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) + + yield(self) if block_given? + end + + # The default Configuration object. + def self.default + @@default ||= Configuration.new + end + + def configure + yield(self) if block_given? + end + + def scheme=(scheme) + # remove :// from scheme + @scheme = scheme.sub(/:\/\//, '') + end + + def host=(host) + # remove http(s):// and anything after a slash + @host = host.sub(/https?:\/\//, '').split('/').first + end + + def base_path=(base_path) + # Add leading and trailing slashes to base_path + @base_path = "/#{base_path}".gsub(/\/+/, '/') + @base_path = '' if @base_path == '/' + end + + # Returns base URL for specified operation based on server settings + def base_url(operation = nil) + if operation_server_settings.key?(operation) then + index = server_operation_index.fetch(operation, server_index) + server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) + else + server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil) + end + end + + # Gets API key (with prefix if set). + # @param [String] param_name the parameter name of API key auth + def api_key_with_prefix(param_name, param_alias = nil) + key = @api_key[param_name] + key = @api_key.fetch(param_alias, key) unless param_alias.nil? + if @api_key_prefix[param_name] + "#{@api_key_prefix[param_name]} #{key}" + else + key + end + end + + # Gets access_token using access_token_getter or uses the static access_token + def access_token_with_refresh + return access_token if access_token_getter.nil? + access_token_getter.call + end + + # Gets Basic Auth token string + def basic_auth_token + 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") + end + + # Returns Auth Settings hash for api client. + def auth_settings + { + 'Bearer' => + { + type: 'bearer', + in: 'header', + key: 'Authorization', + value: "Bearer #{access_token_with_refresh}" + }, + } + end + + # Returns an array of Server setting + def server_settings + [ + { + url: "https://api.line.me", + description: "No description provided", + } + ] + end + + def operation_server_settings + { + "ManageAudienceBlobApi.add_user_ids_to_audience": [ + { + url: "https://api-data.line.me", + description: "No description provided", + } + ], + "ManageAudienceBlobApi.create_audience_for_uploading_user_ids": [ + { + url: "https://api-data.line.me", + description: "No description provided", + } + ], + } + end + + # Returns URL based on server settings + # + # @param index array index of the server settings + # @param variables hash of variable and the corresponding value + def server_url(index, variables = {}, servers = nil) + servers = server_settings if servers == nil + + # check array index out of bound + if (index.nil? || index < 0 || index >= servers.size) + fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}" + end + + server = servers[index] + url = server[:url] + + return url unless server.key? :variables + + # go through variable and assign a value + server[:variables].each do |name, variable| + if variables.key?(name) + if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name])) + url.gsub! "{" + name.to_s + "}", variables[name] + else + fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}." + end + else + # use default value + url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] + end + end + + url + end + + end +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/models/add_audience_to_audience_group_request.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/models/add_audience_to_audience_group_request.rb new file mode 100644 index 00000000..06175a09 --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/models/add_audience_to_audience_group_request.rb @@ -0,0 +1,262 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ManageAudience + # Add user IDs or Identifiers for Advertisers (IFAs) to an audience for uploading user IDs (by JSON) + class AddAudienceToAudienceGroupRequest + # The audience ID. + attr_accessor :audience_group_id + + # The audience's name. + attr_accessor :upload_description + + # An array of up to 10,000 user IDs or IFAs. + attr_accessor :audiences + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'audience_group_id' => :'audienceGroupId', + :'upload_description' => :'uploadDescription', + :'audiences' => :'audiences' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'audience_group_id' => :'Integer', + :'upload_description' => :'String', + :'audiences' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::ManageAudience::AddAudienceToAudienceGroupRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::ManageAudience::AddAudienceToAudienceGroupRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'audience_group_id') + self.audience_group_id = attributes[:'audience_group_id'] + end + + if attributes.key?(:'upload_description') + self.upload_description = attributes[:'upload_description'] + end + + if attributes.key?(:'audiences') + if (value = attributes[:'audiences']).is_a?(Array) + self.audiences = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@audiences.nil? && @audiences.length > 10000 + invalid_properties.push('invalid value for "audiences", number of items must be less than or equal to 10000.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@audiences.nil? && @audiences.length > 10000 + true + end + + # Custom attribute writer method with validation + # @param [Object] audiences Value to be assigned + def audiences=(audiences) + if audiences.nil? + fail ArgumentError, 'audiences cannot be nil' + end + + if audiences.length > 10000 + fail ArgumentError, 'invalid value for "audiences", number of items must be less than or equal to 10000.' + end + + @audiences = audiences + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + audience_group_id == o.audience_group_id && + upload_description == o.upload_description && + audiences == o.audiences + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [audience_group_id, upload_description, audiences].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::ManageAudience.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience.rb new file mode 100644 index 00000000..69516172 --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience.rb @@ -0,0 +1,221 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ManageAudience + # Audience + class Audience + # A user ID or IFA. You can specify an empty array. + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::ManageAudience::Audience` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::ManageAudience::Audience`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::ManageAudience.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group.rb new file mode 100644 index 00000000..cb824c94 --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group.rb @@ -0,0 +1,349 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ManageAudience + # Audience group + class AudienceGroup + # The audience ID. + attr_accessor :audience_group_id + + attr_accessor :type + + # The audience's name. + attr_accessor :description + + attr_accessor :status + + attr_accessor :failed_type + + # The number of users included in the audience. + attr_accessor :audience_count + + # When the audience was created (in UNIX time). + attr_accessor :created + + # The request ID that was specified when the audience was created. This is only included when `audienceGroup.type` is CLICK or IMP. + attr_accessor :request_id + + # The URL that was specified when the audience was created. This is only included when `audienceGroup.type` is CLICK and link URL is specified. + attr_accessor :click_url + + # The value indicating the type of account to be sent, as specified when creating the audience for uploading user IDs. + attr_accessor :is_ifa_audience + + attr_accessor :permission + + attr_accessor :create_route + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'audience_group_id' => :'audienceGroupId', + :'type' => :'type', + :'description' => :'description', + :'status' => :'status', + :'failed_type' => :'failedType', + :'audience_count' => :'audienceCount', + :'created' => :'created', + :'request_id' => :'requestId', + :'click_url' => :'clickUrl', + :'is_ifa_audience' => :'isIfaAudience', + :'permission' => :'permission', + :'create_route' => :'createRoute' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'audience_group_id' => :'Integer', + :'type' => :'AudienceGroupType', + :'description' => :'String', + :'status' => :'AudienceGroupStatus', + :'failed_type' => :'AudienceGroupFailedType', + :'audience_count' => :'Integer', + :'created' => :'Integer', + :'request_id' => :'String', + :'click_url' => :'String', + :'is_ifa_audience' => :'Boolean', + :'permission' => :'AudienceGroupPermission', + :'create_route' => :'AudienceGroupCreateRoute' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'failed_type', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::ManageAudience::AudienceGroup` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::ManageAudience::AudienceGroup`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'audience_group_id') + self.audience_group_id = attributes[:'audience_group_id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'failed_type') + self.failed_type = attributes[:'failed_type'] + end + + if attributes.key?(:'audience_count') + self.audience_count = attributes[:'audience_count'] + end + + if attributes.key?(:'created') + self.created = attributes[:'created'] + end + + if attributes.key?(:'request_id') + self.request_id = attributes[:'request_id'] + end + + if attributes.key?(:'click_url') + self.click_url = attributes[:'click_url'] + end + + if attributes.key?(:'is_ifa_audience') + self.is_ifa_audience = attributes[:'is_ifa_audience'] + end + + if attributes.key?(:'permission') + self.permission = attributes[:'permission'] + end + + if attributes.key?(:'create_route') + self.create_route = attributes[:'create_route'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + audience_group_id == o.audience_group_id && + type == o.type && + description == o.description && + status == o.status && + failed_type == o.failed_type && + audience_count == o.audience_count && + created == o.created && + request_id == o.request_id && + click_url == o.click_url && + is_ifa_audience == o.is_ifa_audience && + permission == o.permission && + create_route == o.create_route + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [audience_group_id, type, description, status, failed_type, audience_count, created, request_id, click_url, is_ifa_audience, permission, create_route].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::ManageAudience.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_authority_level.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_authority_level.rb new file mode 100644 index 00000000..505e53b0 --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_authority_level.rb @@ -0,0 +1,40 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ManageAudience + class AudienceGroupAuthorityLevel + PUBLIC = "PUBLIC".freeze + PRIVATE = "PRIVATE".freeze + + def self.all_vars + @all_vars ||= [PUBLIC, PRIVATE].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if AudienceGroupAuthorityLevel.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #AudienceGroupAuthorityLevel" + end + end +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_create_route.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_create_route.rb new file mode 100644 index 00000000..b3922f40 --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_create_route.rb @@ -0,0 +1,42 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ManageAudience + class AudienceGroupCreateRoute + OA_MANAGER = "OA_MANAGER".freeze + MESSAGING_API = "MESSAGING_API".freeze + POINT_AD = "POINT_AD".freeze + AD_MANAGER = "AD_MANAGER".freeze + + def self.all_vars + @all_vars ||= [OA_MANAGER, MESSAGING_API, POINT_AD, AD_MANAGER].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if AudienceGroupCreateRoute.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #AudienceGroupCreateRoute" + end + end +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_failed_type.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_failed_type.rb new file mode 100644 index 00000000..d6983d7f --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_failed_type.rb @@ -0,0 +1,41 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ManageAudience + class AudienceGroupFailedType + AUDIENCE_GROUP_AUDIENCE_INSUFFICIENT = "AUDIENCE_GROUP_AUDIENCE_INSUFFICIENT".freeze + INTERNAL_ERROR = "INTERNAL_ERROR".freeze + NULL = "null".freeze + + def self.all_vars + @all_vars ||= [AUDIENCE_GROUP_AUDIENCE_INSUFFICIENT, INTERNAL_ERROR, NULL].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if AudienceGroupFailedType.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #AudienceGroupFailedType" + end + end +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_job.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_job.rb new file mode 100644 index 00000000..78134356 --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_job.rb @@ -0,0 +1,310 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ManageAudience + # Audience group job + class AudienceGroupJob + # A job ID. + attr_accessor :audience_group_job_id + + # An audience ID. + attr_accessor :audience_group_id + + # The job's description. + attr_accessor :description + + attr_accessor :type + + attr_accessor :job_status + + attr_accessor :failed_type + + # The number of accounts (recipients) that were added or removed. + attr_accessor :audience_count + + # When the job was created (in UNIX time). + attr_accessor :created + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'audience_group_job_id' => :'audienceGroupJobId', + :'audience_group_id' => :'audienceGroupId', + :'description' => :'description', + :'type' => :'type', + :'job_status' => :'jobStatus', + :'failed_type' => :'failedType', + :'audience_count' => :'audienceCount', + :'created' => :'created' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'audience_group_job_id' => :'Integer', + :'audience_group_id' => :'Integer', + :'description' => :'String', + :'type' => :'AudienceGroupJobType', + :'job_status' => :'AudienceGroupJobStatus', + :'failed_type' => :'AudienceGroupJobFailedType', + :'audience_count' => :'Integer', + :'created' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::ManageAudience::AudienceGroupJob` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::ManageAudience::AudienceGroupJob`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'audience_group_job_id') + self.audience_group_job_id = attributes[:'audience_group_job_id'] + end + + if attributes.key?(:'audience_group_id') + self.audience_group_id = attributes[:'audience_group_id'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'job_status') + self.job_status = attributes[:'job_status'] + end + + if attributes.key?(:'failed_type') + self.failed_type = attributes[:'failed_type'] + end + + if attributes.key?(:'audience_count') + self.audience_count = attributes[:'audience_count'] + end + + if attributes.key?(:'created') + self.created = attributes[:'created'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + audience_group_job_id == o.audience_group_job_id && + audience_group_id == o.audience_group_id && + description == o.description && + type == o.type && + job_status == o.job_status && + failed_type == o.failed_type && + audience_count == o.audience_count && + created == o.created + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [audience_group_job_id, audience_group_id, description, type, job_status, failed_type, audience_count, created].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::ManageAudience.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_job_failed_type.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_job_failed_type.rb new file mode 100644 index 00000000..058ea44b --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_job_failed_type.rb @@ -0,0 +1,40 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ManageAudience + class AudienceGroupJobFailedType + INTERNAL_ERROR = "INTERNAL_ERROR".freeze + AUDIENCE_GROUP_AUDIENCE_INSUFFICIENT = "AUDIENCE_GROUP_AUDIENCE_INSUFFICIENT".freeze + + def self.all_vars + @all_vars ||= [INTERNAL_ERROR, AUDIENCE_GROUP_AUDIENCE_INSUFFICIENT].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if AudienceGroupJobFailedType.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #AudienceGroupJobFailedType" + end + end +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_job_status.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_job_status.rb new file mode 100644 index 00000000..5c2a1b91 --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_job_status.rb @@ -0,0 +1,42 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ManageAudience + class AudienceGroupJobStatus + QUEUED = "QUEUED".freeze + WORKING = "WORKING".freeze + FINISHED = "FINISHED".freeze + FAILED = "FAILED".freeze + + def self.all_vars + @all_vars ||= [QUEUED, WORKING, FINISHED, FAILED].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if AudienceGroupJobStatus.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #AudienceGroupJobStatus" + end + end +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_job_type.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_job_type.rb new file mode 100644 index 00000000..59069da8 --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_job_type.rb @@ -0,0 +1,39 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ManageAudience + class AudienceGroupJobType + DIFF_ADD = "DIFF_ADD".freeze + + def self.all_vars + @all_vars ||= [DIFF_ADD].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if AudienceGroupJobType.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #AudienceGroupJobType" + end + end +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_permission.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_permission.rb new file mode 100644 index 00000000..8145414a --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_permission.rb @@ -0,0 +1,40 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ManageAudience + class AudienceGroupPermission + READ = "READ".freeze + READ_WRITE = "READ_WRITE".freeze + + def self.all_vars + @all_vars ||= [READ, READ_WRITE].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if AudienceGroupPermission.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #AudienceGroupPermission" + end + end +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_status.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_status.rb new file mode 100644 index 00000000..fae89cf2 --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_status.rb @@ -0,0 +1,44 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ManageAudience + class AudienceGroupStatus + IN_PROGRESS = "IN_PROGRESS".freeze + READY = "READY".freeze + FAILED = "FAILED".freeze + EXPIRED = "EXPIRED".freeze + INACTIVE = "INACTIVE".freeze + ACTIVATING = "ACTIVATING".freeze + + def self.all_vars + @all_vars ||= [IN_PROGRESS, READY, FAILED, EXPIRED, INACTIVE, ACTIVATING].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if AudienceGroupStatus.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #AudienceGroupStatus" + end + end +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_type.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_type.rb new file mode 100644 index 00000000..0ba3eaa4 --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/models/audience_group_type.rb @@ -0,0 +1,50 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ManageAudience + class AudienceGroupType + UPLOAD = "UPLOAD".freeze + CLICK = "CLICK".freeze + IMP = "IMP".freeze + CHAT_TAG = "CHAT_TAG".freeze + FRIEND_PATH = "FRIEND_PATH".freeze + RESERVATION = "RESERVATION".freeze + APP_EVENT = "APP_EVENT".freeze + VIDEO_VIEW = "VIDEO_VIEW".freeze + WEBTRAFFIC = "WEBTRAFFIC".freeze + IMAGE_CLICK = "IMAGE_CLICK".freeze + RICHMENU_IMP = "RICHMENU_IMP".freeze + RICHMENU_CLICK = "RICHMENU_CLICK".freeze + + def self.all_vars + @all_vars ||= [UPLOAD, CLICK, IMP, CHAT_TAG, FRIEND_PATH, RESERVATION, APP_EVENT, VIDEO_VIEW, WEBTRAFFIC, IMAGE_CLICK, RICHMENU_IMP, RICHMENU_CLICK].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if AudienceGroupType.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #AudienceGroupType" + end + end +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/models/create_audience_group_request.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/models/create_audience_group_request.rb new file mode 100644 index 00000000..245e6072 --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/models/create_audience_group_request.rb @@ -0,0 +1,291 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ManageAudience + # Create audience for uploading user IDs (by JSON) + class CreateAudienceGroupRequest + # The audience's name. This is case-insensitive, meaning AUDIENCE and audience are considered identical. Max character limit: 120 + attr_accessor :description + + # To specify recipients by IFAs: set true. To specify recipients by user IDs: set false or omit isIfaAudience property. + attr_accessor :is_ifa_audience + + # The description to register for the job (in jobs[].description). + attr_accessor :upload_description + + # An array of user IDs or IFAs. Max number: 10,000 + attr_accessor :audiences + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'description' => :'description', + :'is_ifa_audience' => :'isIfaAudience', + :'upload_description' => :'uploadDescription', + :'audiences' => :'audiences' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'description' => :'String', + :'is_ifa_audience' => :'Boolean', + :'upload_description' => :'String', + :'audiences' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::ManageAudience::CreateAudienceGroupRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::ManageAudience::CreateAudienceGroupRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'is_ifa_audience') + self.is_ifa_audience = attributes[:'is_ifa_audience'] + end + + if attributes.key?(:'upload_description') + self.upload_description = attributes[:'upload_description'] + end + + if attributes.key?(:'audiences') + if (value = attributes[:'audiences']).is_a?(Array) + self.audiences = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@description.nil? && @description.to_s.length > 120 + invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 120.') + end + + if !@audiences.nil? && @audiences.length > 10000 + invalid_properties.push('invalid value for "audiences", number of items must be less than or equal to 10000.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@description.nil? && @description.to_s.length > 120 + return false if !@audiences.nil? && @audiences.length > 10000 + true + end + + # Custom attribute writer method with validation + # @param [Object] description Value to be assigned + def description=(description) + if description.nil? + fail ArgumentError, 'description cannot be nil' + end + + if description.to_s.length > 120 + fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 120.' + end + + @description = description + end + + # Custom attribute writer method with validation + # @param [Object] audiences Value to be assigned + def audiences=(audiences) + if audiences.nil? + fail ArgumentError, 'audiences cannot be nil' + end + + if audiences.length > 10000 + fail ArgumentError, 'invalid value for "audiences", number of items must be less than or equal to 10000.' + end + + @audiences = audiences + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + description == o.description && + is_ifa_audience == o.is_ifa_audience && + upload_description == o.upload_description && + audiences == o.audiences + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [description, is_ifa_audience, upload_description, audiences].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::ManageAudience.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/models/create_audience_group_response.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/models/create_audience_group_response.rb new file mode 100644 index 00000000..519cb375 --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/models/create_audience_group_response.rb @@ -0,0 +1,336 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ManageAudience + # Create audience for uploading user IDs (by JSON) + class CreateAudienceGroupResponse + # The audience ID. + attr_accessor :audience_group_id + + # How the audience was created. `MESSAGING_API`: An audience created with Messaging API. + attr_accessor :create_route + + attr_accessor :type + + # The audience's name. + attr_accessor :description + + # When the audience was created (in UNIX time). + attr_accessor :created + + # Audience's update permission. Audiences linked to the same channel will be READ_WRITE. `READ`: Can use only. `READ_WRITE`: Can use and update. + attr_accessor :permission + + # Time of audience expiration. Only returned for specific audiences. + attr_accessor :expire_timestamp + + # The value indicating the type of account to be sent, as specified when creating the audience for uploading user IDs. One of: `true`: Accounts are specified with IFAs. `false` (default): Accounts are specified with user IDs. + attr_accessor :is_ifa_audience + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'audience_group_id' => :'audienceGroupId', + :'create_route' => :'createRoute', + :'type' => :'type', + :'description' => :'description', + :'created' => :'created', + :'permission' => :'permission', + :'expire_timestamp' => :'expireTimestamp', + :'is_ifa_audience' => :'isIfaAudience' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'audience_group_id' => :'Integer', + :'create_route' => :'String', + :'type' => :'AudienceGroupType', + :'description' => :'String', + :'created' => :'Integer', + :'permission' => :'String', + :'expire_timestamp' => :'Float', + :'is_ifa_audience' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::ManageAudience::CreateAudienceGroupResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::ManageAudience::CreateAudienceGroupResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'audience_group_id') + self.audience_group_id = attributes[:'audience_group_id'] + end + + if attributes.key?(:'create_route') + self.create_route = attributes[:'create_route'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'created') + self.created = attributes[:'created'] + end + + if attributes.key?(:'permission') + self.permission = attributes[:'permission'] + end + + if attributes.key?(:'expire_timestamp') + self.expire_timestamp = attributes[:'expire_timestamp'] + end + + if attributes.key?(:'is_ifa_audience') + self.is_ifa_audience = attributes[:'is_ifa_audience'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + create_route_validator = EnumAttributeValidator.new('String', ["MESSAGING_API"]) + return false unless create_route_validator.valid?(@create_route) + permission_validator = EnumAttributeValidator.new('String', ["READ", "READ_WRITE"]) + return false unless permission_validator.valid?(@permission) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] create_route Object to be assigned + def create_route=(create_route) + validator = EnumAttributeValidator.new('String', ["MESSAGING_API"]) + unless validator.valid?(create_route) + fail ArgumentError, "invalid value for \"create_route\", must be one of #{validator.allowable_values}." + end + @create_route = create_route + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] permission Object to be assigned + def permission=(permission) + validator = EnumAttributeValidator.new('String', ["READ", "READ_WRITE"]) + unless validator.valid?(permission) + fail ArgumentError, "invalid value for \"permission\", must be one of #{validator.allowable_values}." + end + @permission = permission + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + audience_group_id == o.audience_group_id && + create_route == o.create_route && + type == o.type && + description == o.description && + created == o.created && + permission == o.permission && + expire_timestamp == o.expire_timestamp && + is_ifa_audience == o.is_ifa_audience + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [audience_group_id, create_route, type, description, created, permission, expire_timestamp, is_ifa_audience].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::ManageAudience.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/models/create_click_based_audience_group_request.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/models/create_click_based_audience_group_request.rb new file mode 100644 index 00000000..86359433 --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/models/create_click_based_audience_group_request.rb @@ -0,0 +1,279 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ManageAudience + # Create audience for click-based retargeting + class CreateClickBasedAudienceGroupRequest + # The audience's name. This is case-insensitive, meaning AUDIENCE and audience are considered identical. Max character limit: 120 + attr_accessor :description + + # The request ID of a broadcast or narrowcast message sent in the past 60 days. Each Messaging API request has a request ID. + attr_accessor :request_id + + # The URL clicked by the user. If empty, users who clicked any URL in the message are added to the list of recipients. Max character limit: 2,000 + attr_accessor :click_url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'description' => :'description', + :'request_id' => :'requestId', + :'click_url' => :'clickUrl' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'description' => :'String', + :'request_id' => :'String', + :'click_url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::ManageAudience::CreateClickBasedAudienceGroupRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::ManageAudience::CreateClickBasedAudienceGroupRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'request_id') + self.request_id = attributes[:'request_id'] + end + + if attributes.key?(:'click_url') + self.click_url = attributes[:'click_url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@description.nil? && @description.to_s.length > 120 + invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 120.') + end + + if !@click_url.nil? && @click_url.to_s.length > 2000 + invalid_properties.push('invalid value for "click_url", the character length must be smaller than or equal to 2000.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@description.nil? && @description.to_s.length > 120 + return false if !@click_url.nil? && @click_url.to_s.length > 2000 + true + end + + # Custom attribute writer method with validation + # @param [Object] description Value to be assigned + def description=(description) + if description.nil? + fail ArgumentError, 'description cannot be nil' + end + + if description.to_s.length > 120 + fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 120.' + end + + @description = description + end + + # Custom attribute writer method with validation + # @param [Object] click_url Value to be assigned + def click_url=(click_url) + if click_url.nil? + fail ArgumentError, 'click_url cannot be nil' + end + + if click_url.to_s.length > 2000 + fail ArgumentError, 'invalid value for "click_url", the character length must be smaller than or equal to 2000.' + end + + @click_url = click_url + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + description == o.description && + request_id == o.request_id && + click_url == o.click_url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [description, request_id, click_url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::ManageAudience.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/models/create_click_based_audience_group_response.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/models/create_click_based_audience_group_response.rb new file mode 100644 index 00000000..c4446c16 --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/models/create_click_based_audience_group_response.rb @@ -0,0 +1,358 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ManageAudience + # Create audience for click-based retargeting + class CreateClickBasedAudienceGroupResponse + # The audience ID. + attr_accessor :audience_group_id + + attr_accessor :type + + # The audience's name. + attr_accessor :description + + # When the audience was created (in UNIX time). + attr_accessor :created + + # The request ID that was specified when the audience was created. + attr_accessor :request_id + + # The URL that was specified when the audience was created. + attr_accessor :click_url + + # How the audience was created. `MESSAGING_API`: An audience created with Messaging API. + attr_accessor :create_route + + # Audience's update permission. Audiences linked to the same channel will be READ_WRITE. - `READ`: Can use only. - `READ_WRITE`: Can use and update. + attr_accessor :permission + + # Time of audience expiration. Only returned for specific audiences. + attr_accessor :expire_timestamp + + # The value indicating the type of account to be sent, as specified when creating the audience for uploading user IDs. One of: true: Accounts are specified with IFAs. false (default): Accounts are specified with user IDs. + attr_accessor :is_ifa_audience + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'audience_group_id' => :'audienceGroupId', + :'type' => :'type', + :'description' => :'description', + :'created' => :'created', + :'request_id' => :'requestId', + :'click_url' => :'clickUrl', + :'create_route' => :'createRoute', + :'permission' => :'permission', + :'expire_timestamp' => :'expireTimestamp', + :'is_ifa_audience' => :'isIfaAudience' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'audience_group_id' => :'Integer', + :'type' => :'AudienceGroupType', + :'description' => :'String', + :'created' => :'Integer', + :'request_id' => :'String', + :'click_url' => :'String', + :'create_route' => :'String', + :'permission' => :'String', + :'expire_timestamp' => :'Integer', + :'is_ifa_audience' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::ManageAudience::CreateClickBasedAudienceGroupResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::ManageAudience::CreateClickBasedAudienceGroupResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'audience_group_id') + self.audience_group_id = attributes[:'audience_group_id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'created') + self.created = attributes[:'created'] + end + + if attributes.key?(:'request_id') + self.request_id = attributes[:'request_id'] + end + + if attributes.key?(:'click_url') + self.click_url = attributes[:'click_url'] + end + + if attributes.key?(:'create_route') + self.create_route = attributes[:'create_route'] + end + + if attributes.key?(:'permission') + self.permission = attributes[:'permission'] + end + + if attributes.key?(:'expire_timestamp') + self.expire_timestamp = attributes[:'expire_timestamp'] + end + + if attributes.key?(:'is_ifa_audience') + self.is_ifa_audience = attributes[:'is_ifa_audience'] + else + self.is_ifa_audience = false + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + create_route_validator = EnumAttributeValidator.new('String', ["MESSAGING_API"]) + return false unless create_route_validator.valid?(@create_route) + permission_validator = EnumAttributeValidator.new('String', ["READ", "READ_WRITE"]) + return false unless permission_validator.valid?(@permission) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] create_route Object to be assigned + def create_route=(create_route) + validator = EnumAttributeValidator.new('String', ["MESSAGING_API"]) + unless validator.valid?(create_route) + fail ArgumentError, "invalid value for \"create_route\", must be one of #{validator.allowable_values}." + end + @create_route = create_route + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] permission Object to be assigned + def permission=(permission) + validator = EnumAttributeValidator.new('String', ["READ", "READ_WRITE"]) + unless validator.valid?(permission) + fail ArgumentError, "invalid value for \"permission\", must be one of #{validator.allowable_values}." + end + @permission = permission + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + audience_group_id == o.audience_group_id && + type == o.type && + description == o.description && + created == o.created && + request_id == o.request_id && + click_url == o.click_url && + create_route == o.create_route && + permission == o.permission && + expire_timestamp == o.expire_timestamp && + is_ifa_audience == o.is_ifa_audience + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [audience_group_id, type, description, created, request_id, click_url, create_route, permission, expire_timestamp, is_ifa_audience].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::ManageAudience.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/models/create_imp_based_audience_group_request.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/models/create_imp_based_audience_group_request.rb new file mode 100644 index 00000000..581cea1f --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/models/create_imp_based_audience_group_request.rb @@ -0,0 +1,259 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ManageAudience + # Create audience for impression-based retargeting + class CreateImpBasedAudienceGroupRequest + # The audience's name. This is case-insensitive, meaning `AUDIENCE` and `audience` are considered identical. Max character limit: 120 + attr_accessor :description + + # The request ID of a broadcast or narrowcast message sent in the past 60 days. Each Messaging API request has a request ID. + attr_accessor :request_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'description' => :'description', + :'request_id' => :'requestId' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'description' => :'String', + :'request_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::ManageAudience::CreateImpBasedAudienceGroupRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::ManageAudience::CreateImpBasedAudienceGroupRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'request_id') + self.request_id = attributes[:'request_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@description.nil? && @description.to_s.length > 120 + invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 120.') + end + + if !@description.nil? && @description.to_s.length < 1 + invalid_properties.push('invalid value for "description", the character length must be great than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@description.nil? && @description.to_s.length > 120 + return false if !@description.nil? && @description.to_s.length < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] description Value to be assigned + def description=(description) + if description.nil? + fail ArgumentError, 'description cannot be nil' + end + + if description.to_s.length > 120 + fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 120.' + end + + if description.to_s.length < 1 + fail ArgumentError, 'invalid value for "description", the character length must be great than or equal to 1.' + end + + @description = description + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + description == o.description && + request_id == o.request_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [description, request_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::ManageAudience.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/models/create_imp_based_audience_group_response.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/models/create_imp_based_audience_group_response.rb new file mode 100644 index 00000000..ccaa9849 --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/models/create_imp_based_audience_group_response.rb @@ -0,0 +1,282 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ManageAudience + # Create audience for impression-based retargeting + class CreateImpBasedAudienceGroupResponse + # The audience ID. + attr_accessor :audience_group_id + + attr_accessor :type + + # The audience's name. + attr_accessor :description + + # When the audience was created (in UNIX time). + attr_accessor :created + + # The request ID that was specified when the audience was created. + attr_accessor :request_id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'audience_group_id' => :'audienceGroupId', + :'type' => :'type', + :'description' => :'description', + :'created' => :'created', + :'request_id' => :'requestId' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'audience_group_id' => :'Integer', + :'type' => :'AudienceGroupType', + :'description' => :'String', + :'created' => :'Integer', + :'request_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::ManageAudience::CreateImpBasedAudienceGroupResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::ManageAudience::CreateImpBasedAudienceGroupResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'audience_group_id') + self.audience_group_id = attributes[:'audience_group_id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'created') + self.created = attributes[:'created'] + end + + if attributes.key?(:'request_id') + self.request_id = attributes[:'request_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + audience_group_id == o.audience_group_id && + type == o.type && + description == o.description && + created == o.created && + request_id == o.request_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [audience_group_id, type, description, created, request_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::ManageAudience.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/models/error_detail.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/models/error_detail.rb new file mode 100644 index 00000000..596ffa60 --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/models/error_detail.rb @@ -0,0 +1,230 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ManageAudience + class ErrorDetail + # Details of the error. Not included in the response under certain situations. + attr_accessor :message + + # Location of where the error occurred. Returns the JSON field name or query parameter name of the request. Not included in the response under certain situations. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'message' => :'message', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'message' => :'String', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::ManageAudience::ErrorDetail` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::ManageAudience::ErrorDetail`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + message == o.message && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [message, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::ManageAudience.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/models/error_response.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/models/error_response.rb new file mode 100644 index 00000000..790fc837 --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/models/error_response.rb @@ -0,0 +1,239 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ManageAudience + class ErrorResponse + # Message containing information about the error. + attr_accessor :message + + # An array of error details. If the array is empty, this property will not be included in the response. + attr_accessor :details + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'message' => :'message', + :'details' => :'details' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'message' => :'String', + :'details' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::ManageAudience::ErrorResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::ManageAudience::ErrorResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'message') + self.message = attributes[:'message'] + else + self.message = nil + end + + if attributes.key?(:'details') + if (value = attributes[:'details']).is_a?(Array) + self.details = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @message.nil? + invalid_properties.push('invalid value for "message", message cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @message.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + message == o.message && + details == o.details + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [message, details].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::ManageAudience.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/models/get_audience_data_response.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/models/get_audience_data_response.rb new file mode 100644 index 00000000..b5bca936 --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/models/get_audience_data_response.rb @@ -0,0 +1,251 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ManageAudience + # Get audience data + class GetAudienceDataResponse + attr_accessor :audience_group + + # An array of jobs. This array is used to keep track of each attempt to add new user IDs or IFAs to an audience for uploading user IDs. Empty array is returned for any other type of audience. Max: 50 + attr_accessor :jobs + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'audience_group' => :'audienceGroup', + :'jobs' => :'jobs' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'audience_group' => :'AudienceGroup', + :'jobs' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::ManageAudience::GetAudienceDataResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::ManageAudience::GetAudienceDataResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'audience_group') + self.audience_group = attributes[:'audience_group'] + end + + if attributes.key?(:'jobs') + if (value = attributes[:'jobs']).is_a?(Array) + self.jobs = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@jobs.nil? && @jobs.length > 50 + invalid_properties.push('invalid value for "jobs", number of items must be less than or equal to 50.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@jobs.nil? && @jobs.length > 50 + true + end + + # Custom attribute writer method with validation + # @param [Object] jobs Value to be assigned + def jobs=(jobs) + if jobs.nil? + fail ArgumentError, 'jobs cannot be nil' + end + + if jobs.length > 50 + fail ArgumentError, 'invalid value for "jobs", number of items must be less than or equal to 50.' + end + + @jobs = jobs + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + audience_group == o.audience_group && + jobs == o.jobs + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [audience_group, jobs].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::ManageAudience.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/models/get_audience_group_authority_level_response.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/models/get_audience_group_authority_level_response.rb new file mode 100644 index 00000000..24bc1c2e --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/models/get_audience_group_authority_level_response.rb @@ -0,0 +1,242 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ManageAudience + # Get the authority level of the audience + class GetAudienceGroupAuthorityLevelResponse + attr_accessor :authority_level + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'authority_level' => :'authorityLevel' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'authority_level' => :'AudienceGroupAuthorityLevel' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::ManageAudience::GetAudienceGroupAuthorityLevelResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::ManageAudience::GetAudienceGroupAuthorityLevelResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'authority_level') + self.authority_level = attributes[:'authority_level'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + authority_level == o.authority_level + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [authority_level].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::ManageAudience.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/models/get_audience_groups_response.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/models/get_audience_groups_response.rb new file mode 100644 index 00000000..3d75642f --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/models/get_audience_groups_response.rb @@ -0,0 +1,273 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ManageAudience + # Gets data for more than one audience. + class GetAudienceGroupsResponse + # An array of audience data. If there are no audiences that match the specified filter, an empty array will be returned. + attr_accessor :audience_groups + + # true when this is not the last page. + attr_accessor :has_next_page + + # The total number of audiences that can be returned with the specified filter. + attr_accessor :total_count + + # Of the audiences you can get with the specified filter, the number of audiences with the update permission set to READ_WRITE. + attr_accessor :read_write_audience_group_total_count + + # The current page number. + attr_accessor :page + + # The maximum number of audiences on the current page. + attr_accessor :size + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'audience_groups' => :'audienceGroups', + :'has_next_page' => :'hasNextPage', + :'total_count' => :'totalCount', + :'read_write_audience_group_total_count' => :'readWriteAudienceGroupTotalCount', + :'page' => :'page', + :'size' => :'size' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'audience_groups' => :'Array', + :'has_next_page' => :'Boolean', + :'total_count' => :'Integer', + :'read_write_audience_group_total_count' => :'Integer', + :'page' => :'Integer', + :'size' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::ManageAudience::GetAudienceGroupsResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::ManageAudience::GetAudienceGroupsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'audience_groups') + if (value = attributes[:'audience_groups']).is_a?(Array) + self.audience_groups = value + end + end + + if attributes.key?(:'has_next_page') + self.has_next_page = attributes[:'has_next_page'] + end + + if attributes.key?(:'total_count') + self.total_count = attributes[:'total_count'] + end + + if attributes.key?(:'read_write_audience_group_total_count') + self.read_write_audience_group_total_count = attributes[:'read_write_audience_group_total_count'] + end + + if attributes.key?(:'page') + self.page = attributes[:'page'] + end + + if attributes.key?(:'size') + self.size = attributes[:'size'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + audience_groups == o.audience_groups && + has_next_page == o.has_next_page && + total_count == o.total_count && + read_write_audience_group_total_count == o.read_write_audience_group_total_count && + page == o.page && + size == o.size + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [audience_groups, has_next_page, total_count, read_write_audience_group_total_count, page, size].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::ManageAudience.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/models/update_audience_group_authority_level_request.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/models/update_audience_group_authority_level_request.rb new file mode 100644 index 00000000..467a6511 --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/models/update_audience_group_authority_level_request.rb @@ -0,0 +1,242 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ManageAudience + # Change the authority level of the audience + class UpdateAudienceGroupAuthorityLevelRequest + attr_accessor :authority_level + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'authority_level' => :'authorityLevel' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'authority_level' => :'AudienceGroupAuthorityLevel' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::ManageAudience::UpdateAudienceGroupAuthorityLevelRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::ManageAudience::UpdateAudienceGroupAuthorityLevelRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'authority_level') + self.authority_level = attributes[:'authority_level'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + authority_level == o.authority_level + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [authority_level].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::ManageAudience.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/models/update_audience_group_description_request.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/models/update_audience_group_description_request.rb new file mode 100644 index 00000000..0075811b --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/models/update_audience_group_description_request.rb @@ -0,0 +1,249 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ManageAudience + # Rename an audience + class UpdateAudienceGroupDescriptionRequest + # The audience's name. This is case-insensitive, meaning AUDIENCE and audience are considered identical. Max character limit: 120 + attr_accessor :description + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'description' => :'description' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'description' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::ManageAudience::UpdateAudienceGroupDescriptionRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::ManageAudience::UpdateAudienceGroupDescriptionRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@description.nil? && @description.to_s.length > 120 + invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 120.') + end + + if !@description.nil? && @description.to_s.length < 1 + invalid_properties.push('invalid value for "description", the character length must be great than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@description.nil? && @description.to_s.length > 120 + return false if !@description.nil? && @description.to_s.length < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] description Value to be assigned + def description=(description) + if description.nil? + fail ArgumentError, 'description cannot be nil' + end + + if description.to_s.length > 120 + fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 120.' + end + + if description.to_s.length < 1 + fail ArgumentError, 'invalid value for "description", the character length must be great than or equal to 1.' + end + + @description = description + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + description == o.description + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [description].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::ManageAudience.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/manage-audience/lib/line_client_manage_audience/version.rb b/lib/clients/manage-audience/lib/line_client_manage_audience/version.rb new file mode 100644 index 00000000..a6b55aab --- /dev/null +++ b/lib/clients/manage-audience/lib/line_client_manage_audience/version.rb @@ -0,0 +1,15 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::ManageAudience + VERSION = '2.0.0' +end diff --git a/lib/clients/messaging-api/.gitignore b/lib/clients/messaging-api/.gitignore new file mode 100644 index 00000000..05a17cb8 --- /dev/null +++ b/lib/clients/messaging-api/.gitignore @@ -0,0 +1,39 @@ +# Generated by: https://openapi-generator.tech +# + +*.gem +*.rbc +/.config +/coverage/ +/InstalledFiles +/pkg/ +/spec/reports/ +/spec/examples.txt +/test/tmp/ +/test/version_tmp/ +/tmp/ + +## Specific to RubyMotion: +.dat* +.repl_history +build/ + +## Documentation cache and generated files: +/.yardoc/ +/_yardoc/ +/doc/ +/rdoc/ + +## Environment normalization: +/.bundle/ +/vendor/bundle +/lib/bundler/man/ + +# for a library or gem, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# Gemfile.lock +# .ruby-version +# .ruby-gemset + +# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: +.rvmrc diff --git a/lib/clients/messaging-api/.openapi-generator/FILES b/lib/clients/messaging-api/.openapi-generator/FILES new file mode 100644 index 00000000..d480a77b --- /dev/null +++ b/lib/clients/messaging-api/.openapi-generator/FILES @@ -0,0 +1,285 @@ +.gitignore +.gitlab-ci.yml +.rspec +.rubocop.yml +.travis.yml +Gemfile +README.md +Rakefile +docs/Action.md +docs/AgeDemographic.md +docs/AgeDemographicFilter.md +docs/AltUri.md +docs/AppTypeDemographic.md +docs/AppTypeDemographicFilter.md +docs/AreaDemographic.md +docs/AreaDemographicFilter.md +docs/AudienceMatchMessagesRequest.md +docs/AudienceRecipient.md +docs/AudioMessage.md +docs/BotInfoResponse.md +docs/BroadcastRequest.md +docs/ButtonsTemplate.md +docs/CameraAction.md +docs/CameraRollAction.md +docs/CarouselColumn.md +docs/CarouselTemplate.md +docs/ChatReference.md +docs/ConfirmTemplate.md +docs/CreateRichMenuAliasRequest.md +docs/DatetimePickerAction.md +docs/DemographicFilter.md +docs/Emoji.md +docs/ErrorDetail.md +docs/ErrorResponse.md +docs/Filter.md +docs/FlexBlockStyle.md +docs/FlexBox.md +docs/FlexBoxBackground.md +docs/FlexBoxLinearGradient.md +docs/FlexBubble.md +docs/FlexBubbleStyles.md +docs/FlexButton.md +docs/FlexCarousel.md +docs/FlexComponent.md +docs/FlexContainer.md +docs/FlexFiller.md +docs/FlexIcon.md +docs/FlexImage.md +docs/FlexMessage.md +docs/FlexSeparator.md +docs/FlexSpan.md +docs/FlexText.md +docs/FlexVideo.md +docs/GenderDemographic.md +docs/GenderDemographicFilter.md +docs/GetAggregationUnitNameListResponse.md +docs/GetAggregationUnitUsageResponse.md +docs/GetFollowersResponse.md +docs/GetMessageContentTranscodingResponse.md +docs/GetWebhookEndpointResponse.md +docs/GroupMemberCountResponse.md +docs/GroupSummaryResponse.md +docs/GroupUserProfileResponse.md +docs/ImageCarouselColumn.md +docs/ImageCarouselTemplate.md +docs/ImageMessage.md +docs/ImagemapAction.md +docs/ImagemapArea.md +docs/ImagemapBaseSize.md +docs/ImagemapExternalLink.md +docs/ImagemapMessage.md +docs/ImagemapVideo.md +docs/IssueLinkTokenResponse.md +docs/Limit.md +docs/LocationAction.md +docs/LocationMessage.md +docs/MarkMessagesAsReadRequest.md +docs/MembersIdsResponse.md +docs/Message.md +docs/MessageAction.md +docs/MessageImagemapAction.md +docs/MessageQuotaResponse.md +docs/MessagingApiApi.md +docs/MessagingApiBlobApi.md +docs/MulticastRequest.md +docs/NarrowcastProgressResponse.md +docs/NarrowcastRequest.md +docs/NumberOfMessagesResponse.md +docs/OperatorDemographicFilter.md +docs/OperatorRecipient.md +docs/PnpMessagesRequest.md +docs/PostbackAction.md +docs/PushMessageRequest.md +docs/PushMessageResponse.md +docs/QuickReply.md +docs/QuickReplyItem.md +docs/QuotaConsumptionResponse.md +docs/QuotaType.md +docs/Recipient.md +docs/RedeliveryRecipient.md +docs/ReplyMessageRequest.md +docs/ReplyMessageResponse.md +docs/RichMenuAliasListResponse.md +docs/RichMenuAliasResponse.md +docs/RichMenuArea.md +docs/RichMenuBatchLinkOperation.md +docs/RichMenuBatchOperation.md +docs/RichMenuBatchProgressPhase.md +docs/RichMenuBatchProgressResponse.md +docs/RichMenuBatchRequest.md +docs/RichMenuBatchUnlinkAllOperation.md +docs/RichMenuBatchUnlinkOperation.md +docs/RichMenuBounds.md +docs/RichMenuBulkLinkRequest.md +docs/RichMenuBulkUnlinkRequest.md +docs/RichMenuIdResponse.md +docs/RichMenuListResponse.md +docs/RichMenuRequest.md +docs/RichMenuResponse.md +docs/RichMenuSize.md +docs/RichMenuSwitchAction.md +docs/RoomMemberCountResponse.md +docs/RoomUserProfileResponse.md +docs/Sender.md +docs/SentMessage.md +docs/SetWebhookEndpointRequest.md +docs/StickerMessage.md +docs/SubscriptionPeriodDemographic.md +docs/SubscriptionPeriodDemographicFilter.md +docs/Template.md +docs/TemplateMessage.md +docs/TestWebhookEndpointRequest.md +docs/TestWebhookEndpointResponse.md +docs/TextMessage.md +docs/URIAction.md +docs/URIImagemapAction.md +docs/UpdateRichMenuAliasRequest.md +docs/UserProfileResponse.md +docs/ValidateMessageRequest.md +docs/VideoMessage.md +git_push.sh +lib/line_client_messaging_api.rb +lib/line_client_messaging_api/api/messaging_api_api.rb +lib/line_client_messaging_api/api/messaging_api_blob_api.rb +lib/line_client_messaging_api/api_client.rb +lib/line_client_messaging_api/api_error.rb +lib/line_client_messaging_api/configuration.rb +lib/line_client_messaging_api/models/action.rb +lib/line_client_messaging_api/models/age_demographic.rb +lib/line_client_messaging_api/models/age_demographic_filter.rb +lib/line_client_messaging_api/models/alt_uri.rb +lib/line_client_messaging_api/models/app_type_demographic.rb +lib/line_client_messaging_api/models/app_type_demographic_filter.rb +lib/line_client_messaging_api/models/area_demographic.rb +lib/line_client_messaging_api/models/area_demographic_filter.rb +lib/line_client_messaging_api/models/audience_match_messages_request.rb +lib/line_client_messaging_api/models/audience_recipient.rb +lib/line_client_messaging_api/models/audio_message.rb +lib/line_client_messaging_api/models/bot_info_response.rb +lib/line_client_messaging_api/models/broadcast_request.rb +lib/line_client_messaging_api/models/buttons_template.rb +lib/line_client_messaging_api/models/camera_action.rb +lib/line_client_messaging_api/models/camera_roll_action.rb +lib/line_client_messaging_api/models/carousel_column.rb +lib/line_client_messaging_api/models/carousel_template.rb +lib/line_client_messaging_api/models/chat_reference.rb +lib/line_client_messaging_api/models/confirm_template.rb +lib/line_client_messaging_api/models/create_rich_menu_alias_request.rb +lib/line_client_messaging_api/models/datetime_picker_action.rb +lib/line_client_messaging_api/models/demographic_filter.rb +lib/line_client_messaging_api/models/emoji.rb +lib/line_client_messaging_api/models/error_detail.rb +lib/line_client_messaging_api/models/error_response.rb +lib/line_client_messaging_api/models/filter.rb +lib/line_client_messaging_api/models/flex_block_style.rb +lib/line_client_messaging_api/models/flex_box.rb +lib/line_client_messaging_api/models/flex_box_background.rb +lib/line_client_messaging_api/models/flex_box_linear_gradient.rb +lib/line_client_messaging_api/models/flex_bubble.rb +lib/line_client_messaging_api/models/flex_bubble_styles.rb +lib/line_client_messaging_api/models/flex_button.rb +lib/line_client_messaging_api/models/flex_carousel.rb +lib/line_client_messaging_api/models/flex_component.rb +lib/line_client_messaging_api/models/flex_container.rb +lib/line_client_messaging_api/models/flex_filler.rb +lib/line_client_messaging_api/models/flex_icon.rb +lib/line_client_messaging_api/models/flex_image.rb +lib/line_client_messaging_api/models/flex_message.rb +lib/line_client_messaging_api/models/flex_separator.rb +lib/line_client_messaging_api/models/flex_span.rb +lib/line_client_messaging_api/models/flex_text.rb +lib/line_client_messaging_api/models/flex_video.rb +lib/line_client_messaging_api/models/gender_demographic.rb +lib/line_client_messaging_api/models/gender_demographic_filter.rb +lib/line_client_messaging_api/models/get_aggregation_unit_name_list_response.rb +lib/line_client_messaging_api/models/get_aggregation_unit_usage_response.rb +lib/line_client_messaging_api/models/get_followers_response.rb +lib/line_client_messaging_api/models/get_message_content_transcoding_response.rb +lib/line_client_messaging_api/models/get_webhook_endpoint_response.rb +lib/line_client_messaging_api/models/group_member_count_response.rb +lib/line_client_messaging_api/models/group_summary_response.rb +lib/line_client_messaging_api/models/group_user_profile_response.rb +lib/line_client_messaging_api/models/image_carousel_column.rb +lib/line_client_messaging_api/models/image_carousel_template.rb +lib/line_client_messaging_api/models/image_message.rb +lib/line_client_messaging_api/models/imagemap_action.rb +lib/line_client_messaging_api/models/imagemap_area.rb +lib/line_client_messaging_api/models/imagemap_base_size.rb +lib/line_client_messaging_api/models/imagemap_external_link.rb +lib/line_client_messaging_api/models/imagemap_message.rb +lib/line_client_messaging_api/models/imagemap_video.rb +lib/line_client_messaging_api/models/issue_link_token_response.rb +lib/line_client_messaging_api/models/limit.rb +lib/line_client_messaging_api/models/location_action.rb +lib/line_client_messaging_api/models/location_message.rb +lib/line_client_messaging_api/models/mark_messages_as_read_request.rb +lib/line_client_messaging_api/models/members_ids_response.rb +lib/line_client_messaging_api/models/message.rb +lib/line_client_messaging_api/models/message_action.rb +lib/line_client_messaging_api/models/message_imagemap_action.rb +lib/line_client_messaging_api/models/message_quota_response.rb +lib/line_client_messaging_api/models/multicast_request.rb +lib/line_client_messaging_api/models/narrowcast_progress_response.rb +lib/line_client_messaging_api/models/narrowcast_request.rb +lib/line_client_messaging_api/models/number_of_messages_response.rb +lib/line_client_messaging_api/models/operator_demographic_filter.rb +lib/line_client_messaging_api/models/operator_recipient.rb +lib/line_client_messaging_api/models/pnp_messages_request.rb +lib/line_client_messaging_api/models/postback_action.rb +lib/line_client_messaging_api/models/push_message_request.rb +lib/line_client_messaging_api/models/push_message_response.rb +lib/line_client_messaging_api/models/quick_reply.rb +lib/line_client_messaging_api/models/quick_reply_item.rb +lib/line_client_messaging_api/models/quota_consumption_response.rb +lib/line_client_messaging_api/models/quota_type.rb +lib/line_client_messaging_api/models/recipient.rb +lib/line_client_messaging_api/models/redelivery_recipient.rb +lib/line_client_messaging_api/models/reply_message_request.rb +lib/line_client_messaging_api/models/reply_message_response.rb +lib/line_client_messaging_api/models/rich_menu_alias_list_response.rb +lib/line_client_messaging_api/models/rich_menu_alias_response.rb +lib/line_client_messaging_api/models/rich_menu_area.rb +lib/line_client_messaging_api/models/rich_menu_batch_link_operation.rb +lib/line_client_messaging_api/models/rich_menu_batch_operation.rb +lib/line_client_messaging_api/models/rich_menu_batch_progress_phase.rb +lib/line_client_messaging_api/models/rich_menu_batch_progress_response.rb +lib/line_client_messaging_api/models/rich_menu_batch_request.rb +lib/line_client_messaging_api/models/rich_menu_batch_unlink_all_operation.rb +lib/line_client_messaging_api/models/rich_menu_batch_unlink_operation.rb +lib/line_client_messaging_api/models/rich_menu_bounds.rb +lib/line_client_messaging_api/models/rich_menu_bulk_link_request.rb +lib/line_client_messaging_api/models/rich_menu_bulk_unlink_request.rb +lib/line_client_messaging_api/models/rich_menu_id_response.rb +lib/line_client_messaging_api/models/rich_menu_list_response.rb +lib/line_client_messaging_api/models/rich_menu_request.rb +lib/line_client_messaging_api/models/rich_menu_response.rb +lib/line_client_messaging_api/models/rich_menu_size.rb +lib/line_client_messaging_api/models/rich_menu_switch_action.rb +lib/line_client_messaging_api/models/room_member_count_response.rb +lib/line_client_messaging_api/models/room_user_profile_response.rb +lib/line_client_messaging_api/models/sender.rb +lib/line_client_messaging_api/models/sent_message.rb +lib/line_client_messaging_api/models/set_webhook_endpoint_request.rb +lib/line_client_messaging_api/models/sticker_message.rb +lib/line_client_messaging_api/models/subscription_period_demographic.rb +lib/line_client_messaging_api/models/subscription_period_demographic_filter.rb +lib/line_client_messaging_api/models/template.rb +lib/line_client_messaging_api/models/template_message.rb +lib/line_client_messaging_api/models/test_webhook_endpoint_request.rb +lib/line_client_messaging_api/models/test_webhook_endpoint_response.rb +lib/line_client_messaging_api/models/text_message.rb +lib/line_client_messaging_api/models/update_rich_menu_alias_request.rb +lib/line_client_messaging_api/models/uri_action.rb +lib/line_client_messaging_api/models/uri_imagemap_action.rb +lib/line_client_messaging_api/models/user_profile_response.rb +lib/line_client_messaging_api/models/validate_message_request.rb +lib/line_client_messaging_api/models/video_message.rb +lib/line_client_messaging_api/version.rb +line_client_messaging_api.gemspec +spec/api_client_spec.rb +spec/configuration_spec.rb +spec/models/push_message_response_spec.rb +spec/models/reply_message_response_spec.rb +spec/models/sent_message_spec.rb +spec/spec_helper.rb diff --git a/lib/clients/messaging-api/.openapi-generator/VERSION b/lib/clients/messaging-api/.openapi-generator/VERSION new file mode 100644 index 00000000..41225218 --- /dev/null +++ b/lib/clients/messaging-api/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.0.0 \ No newline at end of file diff --git a/lib/clients/messaging-api/README.md b/lib/clients/messaging-api/README.md new file mode 100644 index 00000000..ff3e4ac1 --- /dev/null +++ b/lib/clients/messaging-api/README.md @@ -0,0 +1,291 @@ +# LINE::Client::MessagingApi + +This document describes LINE Messaging API. + +This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 0.0.1 +- Package version: 2.0.0 +- Build package: org.openapitools.codegen.languages.RubyClientCodegen + +## Installation + +### Build a gem + +To build the Ruby code into a gem: + +```shell +gem build line-bot-api.gemspec +``` + +Then either install the gem locally: + +```shell +gem install ./line-bot-api-2.0.0.gem +``` + +(for development, run `gem install --dev ./line-bot-api-2.0.0.gem` to install the development dependencies) + +or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/). + +Finally add this to the Gemfile: + + gem 'line-bot-api', '~> 2.0.0' + +### Install from Git + +If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile: + + gem 'line-bot-api', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git' + +### Include the Ruby code directly + +Include the Ruby code directly using `-I` as follows: + +```shell +ruby -Ilib script.rb +``` + +## Getting Started + +Please follow the [installation](#installation) procedure and then run the following code: + +```ruby +# Load the gem +require 'line-bot-api' + +# Setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' + # Configure a proc to get access tokens in lieu of the static access_token configuration + config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' } +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +audience_match_messages_request = LINE::Client::MessagingApi::AudienceMatchMessagesRequest.new({messages: [LINE::Client::MessagingApi::Message.new({type: 'type_example'})], to: ['to_example']}) # AudienceMatchMessagesRequest | + +begin + api_instance.audience_match(audience_match_messages_request) +rescue LINE::Client::MessagingApi::ApiError => e + puts "Exception when calling MessagingApiApi->audience_match: #{e}" +end + +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://api.line.me* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*LINE::Client::MessagingApi::MessagingApiApi* | [**audience_match**](docs/MessagingApiApi.md#audience_match) | **POST** /bot/ad/multicast/phone | +*LINE::Client::MessagingApi::MessagingApiApi* | [**broadcast**](docs/MessagingApiApi.md#broadcast) | **POST** /v2/bot/message/broadcast | +*LINE::Client::MessagingApi::MessagingApiApi* | [**cancel_default_rich_menu**](docs/MessagingApiApi.md#cancel_default_rich_menu) | **DELETE** /v2/bot/user/all/richmenu | +*LINE::Client::MessagingApi::MessagingApiApi* | [**create_rich_menu**](docs/MessagingApiApi.md#create_rich_menu) | **POST** /v2/bot/richmenu | +*LINE::Client::MessagingApi::MessagingApiApi* | [**create_rich_menu_alias**](docs/MessagingApiApi.md#create_rich_menu_alias) | **POST** /v2/bot/richmenu/alias | +*LINE::Client::MessagingApi::MessagingApiApi* | [**delete_rich_menu**](docs/MessagingApiApi.md#delete_rich_menu) | **DELETE** /v2/bot/richmenu/{richMenuId} | +*LINE::Client::MessagingApi::MessagingApiApi* | [**delete_rich_menu_alias**](docs/MessagingApiApi.md#delete_rich_menu_alias) | **DELETE** /v2/bot/richmenu/alias/{richMenuAliasId} | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_ad_phone_message_statistics**](docs/MessagingApiApi.md#get_ad_phone_message_statistics) | **GET** /v2/bot/message/delivery/ad_phone | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_aggregation_unit_name_list**](docs/MessagingApiApi.md#get_aggregation_unit_name_list) | **GET** /v2/bot/message/aggregation/list | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_aggregation_unit_usage**](docs/MessagingApiApi.md#get_aggregation_unit_usage) | **GET** /v2/bot/message/aggregation/info | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_bot_info**](docs/MessagingApiApi.md#get_bot_info) | **GET** /v2/bot/info | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_default_rich_menu_id**](docs/MessagingApiApi.md#get_default_rich_menu_id) | **GET** /v2/bot/user/all/richmenu | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_followers**](docs/MessagingApiApi.md#get_followers) | **GET** /v2/bot/followers/ids | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_group_member_count**](docs/MessagingApiApi.md#get_group_member_count) | **GET** /v2/bot/group/{groupId}/members/count | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_group_member_profile**](docs/MessagingApiApi.md#get_group_member_profile) | **GET** /v2/bot/group/{groupId}/member/{userId} | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_group_members_ids**](docs/MessagingApiApi.md#get_group_members_ids) | **GET** /v2/bot/group/{groupId}/members/ids | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_group_summary**](docs/MessagingApiApi.md#get_group_summary) | **GET** /v2/bot/group/{groupId}/summary | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_message_quota**](docs/MessagingApiApi.md#get_message_quota) | **GET** /v2/bot/message/quota | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_message_quota_consumption**](docs/MessagingApiApi.md#get_message_quota_consumption) | **GET** /v2/bot/message/quota/consumption | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_narrowcast_progress**](docs/MessagingApiApi.md#get_narrowcast_progress) | **GET** /v2/bot/message/progress/narrowcast | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_number_of_sent_broadcast_messages**](docs/MessagingApiApi.md#get_number_of_sent_broadcast_messages) | **GET** /v2/bot/message/delivery/broadcast | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_number_of_sent_multicast_messages**](docs/MessagingApiApi.md#get_number_of_sent_multicast_messages) | **GET** /v2/bot/message/delivery/multicast | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_number_of_sent_push_messages**](docs/MessagingApiApi.md#get_number_of_sent_push_messages) | **GET** /v2/bot/message/delivery/push | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_number_of_sent_reply_messages**](docs/MessagingApiApi.md#get_number_of_sent_reply_messages) | **GET** /v2/bot/message/delivery/reply | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_pnp_message_statistics**](docs/MessagingApiApi.md#get_pnp_message_statistics) | **GET** /v2/bot/message/delivery/pnp | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_profile**](docs/MessagingApiApi.md#get_profile) | **GET** /v2/bot/profile/{userId} | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_rich_menu**](docs/MessagingApiApi.md#get_rich_menu) | **GET** /v2/bot/richmenu/{richMenuId} | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_rich_menu_alias**](docs/MessagingApiApi.md#get_rich_menu_alias) | **GET** /v2/bot/richmenu/alias/{richMenuAliasId} | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_rich_menu_alias_list**](docs/MessagingApiApi.md#get_rich_menu_alias_list) | **GET** /v2/bot/richmenu/alias/list | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_rich_menu_batch_progress**](docs/MessagingApiApi.md#get_rich_menu_batch_progress) | **GET** /v2/bot/richmenu/progress/batch | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_rich_menu_id_of_user**](docs/MessagingApiApi.md#get_rich_menu_id_of_user) | **GET** /v2/bot/user/{userId}/richmenu | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_rich_menu_list**](docs/MessagingApiApi.md#get_rich_menu_list) | **GET** /v2/bot/richmenu/list | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_room_member_count**](docs/MessagingApiApi.md#get_room_member_count) | **GET** /v2/bot/room/{roomId}/members/count | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_room_member_profile**](docs/MessagingApiApi.md#get_room_member_profile) | **GET** /v2/bot/room/{roomId}/member/{userId} | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_room_members_ids**](docs/MessagingApiApi.md#get_room_members_ids) | **GET** /v2/bot/room/{roomId}/members/ids | +*LINE::Client::MessagingApi::MessagingApiApi* | [**get_webhook_endpoint**](docs/MessagingApiApi.md#get_webhook_endpoint) | **GET** /v2/bot/channel/webhook/endpoint | +*LINE::Client::MessagingApi::MessagingApiApi* | [**issue_link_token**](docs/MessagingApiApi.md#issue_link_token) | **POST** /v2/bot/user/{userId}/linkToken | +*LINE::Client::MessagingApi::MessagingApiApi* | [**leave_group**](docs/MessagingApiApi.md#leave_group) | **POST** /v2/bot/group/{groupId}/leave | +*LINE::Client::MessagingApi::MessagingApiApi* | [**leave_room**](docs/MessagingApiApi.md#leave_room) | **POST** /v2/bot/room/{roomId}/leave | +*LINE::Client::MessagingApi::MessagingApiApi* | [**link_rich_menu_id_to_user**](docs/MessagingApiApi.md#link_rich_menu_id_to_user) | **POST** /v2/bot/user/{userId}/richmenu/{richMenuId} | +*LINE::Client::MessagingApi::MessagingApiApi* | [**link_rich_menu_id_to_users**](docs/MessagingApiApi.md#link_rich_menu_id_to_users) | **POST** /v2/bot/richmenu/bulk/link | +*LINE::Client::MessagingApi::MessagingApiApi* | [**mark_messages_as_read**](docs/MessagingApiApi.md#mark_messages_as_read) | **POST** /v2/bot/message/markAsRead | +*LINE::Client::MessagingApi::MessagingApiApi* | [**multicast**](docs/MessagingApiApi.md#multicast) | **POST** /v2/bot/message/multicast | +*LINE::Client::MessagingApi::MessagingApiApi* | [**narrowcast**](docs/MessagingApiApi.md#narrowcast) | **POST** /v2/bot/message/narrowcast | +*LINE::Client::MessagingApi::MessagingApiApi* | [**push_message**](docs/MessagingApiApi.md#push_message) | **POST** /v2/bot/message/push | +*LINE::Client::MessagingApi::MessagingApiApi* | [**push_messages_by_phone**](docs/MessagingApiApi.md#push_messages_by_phone) | **POST** /bot/pnp/push | +*LINE::Client::MessagingApi::MessagingApiApi* | [**reply_message**](docs/MessagingApiApi.md#reply_message) | **POST** /v2/bot/message/reply | +*LINE::Client::MessagingApi::MessagingApiApi* | [**rich_menu_batch**](docs/MessagingApiApi.md#rich_menu_batch) | **POST** /v2/bot/richmenu/batch | +*LINE::Client::MessagingApi::MessagingApiApi* | [**set_default_rich_menu**](docs/MessagingApiApi.md#set_default_rich_menu) | **POST** /v2/bot/user/all/richmenu/{richMenuId} | +*LINE::Client::MessagingApi::MessagingApiApi* | [**set_webhook_endpoint**](docs/MessagingApiApi.md#set_webhook_endpoint) | **PUT** /v2/bot/channel/webhook/endpoint | +*LINE::Client::MessagingApi::MessagingApiApi* | [**test_webhook_endpoint**](docs/MessagingApiApi.md#test_webhook_endpoint) | **POST** /v2/bot/channel/webhook/test | +*LINE::Client::MessagingApi::MessagingApiApi* | [**unlink_rich_menu_id_from_user**](docs/MessagingApiApi.md#unlink_rich_menu_id_from_user) | **DELETE** /v2/bot/user/{userId}/richmenu | +*LINE::Client::MessagingApi::MessagingApiApi* | [**unlink_rich_menu_id_from_users**](docs/MessagingApiApi.md#unlink_rich_menu_id_from_users) | **POST** /v2/bot/richmenu/bulk/unlink | +*LINE::Client::MessagingApi::MessagingApiApi* | [**update_rich_menu_alias**](docs/MessagingApiApi.md#update_rich_menu_alias) | **POST** /v2/bot/richmenu/alias/{richMenuAliasId} | +*LINE::Client::MessagingApi::MessagingApiApi* | [**validate_broadcast**](docs/MessagingApiApi.md#validate_broadcast) | **POST** /v2/bot/message/validate/broadcast | +*LINE::Client::MessagingApi::MessagingApiApi* | [**validate_multicast**](docs/MessagingApiApi.md#validate_multicast) | **POST** /v2/bot/message/validate/multicast | +*LINE::Client::MessagingApi::MessagingApiApi* | [**validate_narrowcast**](docs/MessagingApiApi.md#validate_narrowcast) | **POST** /v2/bot/message/validate/narrowcast | +*LINE::Client::MessagingApi::MessagingApiApi* | [**validate_push**](docs/MessagingApiApi.md#validate_push) | **POST** /v2/bot/message/validate/push | +*LINE::Client::MessagingApi::MessagingApiApi* | [**validate_reply**](docs/MessagingApiApi.md#validate_reply) | **POST** /v2/bot/message/validate/reply | +*LINE::Client::MessagingApi::MessagingApiApi* | [**validate_rich_menu_batch_request**](docs/MessagingApiApi.md#validate_rich_menu_batch_request) | **POST** /v2/bot/richmenu/validate/batch | +*LINE::Client::MessagingApi::MessagingApiApi* | [**validate_rich_menu_object**](docs/MessagingApiApi.md#validate_rich_menu_object) | **POST** /v2/bot/richmenu/validate | +*LINE::Client::MessagingApi::MessagingApiBlobApi* | [**get_message_content**](docs/MessagingApiBlobApi.md#get_message_content) | **GET** /v2/bot/message/{messageId}/content | +*LINE::Client::MessagingApi::MessagingApiBlobApi* | [**get_message_content_preview**](docs/MessagingApiBlobApi.md#get_message_content_preview) | **GET** /v2/bot/message/{messageId}/content/preview | +*LINE::Client::MessagingApi::MessagingApiBlobApi* | [**get_message_content_transcoding_by_message_id**](docs/MessagingApiBlobApi.md#get_message_content_transcoding_by_message_id) | **GET** /v2/bot/message/{messageId}/content/transcoding | +*LINE::Client::MessagingApi::MessagingApiBlobApi* | [**get_rich_menu_image**](docs/MessagingApiBlobApi.md#get_rich_menu_image) | **GET** /v2/bot/richmenu/{richMenuId}/content | +*LINE::Client::MessagingApi::MessagingApiBlobApi* | [**set_rich_menu_image**](docs/MessagingApiBlobApi.md#set_rich_menu_image) | **POST** /v2/bot/richmenu/{richMenuId}/content | + + +## Documentation for Models + + - [LINE::Client::MessagingApi::Action](docs/Action.md) + - [LINE::Client::MessagingApi::AgeDemographic](docs/AgeDemographic.md) + - [LINE::Client::MessagingApi::AgeDemographicFilter](docs/AgeDemographicFilter.md) + - [LINE::Client::MessagingApi::AltUri](docs/AltUri.md) + - [LINE::Client::MessagingApi::AppTypeDemographic](docs/AppTypeDemographic.md) + - [LINE::Client::MessagingApi::AppTypeDemographicFilter](docs/AppTypeDemographicFilter.md) + - [LINE::Client::MessagingApi::AreaDemographic](docs/AreaDemographic.md) + - [LINE::Client::MessagingApi::AreaDemographicFilter](docs/AreaDemographicFilter.md) + - [LINE::Client::MessagingApi::AudienceMatchMessagesRequest](docs/AudienceMatchMessagesRequest.md) + - [LINE::Client::MessagingApi::AudienceRecipient](docs/AudienceRecipient.md) + - [LINE::Client::MessagingApi::AudioMessage](docs/AudioMessage.md) + - [LINE::Client::MessagingApi::BotInfoResponse](docs/BotInfoResponse.md) + - [LINE::Client::MessagingApi::BroadcastRequest](docs/BroadcastRequest.md) + - [LINE::Client::MessagingApi::ButtonsTemplate](docs/ButtonsTemplate.md) + - [LINE::Client::MessagingApi::CameraAction](docs/CameraAction.md) + - [LINE::Client::MessagingApi::CameraRollAction](docs/CameraRollAction.md) + - [LINE::Client::MessagingApi::CarouselColumn](docs/CarouselColumn.md) + - [LINE::Client::MessagingApi::CarouselTemplate](docs/CarouselTemplate.md) + - [LINE::Client::MessagingApi::ChatReference](docs/ChatReference.md) + - [LINE::Client::MessagingApi::ConfirmTemplate](docs/ConfirmTemplate.md) + - [LINE::Client::MessagingApi::CreateRichMenuAliasRequest](docs/CreateRichMenuAliasRequest.md) + - [LINE::Client::MessagingApi::DatetimePickerAction](docs/DatetimePickerAction.md) + - [LINE::Client::MessagingApi::DemographicFilter](docs/DemographicFilter.md) + - [LINE::Client::MessagingApi::Emoji](docs/Emoji.md) + - [LINE::Client::MessagingApi::ErrorDetail](docs/ErrorDetail.md) + - [LINE::Client::MessagingApi::ErrorResponse](docs/ErrorResponse.md) + - [LINE::Client::MessagingApi::Filter](docs/Filter.md) + - [LINE::Client::MessagingApi::FlexBlockStyle](docs/FlexBlockStyle.md) + - [LINE::Client::MessagingApi::FlexBox](docs/FlexBox.md) + - [LINE::Client::MessagingApi::FlexBoxBackground](docs/FlexBoxBackground.md) + - [LINE::Client::MessagingApi::FlexBoxLinearGradient](docs/FlexBoxLinearGradient.md) + - [LINE::Client::MessagingApi::FlexBubble](docs/FlexBubble.md) + - [LINE::Client::MessagingApi::FlexBubbleStyles](docs/FlexBubbleStyles.md) + - [LINE::Client::MessagingApi::FlexButton](docs/FlexButton.md) + - [LINE::Client::MessagingApi::FlexCarousel](docs/FlexCarousel.md) + - [LINE::Client::MessagingApi::FlexComponent](docs/FlexComponent.md) + - [LINE::Client::MessagingApi::FlexContainer](docs/FlexContainer.md) + - [LINE::Client::MessagingApi::FlexFiller](docs/FlexFiller.md) + - [LINE::Client::MessagingApi::FlexIcon](docs/FlexIcon.md) + - [LINE::Client::MessagingApi::FlexImage](docs/FlexImage.md) + - [LINE::Client::MessagingApi::FlexMessage](docs/FlexMessage.md) + - [LINE::Client::MessagingApi::FlexSeparator](docs/FlexSeparator.md) + - [LINE::Client::MessagingApi::FlexSpan](docs/FlexSpan.md) + - [LINE::Client::MessagingApi::FlexText](docs/FlexText.md) + - [LINE::Client::MessagingApi::FlexVideo](docs/FlexVideo.md) + - [LINE::Client::MessagingApi::GenderDemographic](docs/GenderDemographic.md) + - [LINE::Client::MessagingApi::GenderDemographicFilter](docs/GenderDemographicFilter.md) + - [LINE::Client::MessagingApi::GetAggregationUnitNameListResponse](docs/GetAggregationUnitNameListResponse.md) + - [LINE::Client::MessagingApi::GetAggregationUnitUsageResponse](docs/GetAggregationUnitUsageResponse.md) + - [LINE::Client::MessagingApi::GetFollowersResponse](docs/GetFollowersResponse.md) + - [LINE::Client::MessagingApi::GetMessageContentTranscodingResponse](docs/GetMessageContentTranscodingResponse.md) + - [LINE::Client::MessagingApi::GetWebhookEndpointResponse](docs/GetWebhookEndpointResponse.md) + - [LINE::Client::MessagingApi::GroupMemberCountResponse](docs/GroupMemberCountResponse.md) + - [LINE::Client::MessagingApi::GroupSummaryResponse](docs/GroupSummaryResponse.md) + - [LINE::Client::MessagingApi::GroupUserProfileResponse](docs/GroupUserProfileResponse.md) + - [LINE::Client::MessagingApi::ImageCarouselColumn](docs/ImageCarouselColumn.md) + - [LINE::Client::MessagingApi::ImageCarouselTemplate](docs/ImageCarouselTemplate.md) + - [LINE::Client::MessagingApi::ImageMessage](docs/ImageMessage.md) + - [LINE::Client::MessagingApi::ImagemapAction](docs/ImagemapAction.md) + - [LINE::Client::MessagingApi::ImagemapArea](docs/ImagemapArea.md) + - [LINE::Client::MessagingApi::ImagemapBaseSize](docs/ImagemapBaseSize.md) + - [LINE::Client::MessagingApi::ImagemapExternalLink](docs/ImagemapExternalLink.md) + - [LINE::Client::MessagingApi::ImagemapMessage](docs/ImagemapMessage.md) + - [LINE::Client::MessagingApi::ImagemapVideo](docs/ImagemapVideo.md) + - [LINE::Client::MessagingApi::IssueLinkTokenResponse](docs/IssueLinkTokenResponse.md) + - [LINE::Client::MessagingApi::Limit](docs/Limit.md) + - [LINE::Client::MessagingApi::LocationAction](docs/LocationAction.md) + - [LINE::Client::MessagingApi::LocationMessage](docs/LocationMessage.md) + - [LINE::Client::MessagingApi::MarkMessagesAsReadRequest](docs/MarkMessagesAsReadRequest.md) + - [LINE::Client::MessagingApi::MembersIdsResponse](docs/MembersIdsResponse.md) + - [LINE::Client::MessagingApi::Message](docs/Message.md) + - [LINE::Client::MessagingApi::MessageAction](docs/MessageAction.md) + - [LINE::Client::MessagingApi::MessageImagemapAction](docs/MessageImagemapAction.md) + - [LINE::Client::MessagingApi::MessageQuotaResponse](docs/MessageQuotaResponse.md) + - [LINE::Client::MessagingApi::MulticastRequest](docs/MulticastRequest.md) + - [LINE::Client::MessagingApi::NarrowcastProgressResponse](docs/NarrowcastProgressResponse.md) + - [LINE::Client::MessagingApi::NarrowcastRequest](docs/NarrowcastRequest.md) + - [LINE::Client::MessagingApi::NumberOfMessagesResponse](docs/NumberOfMessagesResponse.md) + - [LINE::Client::MessagingApi::OperatorDemographicFilter](docs/OperatorDemographicFilter.md) + - [LINE::Client::MessagingApi::OperatorRecipient](docs/OperatorRecipient.md) + - [LINE::Client::MessagingApi::PnpMessagesRequest](docs/PnpMessagesRequest.md) + - [LINE::Client::MessagingApi::PostbackAction](docs/PostbackAction.md) + - [LINE::Client::MessagingApi::PushMessageRequest](docs/PushMessageRequest.md) + - [LINE::Client::MessagingApi::PushMessageResponse](docs/PushMessageResponse.md) + - [LINE::Client::MessagingApi::QuickReply](docs/QuickReply.md) + - [LINE::Client::MessagingApi::QuickReplyItem](docs/QuickReplyItem.md) + - [LINE::Client::MessagingApi::QuotaConsumptionResponse](docs/QuotaConsumptionResponse.md) + - [LINE::Client::MessagingApi::QuotaType](docs/QuotaType.md) + - [LINE::Client::MessagingApi::Recipient](docs/Recipient.md) + - [LINE::Client::MessagingApi::RedeliveryRecipient](docs/RedeliveryRecipient.md) + - [LINE::Client::MessagingApi::ReplyMessageRequest](docs/ReplyMessageRequest.md) + - [LINE::Client::MessagingApi::ReplyMessageResponse](docs/ReplyMessageResponse.md) + - [LINE::Client::MessagingApi::RichMenuAliasListResponse](docs/RichMenuAliasListResponse.md) + - [LINE::Client::MessagingApi::RichMenuAliasResponse](docs/RichMenuAliasResponse.md) + - [LINE::Client::MessagingApi::RichMenuArea](docs/RichMenuArea.md) + - [LINE::Client::MessagingApi::RichMenuBatchLinkOperation](docs/RichMenuBatchLinkOperation.md) + - [LINE::Client::MessagingApi::RichMenuBatchOperation](docs/RichMenuBatchOperation.md) + - [LINE::Client::MessagingApi::RichMenuBatchProgressPhase](docs/RichMenuBatchProgressPhase.md) + - [LINE::Client::MessagingApi::RichMenuBatchProgressResponse](docs/RichMenuBatchProgressResponse.md) + - [LINE::Client::MessagingApi::RichMenuBatchRequest](docs/RichMenuBatchRequest.md) + - [LINE::Client::MessagingApi::RichMenuBatchUnlinkAllOperation](docs/RichMenuBatchUnlinkAllOperation.md) + - [LINE::Client::MessagingApi::RichMenuBatchUnlinkOperation](docs/RichMenuBatchUnlinkOperation.md) + - [LINE::Client::MessagingApi::RichMenuBounds](docs/RichMenuBounds.md) + - [LINE::Client::MessagingApi::RichMenuBulkLinkRequest](docs/RichMenuBulkLinkRequest.md) + - [LINE::Client::MessagingApi::RichMenuBulkUnlinkRequest](docs/RichMenuBulkUnlinkRequest.md) + - [LINE::Client::MessagingApi::RichMenuIdResponse](docs/RichMenuIdResponse.md) + - [LINE::Client::MessagingApi::RichMenuListResponse](docs/RichMenuListResponse.md) + - [LINE::Client::MessagingApi::RichMenuRequest](docs/RichMenuRequest.md) + - [LINE::Client::MessagingApi::RichMenuResponse](docs/RichMenuResponse.md) + - [LINE::Client::MessagingApi::RichMenuSize](docs/RichMenuSize.md) + - [LINE::Client::MessagingApi::RichMenuSwitchAction](docs/RichMenuSwitchAction.md) + - [LINE::Client::MessagingApi::RoomMemberCountResponse](docs/RoomMemberCountResponse.md) + - [LINE::Client::MessagingApi::RoomUserProfileResponse](docs/RoomUserProfileResponse.md) + - [LINE::Client::MessagingApi::Sender](docs/Sender.md) + - [LINE::Client::MessagingApi::SentMessage](docs/SentMessage.md) + - [LINE::Client::MessagingApi::SetWebhookEndpointRequest](docs/SetWebhookEndpointRequest.md) + - [LINE::Client::MessagingApi::StickerMessage](docs/StickerMessage.md) + - [LINE::Client::MessagingApi::SubscriptionPeriodDemographic](docs/SubscriptionPeriodDemographic.md) + - [LINE::Client::MessagingApi::SubscriptionPeriodDemographicFilter](docs/SubscriptionPeriodDemographicFilter.md) + - [LINE::Client::MessagingApi::Template](docs/Template.md) + - [LINE::Client::MessagingApi::TemplateMessage](docs/TemplateMessage.md) + - [LINE::Client::MessagingApi::TestWebhookEndpointRequest](docs/TestWebhookEndpointRequest.md) + - [LINE::Client::MessagingApi::TestWebhookEndpointResponse](docs/TestWebhookEndpointResponse.md) + - [LINE::Client::MessagingApi::TextMessage](docs/TextMessage.md) + - [LINE::Client::MessagingApi::URIAction](docs/URIAction.md) + - [LINE::Client::MessagingApi::URIImagemapAction](docs/URIImagemapAction.md) + - [LINE::Client::MessagingApi::UpdateRichMenuAliasRequest](docs/UpdateRichMenuAliasRequest.md) + - [LINE::Client::MessagingApi::UserProfileResponse](docs/UserProfileResponse.md) + - [LINE::Client::MessagingApi::ValidateMessageRequest](docs/ValidateMessageRequest.md) + - [LINE::Client::MessagingApi::VideoMessage](docs/VideoMessage.md) + + +## Documentation for Authorization + + +Authentication schemes defined for the API: +### Bearer + +- **Type**: Bearer authentication + diff --git a/lib/clients/messaging-api/docs/Action.md b/lib/clients/messaging-api/docs/Action.md new file mode 100644 index 00000000..e3527979 --- /dev/null +++ b/lib/clients/messaging-api/docs/Action.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::Action + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | Type of action | [optional] | +| **label** | **String** | Label for the action. | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::Action.new( + type: null, + label: null +) +``` + diff --git a/lib/clients/messaging-api/docs/AgeDemographic.md b/lib/clients/messaging-api/docs/AgeDemographic.md new file mode 100644 index 00000000..e10f8638 --- /dev/null +++ b/lib/clients/messaging-api/docs/AgeDemographic.md @@ -0,0 +1,15 @@ +# LINE::Client::MessagingApi::AgeDemographic + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::AgeDemographic.new() +``` + diff --git a/lib/clients/messaging-api/docs/AgeDemographicFilter.md b/lib/clients/messaging-api/docs/AgeDemographicFilter.md new file mode 100644 index 00000000..cfd675ef --- /dev/null +++ b/lib/clients/messaging-api/docs/AgeDemographicFilter.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::AgeDemographicFilter + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **gte** | [**AgeDemographic**](AgeDemographic.md) | | [optional] | +| **lt** | [**AgeDemographic**](AgeDemographic.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::AgeDemographicFilter.new( + gte: null, + lt: null +) +``` + diff --git a/lib/clients/messaging-api/docs/AgeDemographicFilterAllOf.md b/lib/clients/messaging-api/docs/AgeDemographicFilterAllOf.md new file mode 100644 index 00000000..8cb80e2e --- /dev/null +++ b/lib/clients/messaging-api/docs/AgeDemographicFilterAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::AgeDemographicFilterAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **gte** | [**AgeDemographic**](AgeDemographic.md) | | [optional] | +| **lt** | [**AgeDemographic**](AgeDemographic.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::AgeDemographicFilterAllOf.new( + gte: null, + lt: null +) +``` + diff --git a/lib/clients/messaging-api/docs/AltUri.md b/lib/clients/messaging-api/docs/AltUri.md new file mode 100644 index 00000000..28819898 --- /dev/null +++ b/lib/clients/messaging-api/docs/AltUri.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::AltUri + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **desktop** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::AltUri.new( + desktop: null +) +``` + diff --git a/lib/clients/messaging-api/docs/AppTypeDemographic.md b/lib/clients/messaging-api/docs/AppTypeDemographic.md new file mode 100644 index 00000000..a6380624 --- /dev/null +++ b/lib/clients/messaging-api/docs/AppTypeDemographic.md @@ -0,0 +1,15 @@ +# LINE::Client::MessagingApi::AppTypeDemographic + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::AppTypeDemographic.new() +``` + diff --git a/lib/clients/messaging-api/docs/AppTypeDemographicFilter.md b/lib/clients/messaging-api/docs/AppTypeDemographicFilter.md new file mode 100644 index 00000000..d8e94858 --- /dev/null +++ b/lib/clients/messaging-api/docs/AppTypeDemographicFilter.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::AppTypeDemographicFilter + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **one_of** | [**Array<AppTypeDemographic>**](AppTypeDemographic.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::AppTypeDemographicFilter.new( + one_of: null +) +``` + diff --git a/lib/clients/messaging-api/docs/AppTypeDemographicFilterAllOf.md b/lib/clients/messaging-api/docs/AppTypeDemographicFilterAllOf.md new file mode 100644 index 00000000..f9c1b16f --- /dev/null +++ b/lib/clients/messaging-api/docs/AppTypeDemographicFilterAllOf.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::AppTypeDemographicFilterAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **one_of** | [**Array<AppTypeDemographic>**](AppTypeDemographic.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::AppTypeDemographicFilterAllOf.new( + one_of: null +) +``` + diff --git a/lib/clients/messaging-api/docs/AreaDemographic.md b/lib/clients/messaging-api/docs/AreaDemographic.md new file mode 100644 index 00000000..f357c44b --- /dev/null +++ b/lib/clients/messaging-api/docs/AreaDemographic.md @@ -0,0 +1,15 @@ +# LINE::Client::MessagingApi::AreaDemographic + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::AreaDemographic.new() +``` + diff --git a/lib/clients/messaging-api/docs/AreaDemographicFilter.md b/lib/clients/messaging-api/docs/AreaDemographicFilter.md new file mode 100644 index 00000000..a85415b4 --- /dev/null +++ b/lib/clients/messaging-api/docs/AreaDemographicFilter.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::AreaDemographicFilter + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **one_of** | [**Array<AreaDemographic>**](AreaDemographic.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::AreaDemographicFilter.new( + one_of: null +) +``` + diff --git a/lib/clients/messaging-api/docs/AreaDemographicFilterAllOf.md b/lib/clients/messaging-api/docs/AreaDemographicFilterAllOf.md new file mode 100644 index 00000000..0aca747f --- /dev/null +++ b/lib/clients/messaging-api/docs/AreaDemographicFilterAllOf.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::AreaDemographicFilterAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **one_of** | [**Array<AreaDemographic>**](AreaDemographic.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::AreaDemographicFilterAllOf.new( + one_of: null +) +``` + diff --git a/lib/clients/messaging-api/docs/AudienceMatchMessagesRequest.md b/lib/clients/messaging-api/docs/AudienceMatchMessagesRequest.md new file mode 100644 index 00000000..df1974ba --- /dev/null +++ b/lib/clients/messaging-api/docs/AudienceMatchMessagesRequest.md @@ -0,0 +1,22 @@ +# LINE::Client::MessagingApi::AudienceMatchMessagesRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **messages** | [**Array<Message>**](Message.md) | Destination of the message (A value obtained by hashing the telephone number, which is another value normalized to E.164 format, with SHA256). | | +| **to** | **Array<String>** | Message to send. | | +| **notification_disabled** | **Boolean** | `true`: The user doesn’t receive a push notification when a message is sent. `false`: The user receives a push notification when the message is sent (unless they have disabled push notifications in LINE and/or their device). The default value is false. | [optional][default to false] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::AudienceMatchMessagesRequest.new( + messages: null, + to: null, + notification_disabled: null +) +``` + diff --git a/lib/clients/messaging-api/docs/AudienceRecipient.md b/lib/clients/messaging-api/docs/AudienceRecipient.md new file mode 100644 index 00000000..01370821 --- /dev/null +++ b/lib/clients/messaging-api/docs/AudienceRecipient.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::AudienceRecipient + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **audience_group_id** | **Integer** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::AudienceRecipient.new( + audience_group_id: null +) +``` + diff --git a/lib/clients/messaging-api/docs/AudienceRecipientAllOf.md b/lib/clients/messaging-api/docs/AudienceRecipientAllOf.md new file mode 100644 index 00000000..c571b361 --- /dev/null +++ b/lib/clients/messaging-api/docs/AudienceRecipientAllOf.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::AudienceRecipientAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **audience_group_id** | **Integer** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::AudienceRecipientAllOf.new( + audience_group_id: null +) +``` + diff --git a/lib/clients/messaging-api/docs/AudioMessage.md b/lib/clients/messaging-api/docs/AudioMessage.md new file mode 100644 index 00000000..0e70dd0c --- /dev/null +++ b/lib/clients/messaging-api/docs/AudioMessage.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::AudioMessage + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **original_content_url** | **String** | | [optional] | +| **duration** | **Integer** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::AudioMessage.new( + original_content_url: null, + duration: null +) +``` + diff --git a/lib/clients/messaging-api/docs/AudioMessageAllOf.md b/lib/clients/messaging-api/docs/AudioMessageAllOf.md new file mode 100644 index 00000000..2b0db6a6 --- /dev/null +++ b/lib/clients/messaging-api/docs/AudioMessageAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::AudioMessageAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **original_content_url** | **String** | | [optional] | +| **duration** | **Integer** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::AudioMessageAllOf.new( + original_content_url: null, + duration: null +) +``` + diff --git a/lib/clients/messaging-api/docs/BotInfoResponse.md b/lib/clients/messaging-api/docs/BotInfoResponse.md new file mode 100644 index 00000000..17b2b6f0 --- /dev/null +++ b/lib/clients/messaging-api/docs/BotInfoResponse.md @@ -0,0 +1,30 @@ +# LINE::Client::MessagingApi::BotInfoResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **user_id** | **String** | Bot's user ID | | +| **basic_id** | **String** | Bot's basic ID | | +| **premium_id** | **String** | Bot's premium ID. Not included in the response if the premium ID isn't set. | [optional] | +| **display_name** | **String** | Bot's display name | | +| **picture_url** | **String** | Profile image URL. `https` image URL. Not included in the response if the bot doesn't have a profile image. | [optional] | +| **chat_mode** | **String** | Chat settings set in the LINE Official Account Manager. One of: `chat`: Chat is set to \"On\". `bot`: Chat is set to \"Off\". | | +| **mark_as_read_mode** | **String** | Automatic read setting for messages. If the chat is set to \"Off\", auto is returned. If the chat is set to \"On\", manual is returned. `auto`: Auto read setting is enabled. `manual`: Auto read setting is disabled. | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::BotInfoResponse.new( + user_id: null, + basic_id: null, + premium_id: null, + display_name: null, + picture_url: null, + chat_mode: null, + mark_as_read_mode: null +) +``` + diff --git a/lib/clients/messaging-api/docs/BroadcastRequest.md b/lib/clients/messaging-api/docs/BroadcastRequest.md new file mode 100644 index 00000000..26b6acc8 --- /dev/null +++ b/lib/clients/messaging-api/docs/BroadcastRequest.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::BroadcastRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **messages** | [**Array<Message>**](Message.md) | List of Message objects. | | +| **notification_disabled** | **Boolean** | `true`: The user doesn’t receive a push notification when a message is sent. `false`: The user receives a push notification when the message is sent (unless they have disabled push notifications in LINE and/or their device). The default value is false. | [optional][default to false] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::BroadcastRequest.new( + messages: null, + notification_disabled: null +) +``` + diff --git a/lib/clients/messaging-api/docs/ButtonsTemplate.md b/lib/clients/messaging-api/docs/ButtonsTemplate.md new file mode 100644 index 00000000..6dd1dc19 --- /dev/null +++ b/lib/clients/messaging-api/docs/ButtonsTemplate.md @@ -0,0 +1,32 @@ +# LINE::Client::MessagingApi::ButtonsTemplate + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **thumbnail_image_url** | **String** | | [optional] | +| **image_aspect_ratio** | **String** | | [optional] | +| **image_size** | **String** | | [optional] | +| **image_background_color** | **String** | | [optional] | +| **title** | **String** | | [optional] | +| **text** | **String** | | [optional] | +| **default_action** | [**Action**](Action.md) | | [optional] | +| **actions** | [**Array<Action>**](Action.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::ButtonsTemplate.new( + thumbnail_image_url: null, + image_aspect_ratio: null, + image_size: null, + image_background_color: null, + title: null, + text: null, + default_action: null, + actions: null +) +``` + diff --git a/lib/clients/messaging-api/docs/ButtonsTemplateAllOf.md b/lib/clients/messaging-api/docs/ButtonsTemplateAllOf.md new file mode 100644 index 00000000..1d7ab302 --- /dev/null +++ b/lib/clients/messaging-api/docs/ButtonsTemplateAllOf.md @@ -0,0 +1,32 @@ +# LINE::Client::MessagingApi::ButtonsTemplateAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **thumbnail_image_url** | **String** | | [optional] | +| **image_aspect_ratio** | **String** | | [optional] | +| **image_size** | **String** | | [optional] | +| **image_background_color** | **String** | | [optional] | +| **title** | **String** | | [optional] | +| **text** | **String** | | [optional] | +| **default_action** | [**Action**](Action.md) | | [optional] | +| **actions** | [**Array<Action>**](Action.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::ButtonsTemplateAllOf.new( + thumbnail_image_url: null, + image_aspect_ratio: null, + image_size: null, + image_background_color: null, + title: null, + text: null, + default_action: null, + actions: null +) +``` + diff --git a/lib/clients/messaging-api/docs/CameraAction.md b/lib/clients/messaging-api/docs/CameraAction.md new file mode 100644 index 00000000..1f5397a5 --- /dev/null +++ b/lib/clients/messaging-api/docs/CameraAction.md @@ -0,0 +1,15 @@ +# LINE::Client::MessagingApi::CameraAction + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::CameraAction.new() +``` + diff --git a/lib/clients/messaging-api/docs/CameraRollAction.md b/lib/clients/messaging-api/docs/CameraRollAction.md new file mode 100644 index 00000000..949e703f --- /dev/null +++ b/lib/clients/messaging-api/docs/CameraRollAction.md @@ -0,0 +1,15 @@ +# LINE::Client::MessagingApi::CameraRollAction + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::CameraRollAction.new() +``` + diff --git a/lib/clients/messaging-api/docs/CarouselColumn.md b/lib/clients/messaging-api/docs/CarouselColumn.md new file mode 100644 index 00000000..bf20073c --- /dev/null +++ b/lib/clients/messaging-api/docs/CarouselColumn.md @@ -0,0 +1,28 @@ +# LINE::Client::MessagingApi::CarouselColumn + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **thumbnail_image_url** | **String** | | [optional] | +| **image_background_color** | **String** | | [optional] | +| **title** | **String** | | [optional] | +| **text** | **String** | | [optional] | +| **default_action** | [**Action**](Action.md) | | [optional] | +| **actions** | [**Array<Action>**](Action.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::CarouselColumn.new( + thumbnail_image_url: null, + image_background_color: null, + title: null, + text: null, + default_action: null, + actions: null +) +``` + diff --git a/lib/clients/messaging-api/docs/CarouselTemplate.md b/lib/clients/messaging-api/docs/CarouselTemplate.md new file mode 100644 index 00000000..ac35ba10 --- /dev/null +++ b/lib/clients/messaging-api/docs/CarouselTemplate.md @@ -0,0 +1,22 @@ +# LINE::Client::MessagingApi::CarouselTemplate + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **columns** | [**Array<CarouselColumn>**](CarouselColumn.md) | | [optional] | +| **image_aspect_ratio** | **String** | | [optional] | +| **image_size** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::CarouselTemplate.new( + columns: null, + image_aspect_ratio: null, + image_size: null +) +``` + diff --git a/lib/clients/messaging-api/docs/CarouselTemplateAllOf.md b/lib/clients/messaging-api/docs/CarouselTemplateAllOf.md new file mode 100644 index 00000000..0995b5f3 --- /dev/null +++ b/lib/clients/messaging-api/docs/CarouselTemplateAllOf.md @@ -0,0 +1,22 @@ +# LINE::Client::MessagingApi::CarouselTemplateAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **columns** | [**Array<CarouselColumn>**](CarouselColumn.md) | | [optional] | +| **image_aspect_ratio** | **String** | | [optional] | +| **image_size** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::CarouselTemplateAllOf.new( + columns: null, + image_aspect_ratio: null, + image_size: null +) +``` + diff --git a/lib/clients/messaging-api/docs/ChatReference.md b/lib/clients/messaging-api/docs/ChatReference.md new file mode 100644 index 00000000..40dd86d8 --- /dev/null +++ b/lib/clients/messaging-api/docs/ChatReference.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::ChatReference + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **user_id** | **String** | The target user ID | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::ChatReference.new( + user_id: null +) +``` + diff --git a/lib/clients/messaging-api/docs/ConfirmTemplate.md b/lib/clients/messaging-api/docs/ConfirmTemplate.md new file mode 100644 index 00000000..6fe52c52 --- /dev/null +++ b/lib/clients/messaging-api/docs/ConfirmTemplate.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::ConfirmTemplate + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **text** | **String** | | [optional] | +| **actions** | [**Array<Action>**](Action.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::ConfirmTemplate.new( + text: null, + actions: null +) +``` + diff --git a/lib/clients/messaging-api/docs/ConfirmTemplateAllOf.md b/lib/clients/messaging-api/docs/ConfirmTemplateAllOf.md new file mode 100644 index 00000000..be2837c2 --- /dev/null +++ b/lib/clients/messaging-api/docs/ConfirmTemplateAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::ConfirmTemplateAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **text** | **String** | | [optional] | +| **actions** | [**Array<Action>**](Action.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::ConfirmTemplateAllOf.new( + text: null, + actions: null +) +``` + diff --git a/lib/clients/messaging-api/docs/CreateRichMenuAliasRequest.md b/lib/clients/messaging-api/docs/CreateRichMenuAliasRequest.md new file mode 100644 index 00000000..72ddcc69 --- /dev/null +++ b/lib/clients/messaging-api/docs/CreateRichMenuAliasRequest.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::CreateRichMenuAliasRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rich_menu_alias_id** | **String** | Rich menu alias ID, which can be any ID, unique for each channel. | | +| **rich_menu_id** | **String** | The rich menu ID to be associated with the rich menu alias. | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::CreateRichMenuAliasRequest.new( + rich_menu_alias_id: null, + rich_menu_id: null +) +``` + diff --git a/lib/clients/messaging-api/docs/DatetimePickerAction.md b/lib/clients/messaging-api/docs/DatetimePickerAction.md new file mode 100644 index 00000000..284bdd2d --- /dev/null +++ b/lib/clients/messaging-api/docs/DatetimePickerAction.md @@ -0,0 +1,26 @@ +# LINE::Client::MessagingApi::DatetimePickerAction + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | **String** | | [optional] | +| **mode** | **String** | | [optional] | +| **initial** | **String** | | [optional] | +| **max** | **String** | | [optional] | +| **min** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::DatetimePickerAction.new( + data: null, + mode: null, + initial: null, + max: null, + min: null +) +``` + diff --git a/lib/clients/messaging-api/docs/DatetimePickerActionAllOf.md b/lib/clients/messaging-api/docs/DatetimePickerActionAllOf.md new file mode 100644 index 00000000..8057ee4e --- /dev/null +++ b/lib/clients/messaging-api/docs/DatetimePickerActionAllOf.md @@ -0,0 +1,26 @@ +# LINE::Client::MessagingApi::DatetimePickerActionAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | **String** | | [optional] | +| **mode** | **String** | | [optional] | +| **initial** | **String** | | [optional] | +| **max** | **String** | | [optional] | +| **min** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::DatetimePickerActionAllOf.new( + data: null, + mode: null, + initial: null, + max: null, + min: null +) +``` + diff --git a/lib/clients/messaging-api/docs/DemographicFilter.md b/lib/clients/messaging-api/docs/DemographicFilter.md new file mode 100644 index 00000000..cd874959 --- /dev/null +++ b/lib/clients/messaging-api/docs/DemographicFilter.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::DemographicFilter + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | Type of demographic filter | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::DemographicFilter.new( + type: null +) +``` + diff --git a/lib/clients/messaging-api/docs/Emoji.md b/lib/clients/messaging-api/docs/Emoji.md new file mode 100644 index 00000000..8814d863 --- /dev/null +++ b/lib/clients/messaging-api/docs/Emoji.md @@ -0,0 +1,22 @@ +# LINE::Client::MessagingApi::Emoji + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **index** | **Integer** | | [optional] | +| **product_id** | **String** | | [optional] | +| **emoji_id** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::Emoji.new( + index: null, + product_id: null, + emoji_id: null +) +``` + diff --git a/lib/clients/messaging-api/docs/ErrorDetail.md b/lib/clients/messaging-api/docs/ErrorDetail.md new file mode 100644 index 00000000..478cb263 --- /dev/null +++ b/lib/clients/messaging-api/docs/ErrorDetail.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::ErrorDetail + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **message** | **String** | Details of the error. Not included in the response under certain situations. | [optional] | +| **property** | **String** | Location of where the error occurred. Returns the JSON field name or query parameter name of the request. Not included in the response under certain situations. | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::ErrorDetail.new( + message: null, + property: null +) +``` + diff --git a/lib/clients/messaging-api/docs/ErrorResponse.md b/lib/clients/messaging-api/docs/ErrorResponse.md new file mode 100644 index 00000000..051794ab --- /dev/null +++ b/lib/clients/messaging-api/docs/ErrorResponse.md @@ -0,0 +1,22 @@ +# LINE::Client::MessagingApi::ErrorResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **message** | **String** | Message containing information about the error. | | +| **details** | [**Array<ErrorDetail>**](ErrorDetail.md) | An array of error details. If the array is empty, this property will not be included in the response. | [optional] | +| **sent_messages** | [**Array<SentMessage>**](SentMessage.md) | Array of sent messages. | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::ErrorResponse.new( + message: null, + details: null, + sent_messages: null +) +``` + diff --git a/lib/clients/messaging-api/docs/Filter.md b/lib/clients/messaging-api/docs/Filter.md new file mode 100644 index 00000000..d577d8ce --- /dev/null +++ b/lib/clients/messaging-api/docs/Filter.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::Filter + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **demographic** | [**DemographicFilter**](DemographicFilter.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::Filter.new( + demographic: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexBlockStyle.md b/lib/clients/messaging-api/docs/FlexBlockStyle.md new file mode 100644 index 00000000..1240be15 --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexBlockStyle.md @@ -0,0 +1,22 @@ +# LINE::Client::MessagingApi::FlexBlockStyle + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **background_color** | **String** | | [optional] | +| **separator** | **Boolean** | | [optional] | +| **separator_color** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexBlockStyle.new( + background_color: null, + separator: null, + separator_color: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexBox.md b/lib/clients/messaging-api/docs/FlexBox.md new file mode 100644 index 00000000..f5f5fa2d --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexBox.md @@ -0,0 +1,70 @@ +# LINE::Client::MessagingApi::FlexBox + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **layout** | **String** | | [optional] | +| **flex** | **Integer** | | [optional] | +| **contents** | [**Array<FlexComponent>**](FlexComponent.md) | | [optional] | +| **spacing** | **String** | | [optional] | +| **margin** | **String** | | [optional] | +| **position** | **String** | | [optional] | +| **offset_top** | **String** | | [optional] | +| **offset_bottom** | **String** | | [optional] | +| **offset_start** | **String** | | [optional] | +| **offset_end** | **String** | | [optional] | +| **background_color** | **String** | | [optional] | +| **border_color** | **String** | | [optional] | +| **border_width** | **String** | | [optional] | +| **corner_radius** | **String** | | [optional] | +| **width** | **String** | | [optional] | +| **max_width** | **String** | | [optional] | +| **height** | **String** | | [optional] | +| **max_height** | **String** | | [optional] | +| **padding_all** | **String** | | [optional] | +| **padding_top** | **String** | | [optional] | +| **padding_bottom** | **String** | | [optional] | +| **padding_start** | **String** | | [optional] | +| **padding_end** | **String** | | [optional] | +| **action** | [**Action**](Action.md) | | [optional] | +| **justify_content** | **String** | | [optional] | +| **align_items** | **String** | | [optional] | +| **background** | [**FlexBoxBackground**](FlexBoxBackground.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexBox.new( + layout: null, + flex: null, + contents: null, + spacing: null, + margin: null, + position: null, + offset_top: null, + offset_bottom: null, + offset_start: null, + offset_end: null, + background_color: null, + border_color: null, + border_width: null, + corner_radius: null, + width: null, + max_width: null, + height: null, + max_height: null, + padding_all: null, + padding_top: null, + padding_bottom: null, + padding_start: null, + padding_end: null, + action: null, + justify_content: null, + align_items: null, + background: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexBoxAllOf.md b/lib/clients/messaging-api/docs/FlexBoxAllOf.md new file mode 100644 index 00000000..ce05aac8 --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexBoxAllOf.md @@ -0,0 +1,70 @@ +# LINE::Client::MessagingApi::FlexBoxAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **layout** | **String** | | [optional] | +| **flex** | **Integer** | | [optional] | +| **contents** | [**Array<FlexComponent>**](FlexComponent.md) | | [optional] | +| **spacing** | **String** | | [optional] | +| **margin** | **String** | | [optional] | +| **position** | **String** | | [optional] | +| **offset_top** | **String** | | [optional] | +| **offset_bottom** | **String** | | [optional] | +| **offset_start** | **String** | | [optional] | +| **offset_end** | **String** | | [optional] | +| **background_color** | **String** | | [optional] | +| **border_color** | **String** | | [optional] | +| **border_width** | **String** | | [optional] | +| **corner_radius** | **String** | | [optional] | +| **width** | **String** | | [optional] | +| **max_width** | **String** | | [optional] | +| **height** | **String** | | [optional] | +| **max_height** | **String** | | [optional] | +| **padding_all** | **String** | | [optional] | +| **padding_top** | **String** | | [optional] | +| **padding_bottom** | **String** | | [optional] | +| **padding_start** | **String** | | [optional] | +| **padding_end** | **String** | | [optional] | +| **action** | [**Action**](Action.md) | | [optional] | +| **justify_content** | **String** | | [optional] | +| **align_items** | **String** | | [optional] | +| **background** | [**FlexBoxBackground**](FlexBoxBackground.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexBoxAllOf.new( + layout: null, + flex: null, + contents: null, + spacing: null, + margin: null, + position: null, + offset_top: null, + offset_bottom: null, + offset_start: null, + offset_end: null, + background_color: null, + border_color: null, + border_width: null, + corner_radius: null, + width: null, + max_width: null, + height: null, + max_height: null, + padding_all: null, + padding_top: null, + padding_bottom: null, + padding_start: null, + padding_end: null, + action: null, + justify_content: null, + align_items: null, + background: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexBoxBackground.md b/lib/clients/messaging-api/docs/FlexBoxBackground.md new file mode 100644 index 00000000..9b345c33 --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexBoxBackground.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::FlexBoxBackground + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexBoxBackground.new( + type: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexBoxLinearGradient.md b/lib/clients/messaging-api/docs/FlexBoxLinearGradient.md new file mode 100644 index 00000000..f93d4fdc --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexBoxLinearGradient.md @@ -0,0 +1,26 @@ +# LINE::Client::MessagingApi::FlexBoxLinearGradient + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **angle** | **String** | | [optional] | +| **start_color** | **String** | | [optional] | +| **end_color** | **String** | | [optional] | +| **center_color** | **String** | | [optional] | +| **center_position** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexBoxLinearGradient.new( + angle: null, + start_color: null, + end_color: null, + center_color: null, + center_position: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexBoxLinearGradientAllOf.md b/lib/clients/messaging-api/docs/FlexBoxLinearGradientAllOf.md new file mode 100644 index 00000000..6012622e --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexBoxLinearGradientAllOf.md @@ -0,0 +1,26 @@ +# LINE::Client::MessagingApi::FlexBoxLinearGradientAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **angle** | **String** | | [optional] | +| **start_color** | **String** | | [optional] | +| **end_color** | **String** | | [optional] | +| **center_color** | **String** | | [optional] | +| **center_position** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexBoxLinearGradientAllOf.new( + angle: null, + start_color: null, + end_color: null, + center_color: null, + center_position: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexBubble.md b/lib/clients/messaging-api/docs/FlexBubble.md new file mode 100644 index 00000000..91019d19 --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexBubble.md @@ -0,0 +1,32 @@ +# LINE::Client::MessagingApi::FlexBubble + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **direction** | **String** | | [optional] | +| **styles** | [**FlexBubbleStyles**](FlexBubbleStyles.md) | | [optional] | +| **header** | [**FlexBox**](FlexBox.md) | | [optional] | +| **hero** | [**FlexComponent**](FlexComponent.md) | | [optional] | +| **body** | [**FlexBox**](FlexBox.md) | | [optional] | +| **footer** | [**FlexBox**](FlexBox.md) | | [optional] | +| **size** | **String** | | [optional] | +| **action** | [**Action**](Action.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexBubble.new( + direction: null, + styles: null, + header: null, + hero: null, + body: null, + footer: null, + size: null, + action: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexBubbleAllOf.md b/lib/clients/messaging-api/docs/FlexBubbleAllOf.md new file mode 100644 index 00000000..2e321eee --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexBubbleAllOf.md @@ -0,0 +1,32 @@ +# LINE::Client::MessagingApi::FlexBubbleAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **direction** | **String** | | [optional] | +| **styles** | [**FlexBubbleStyles**](FlexBubbleStyles.md) | | [optional] | +| **header** | [**FlexBox**](FlexBox.md) | | [optional] | +| **hero** | [**FlexComponent**](FlexComponent.md) | | [optional] | +| **body** | [**FlexBox**](FlexBox.md) | | [optional] | +| **footer** | [**FlexBox**](FlexBox.md) | | [optional] | +| **size** | **String** | | [optional] | +| **action** | [**Action**](Action.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexBubbleAllOf.new( + direction: null, + styles: null, + header: null, + hero: null, + body: null, + footer: null, + size: null, + action: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexBubbleStyles.md b/lib/clients/messaging-api/docs/FlexBubbleStyles.md new file mode 100644 index 00000000..a6f30904 --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexBubbleStyles.md @@ -0,0 +1,24 @@ +# LINE::Client::MessagingApi::FlexBubbleStyles + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **header** | [**FlexBlockStyle**](FlexBlockStyle.md) | | [optional] | +| **hero** | [**FlexBlockStyle**](FlexBlockStyle.md) | | [optional] | +| **body** | [**FlexBlockStyle**](FlexBlockStyle.md) | | [optional] | +| **footer** | [**FlexBlockStyle**](FlexBlockStyle.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexBubbleStyles.new( + header: null, + hero: null, + body: null, + footer: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexButton.md b/lib/clients/messaging-api/docs/FlexButton.md new file mode 100644 index 00000000..0bce7974 --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexButton.md @@ -0,0 +1,44 @@ +# LINE::Client::MessagingApi::FlexButton + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **flex** | **Integer** | | [optional] | +| **color** | **String** | | [optional] | +| **style** | **String** | | [optional] | +| **action** | [**Action**](Action.md) | | [optional] | +| **gravity** | **String** | | [optional] | +| **margin** | **String** | | [optional] | +| **position** | **String** | | [optional] | +| **offset_top** | **String** | | [optional] | +| **offset_bottom** | **String** | | [optional] | +| **offset_start** | **String** | | [optional] | +| **offset_end** | **String** | | [optional] | +| **height** | **String** | | [optional] | +| **adjust_mode** | **String** | | [optional] | +| **scaling** | **Boolean** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexButton.new( + flex: null, + color: null, + style: null, + action: null, + gravity: null, + margin: null, + position: null, + offset_top: null, + offset_bottom: null, + offset_start: null, + offset_end: null, + height: null, + adjust_mode: null, + scaling: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexButtonAllOf.md b/lib/clients/messaging-api/docs/FlexButtonAllOf.md new file mode 100644 index 00000000..3ba7f34c --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexButtonAllOf.md @@ -0,0 +1,44 @@ +# LINE::Client::MessagingApi::FlexButtonAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **flex** | **Integer** | | [optional] | +| **color** | **String** | | [optional] | +| **style** | **String** | | [optional] | +| **action** | [**Action**](Action.md) | | [optional] | +| **gravity** | **String** | | [optional] | +| **margin** | **String** | | [optional] | +| **position** | **String** | | [optional] | +| **offset_top** | **String** | | [optional] | +| **offset_bottom** | **String** | | [optional] | +| **offset_start** | **String** | | [optional] | +| **offset_end** | **String** | | [optional] | +| **height** | **String** | | [optional] | +| **adjust_mode** | **String** | | [optional] | +| **scaling** | **Boolean** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexButtonAllOf.new( + flex: null, + color: null, + style: null, + action: null, + gravity: null, + margin: null, + position: null, + offset_top: null, + offset_bottom: null, + offset_start: null, + offset_end: null, + height: null, + adjust_mode: null, + scaling: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexCarousel.md b/lib/clients/messaging-api/docs/FlexCarousel.md new file mode 100644 index 00000000..2d2b3ce1 --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexCarousel.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::FlexCarousel + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **contents** | [**Array<FlexBubble>**](FlexBubble.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexCarousel.new( + contents: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexCarouselAllOf.md b/lib/clients/messaging-api/docs/FlexCarouselAllOf.md new file mode 100644 index 00000000..507de35d --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexCarouselAllOf.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::FlexCarouselAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **contents** | [**Array<FlexBubble>**](FlexBubble.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexCarouselAllOf.new( + contents: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexComponent.md b/lib/clients/messaging-api/docs/FlexComponent.md new file mode 100644 index 00000000..7692b789 --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexComponent.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::FlexComponent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexComponent.new( + type: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexContainer.md b/lib/clients/messaging-api/docs/FlexContainer.md new file mode 100644 index 00000000..7baa49d6 --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexContainer.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::FlexContainer + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexContainer.new( + type: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexFiller.md b/lib/clients/messaging-api/docs/FlexFiller.md new file mode 100644 index 00000000..9108a3f0 --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexFiller.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::FlexFiller + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **flex** | **Integer** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexFiller.new( + flex: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexFillerAllOf.md b/lib/clients/messaging-api/docs/FlexFillerAllOf.md new file mode 100644 index 00000000..0edb3c96 --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexFillerAllOf.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::FlexFillerAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **flex** | **Integer** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexFillerAllOf.new( + flex: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexIcon.md b/lib/clients/messaging-api/docs/FlexIcon.md new file mode 100644 index 00000000..f5d54ea7 --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexIcon.md @@ -0,0 +1,36 @@ +# LINE::Client::MessagingApi::FlexIcon + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **url** | **String** | | [optional] | +| **size** | **String** | | [optional] | +| **aspect_ratio** | **String** | | [optional] | +| **margin** | **String** | | [optional] | +| **position** | **String** | | [optional] | +| **offset_top** | **String** | | [optional] | +| **offset_bottom** | **String** | | [optional] | +| **offset_start** | **String** | | [optional] | +| **offset_end** | **String** | | [optional] | +| **scaling** | **Boolean** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexIcon.new( + url: null, + size: null, + aspect_ratio: null, + margin: null, + position: null, + offset_top: null, + offset_bottom: null, + offset_start: null, + offset_end: null, + scaling: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexIconAllOf.md b/lib/clients/messaging-api/docs/FlexIconAllOf.md new file mode 100644 index 00000000..59849eb4 --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexIconAllOf.md @@ -0,0 +1,36 @@ +# LINE::Client::MessagingApi::FlexIconAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **url** | **String** | | [optional] | +| **size** | **String** | | [optional] | +| **aspect_ratio** | **String** | | [optional] | +| **margin** | **String** | | [optional] | +| **position** | **String** | | [optional] | +| **offset_top** | **String** | | [optional] | +| **offset_bottom** | **String** | | [optional] | +| **offset_start** | **String** | | [optional] | +| **offset_end** | **String** | | [optional] | +| **scaling** | **Boolean** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexIconAllOf.new( + url: null, + size: null, + aspect_ratio: null, + margin: null, + position: null, + offset_top: null, + offset_bottom: null, + offset_start: null, + offset_end: null, + scaling: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexImage.md b/lib/clients/messaging-api/docs/FlexImage.md new file mode 100644 index 00000000..4bc8345b --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexImage.md @@ -0,0 +1,48 @@ +# LINE::Client::MessagingApi::FlexImage + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **url** | **String** | Image URL (Max character limit: 2000) Protocol: HTTPS (TLS 1.2 or later) Image format: JPEG or PNG Maximum image size: 1024×1024 pixels Maximum file size: 10 MB (300 KB when the animated property is true) | | +| **flex** | **Integer** | The ratio of the width or height of this component within the parent box. | [optional] | +| **margin** | **String** | The minimum amount of space to include before this component in its parent container. | [optional] | +| **position** | **String** | Reference for offsetTop, offsetBottom, offsetStart, and offsetEnd. Specify one of the following values: `relative`: Use the previous box as reference. `absolute`: Use the top left of parent element as reference. The default value is relative. | [optional] | +| **offset_top** | **String** | Offset. | [optional] | +| **offset_bottom** | **String** | Offset. | [optional] | +| **offset_start** | **String** | Offset. | [optional] | +| **offset_end** | **String** | Offset. | [optional] | +| **align** | **String** | Alignment style in horizontal direction. | [optional] | +| **gravity** | **String** | Alignment style in vertical direction. | [optional] | +| **size** | **String** | The maximum image width. This is md by default. | [optional][default to 'md'] | +| **aspect_ratio** | **String** | Aspect ratio of the image. `{width}:{height}` format. Specify the value of `{width}` and `{height}` in the range from `1` to `100000`. However, you cannot set `{height}` to a value that is more than three times the value of `{width}`. The default value is `1:1`. | [optional] | +| **aspect_mode** | **String** | The display style of the image if the aspect ratio of the image and that specified by the aspectRatio property do not match. | [optional] | +| **background_color** | **String** | Background color of the image. Use a hexadecimal color code. | [optional] | +| **action** | [**Action**](Action.md) | | [optional] | +| **animated** | **Boolean** | When this is `true`, an animated image (APNG) plays. You can specify a value of true up to 10 images in a single message. You can't send messages that exceed this limit. This is `false` by default. Animated images larger than 300 KB aren't played back. | [optional][default to false] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexImage.new( + url: null, + flex: null, + margin: null, + position: null, + offset_top: null, + offset_bottom: null, + offset_start: null, + offset_end: null, + align: null, + gravity: null, + size: null, + aspect_ratio: null, + aspect_mode: null, + background_color: null, + action: null, + animated: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexImageAllOf.md b/lib/clients/messaging-api/docs/FlexImageAllOf.md new file mode 100644 index 00000000..a17f27cf --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexImageAllOf.md @@ -0,0 +1,48 @@ +# LINE::Client::MessagingApi::FlexImageAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **url** | **String** | Image URL (Max character limit: 2000) Protocol: HTTPS (TLS 1.2 or later) Image format: JPEG or PNG Maximum image size: 1024×1024 pixels Maximum file size: 10 MB (300 KB when the animated property is true) | [optional] | +| **flex** | **Integer** | The ratio of the width or height of this component within the parent box. | [optional] | +| **margin** | **String** | The minimum amount of space to include before this component in its parent container. | [optional] | +| **position** | **String** | Reference for offsetTop, offsetBottom, offsetStart, and offsetEnd. Specify one of the following values: `relative`: Use the previous box as reference. `absolute`: Use the top left of parent element as reference. The default value is relative. | [optional] | +| **offset_top** | **String** | Offset. | [optional] | +| **offset_bottom** | **String** | Offset. | [optional] | +| **offset_start** | **String** | Offset. | [optional] | +| **offset_end** | **String** | Offset. | [optional] | +| **align** | **String** | Alignment style in horizontal direction. | [optional] | +| **gravity** | **String** | Alignment style in vertical direction. | [optional] | +| **size** | **String** | The maximum image width. This is md by default. | [optional][default to 'md'] | +| **aspect_ratio** | **String** | Aspect ratio of the image. `{width}:{height}` format. Specify the value of `{width}` and `{height}` in the range from `1` to `100000`. However, you cannot set `{height}` to a value that is more than three times the value of `{width}`. The default value is `1:1`. | [optional] | +| **aspect_mode** | **String** | The display style of the image if the aspect ratio of the image and that specified by the aspectRatio property do not match. | [optional] | +| **background_color** | **String** | Background color of the image. Use a hexadecimal color code. | [optional] | +| **action** | [**Action**](Action.md) | | [optional] | +| **animated** | **Boolean** | When this is `true`, an animated image (APNG) plays. You can specify a value of true up to 10 images in a single message. You can't send messages that exceed this limit. This is `false` by default. Animated images larger than 300 KB aren't played back. | [optional][default to false] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexImageAllOf.new( + url: null, + flex: null, + margin: null, + position: null, + offset_top: null, + offset_bottom: null, + offset_start: null, + offset_end: null, + align: null, + gravity: null, + size: null, + aspect_ratio: null, + aspect_mode: null, + background_color: null, + action: null, + animated: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexMessage.md b/lib/clients/messaging-api/docs/FlexMessage.md new file mode 100644 index 00000000..935069a5 --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexMessage.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::FlexMessage + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **alt_text** | **String** | | [optional] | +| **contents** | [**FlexContainer**](FlexContainer.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexMessage.new( + alt_text: null, + contents: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexMessageAllOf.md b/lib/clients/messaging-api/docs/FlexMessageAllOf.md new file mode 100644 index 00000000..460191ab --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexMessageAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::FlexMessageAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **alt_text** | **String** | | [optional] | +| **contents** | [**FlexContainer**](FlexContainer.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexMessageAllOf.new( + alt_text: null, + contents: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexSeparator.md b/lib/clients/messaging-api/docs/FlexSeparator.md new file mode 100644 index 00000000..3ede7060 --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexSeparator.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::FlexSeparator + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **margin** | **String** | | [optional] | +| **color** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexSeparator.new( + margin: null, + color: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexSeparatorAllOf.md b/lib/clients/messaging-api/docs/FlexSeparatorAllOf.md new file mode 100644 index 00000000..2ecf6693 --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexSeparatorAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::FlexSeparatorAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **margin** | **String** | | [optional] | +| **color** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexSeparatorAllOf.new( + margin: null, + color: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexSpan.md b/lib/clients/messaging-api/docs/FlexSpan.md new file mode 100644 index 00000000..4fc16a6c --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexSpan.md @@ -0,0 +1,28 @@ +# LINE::Client::MessagingApi::FlexSpan + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **text** | **String** | | [optional] | +| **size** | **String** | | [optional] | +| **color** | **String** | | [optional] | +| **weight** | **String** | | [optional] | +| **style** | **String** | | [optional] | +| **decoration** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexSpan.new( + text: null, + size: null, + color: null, + weight: null, + style: null, + decoration: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexSpanAllOf.md b/lib/clients/messaging-api/docs/FlexSpanAllOf.md new file mode 100644 index 00000000..715978ef --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexSpanAllOf.md @@ -0,0 +1,28 @@ +# LINE::Client::MessagingApi::FlexSpanAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **text** | **String** | | [optional] | +| **size** | **String** | | [optional] | +| **color** | **String** | | [optional] | +| **weight** | **String** | | [optional] | +| **style** | **String** | | [optional] | +| **decoration** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexSpanAllOf.new( + text: null, + size: null, + color: null, + weight: null, + style: null, + decoration: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexText.md b/lib/clients/messaging-api/docs/FlexText.md new file mode 100644 index 00000000..8e58b5cf --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexText.md @@ -0,0 +1,60 @@ +# LINE::Client::MessagingApi::FlexText + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **flex** | **Integer** | | [optional] | +| **text** | **String** | | [optional] | +| **size** | **String** | | [optional] | +| **align** | **String** | | [optional] | +| **gravity** | **String** | | [optional] | +| **color** | **String** | | [optional] | +| **weight** | **String** | | [optional] | +| **style** | **String** | | [optional] | +| **decoration** | **String** | | [optional] | +| **wrap** | **Boolean** | | [optional] | +| **line_spacing** | **String** | | [optional] | +| **margin** | **String** | | [optional] | +| **position** | **String** | | [optional] | +| **offset_top** | **String** | | [optional] | +| **offset_bottom** | **String** | | [optional] | +| **offset_start** | **String** | | [optional] | +| **offset_end** | **String** | | [optional] | +| **action** | [**Action**](Action.md) | | [optional] | +| **max_lines** | **Integer** | | [optional] | +| **contents** | [**Array<FlexSpan>**](FlexSpan.md) | | [optional] | +| **adjust_mode** | **String** | | [optional] | +| **scaling** | **Boolean** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexText.new( + flex: null, + text: null, + size: null, + align: null, + gravity: null, + color: null, + weight: null, + style: null, + decoration: null, + wrap: null, + line_spacing: null, + margin: null, + position: null, + offset_top: null, + offset_bottom: null, + offset_start: null, + offset_end: null, + action: null, + max_lines: null, + contents: null, + adjust_mode: null, + scaling: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexTextAllOf.md b/lib/clients/messaging-api/docs/FlexTextAllOf.md new file mode 100644 index 00000000..b14e40db --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexTextAllOf.md @@ -0,0 +1,60 @@ +# LINE::Client::MessagingApi::FlexTextAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **flex** | **Integer** | | [optional] | +| **text** | **String** | | [optional] | +| **size** | **String** | | [optional] | +| **align** | **String** | | [optional] | +| **gravity** | **String** | | [optional] | +| **color** | **String** | | [optional] | +| **weight** | **String** | | [optional] | +| **style** | **String** | | [optional] | +| **decoration** | **String** | | [optional] | +| **wrap** | **Boolean** | | [optional] | +| **line_spacing** | **String** | | [optional] | +| **margin** | **String** | | [optional] | +| **position** | **String** | | [optional] | +| **offset_top** | **String** | | [optional] | +| **offset_bottom** | **String** | | [optional] | +| **offset_start** | **String** | | [optional] | +| **offset_end** | **String** | | [optional] | +| **action** | [**Action**](Action.md) | | [optional] | +| **max_lines** | **Integer** | | [optional] | +| **contents** | [**Array<FlexSpan>**](FlexSpan.md) | | [optional] | +| **adjust_mode** | **String** | | [optional] | +| **scaling** | **Boolean** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexTextAllOf.new( + flex: null, + text: null, + size: null, + align: null, + gravity: null, + color: null, + weight: null, + style: null, + decoration: null, + wrap: null, + line_spacing: null, + margin: null, + position: null, + offset_top: null, + offset_bottom: null, + offset_start: null, + offset_end: null, + action: null, + max_lines: null, + contents: null, + adjust_mode: null, + scaling: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexVideo.md b/lib/clients/messaging-api/docs/FlexVideo.md new file mode 100644 index 00000000..b4af61a2 --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexVideo.md @@ -0,0 +1,26 @@ +# LINE::Client::MessagingApi::FlexVideo + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **url** | **String** | | [optional] | +| **preview_url** | **String** | | [optional] | +| **alt_content** | [**FlexComponent**](FlexComponent.md) | | [optional] | +| **aspect_ratio** | **String** | | [optional] | +| **action** | [**Action**](Action.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexVideo.new( + url: null, + preview_url: null, + alt_content: null, + aspect_ratio: null, + action: null +) +``` + diff --git a/lib/clients/messaging-api/docs/FlexVideoAllOf.md b/lib/clients/messaging-api/docs/FlexVideoAllOf.md new file mode 100644 index 00000000..dcd31b99 --- /dev/null +++ b/lib/clients/messaging-api/docs/FlexVideoAllOf.md @@ -0,0 +1,26 @@ +# LINE::Client::MessagingApi::FlexVideoAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **url** | **String** | | [optional] | +| **preview_url** | **String** | | [optional] | +| **alt_content** | [**FlexComponent**](FlexComponent.md) | | [optional] | +| **aspect_ratio** | **String** | | [optional] | +| **action** | [**Action**](Action.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::FlexVideoAllOf.new( + url: null, + preview_url: null, + alt_content: null, + aspect_ratio: null, + action: null +) +``` + diff --git a/lib/clients/messaging-api/docs/GenderDemographic.md b/lib/clients/messaging-api/docs/GenderDemographic.md new file mode 100644 index 00000000..1a85761d --- /dev/null +++ b/lib/clients/messaging-api/docs/GenderDemographic.md @@ -0,0 +1,15 @@ +# LINE::Client::MessagingApi::GenderDemographic + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::GenderDemographic.new() +``` + diff --git a/lib/clients/messaging-api/docs/GenderDemographicFilter.md b/lib/clients/messaging-api/docs/GenderDemographicFilter.md new file mode 100644 index 00000000..d081937e --- /dev/null +++ b/lib/clients/messaging-api/docs/GenderDemographicFilter.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::GenderDemographicFilter + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **one_of** | [**Array<GenderDemographic>**](GenderDemographic.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::GenderDemographicFilter.new( + one_of: null +) +``` + diff --git a/lib/clients/messaging-api/docs/GenderDemographicFilterAllOf.md b/lib/clients/messaging-api/docs/GenderDemographicFilterAllOf.md new file mode 100644 index 00000000..10ab75f9 --- /dev/null +++ b/lib/clients/messaging-api/docs/GenderDemographicFilterAllOf.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::GenderDemographicFilterAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **one_of** | [**Array<GenderDemographic>**](GenderDemographic.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::GenderDemographicFilterAllOf.new( + one_of: null +) +``` + diff --git a/lib/clients/messaging-api/docs/GetAggregationUnitNameListResponse.md b/lib/clients/messaging-api/docs/GetAggregationUnitNameListResponse.md new file mode 100644 index 00000000..f42a5382 --- /dev/null +++ b/lib/clients/messaging-api/docs/GetAggregationUnitNameListResponse.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::GetAggregationUnitNameListResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **custom_aggregation_units** | **Array<String>** | An array of strings indicating the names of aggregation units used this month. | | +| **_next** | **String** | A continuation token to get the next array of unit names. Returned only when there are remaining aggregation units that weren't returned in customAggregationUnits in the original request. | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::GetAggregationUnitNameListResponse.new( + custom_aggregation_units: null, + _next: null +) +``` + diff --git a/lib/clients/messaging-api/docs/GetAggregationUnitUsageResponse.md b/lib/clients/messaging-api/docs/GetAggregationUnitUsageResponse.md new file mode 100644 index 00000000..d4930e89 --- /dev/null +++ b/lib/clients/messaging-api/docs/GetAggregationUnitUsageResponse.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::GetAggregationUnitUsageResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **num_of_custom_aggregation_units** | **Integer** | Number of aggregation units used this month. | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::GetAggregationUnitUsageResponse.new( + num_of_custom_aggregation_units: null +) +``` + diff --git a/lib/clients/messaging-api/docs/GetFollowersResponse.md b/lib/clients/messaging-api/docs/GetFollowersResponse.md new file mode 100644 index 00000000..90ccc74e --- /dev/null +++ b/lib/clients/messaging-api/docs/GetFollowersResponse.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::GetFollowersResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **user_ids** | **Array<String>** | An array of strings indicating user IDs of users that have added the LINE Official Account as a friend. Only users of LINE for iOS and LINE for Android are included in `userIds`. | | +| **_next** | **String** | A continuation token to get the next array of user IDs. Returned only when there are remaining user IDs that weren't returned in `userIds` in the original request. The number of user IDs in the `userIds` element doesn't have to reach the maximum number specified by `limit` for the `next` property to be included in the response. | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::GetFollowersResponse.new( + user_ids: null, + _next: null +) +``` + diff --git a/lib/clients/messaging-api/docs/GetMessageContentTranscodingResponse.md b/lib/clients/messaging-api/docs/GetMessageContentTranscodingResponse.md new file mode 100644 index 00000000..68fb8d38 --- /dev/null +++ b/lib/clients/messaging-api/docs/GetMessageContentTranscodingResponse.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::GetMessageContentTranscodingResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **status** | **String** | The preparation status. One of: `processing`: Preparing to get content. `succeeded`: Ready to get the content. You can get the content sent by users. `failed`: Failed to prepare to get the content. | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::GetMessageContentTranscodingResponse.new( + status: null +) +``` + diff --git a/lib/clients/messaging-api/docs/GetWebhookEndpointResponse.md b/lib/clients/messaging-api/docs/GetWebhookEndpointResponse.md new file mode 100644 index 00000000..47d4dbba --- /dev/null +++ b/lib/clients/messaging-api/docs/GetWebhookEndpointResponse.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::GetWebhookEndpointResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **endpoint** | **String** | Webhook URL | | +| **active** | **Boolean** | Webhook usage status. Send a webhook event from the LINE Platform to the webhook URL only if enabled. `true`: Webhook usage is enabled. `false`: Webhook usage is disabled. | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::GetWebhookEndpointResponse.new( + endpoint: null, + active: null +) +``` + diff --git a/lib/clients/messaging-api/docs/GroupMemberCountResponse.md b/lib/clients/messaging-api/docs/GroupMemberCountResponse.md new file mode 100644 index 00000000..1317b081 --- /dev/null +++ b/lib/clients/messaging-api/docs/GroupMemberCountResponse.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::GroupMemberCountResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **count** | **Integer** | The count of members in the group chat. The number returned excludes the LINE Official Account. | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::GroupMemberCountResponse.new( + count: null +) +``` + diff --git a/lib/clients/messaging-api/docs/GroupSummaryResponse.md b/lib/clients/messaging-api/docs/GroupSummaryResponse.md new file mode 100644 index 00000000..0695b34f --- /dev/null +++ b/lib/clients/messaging-api/docs/GroupSummaryResponse.md @@ -0,0 +1,22 @@ +# LINE::Client::MessagingApi::GroupSummaryResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **group_id** | **String** | Group ID | | +| **group_name** | **String** | Group name | | +| **picture_url** | **String** | Group icon URL. Not included in the response if the user doesn't set a group profile icon. | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::GroupSummaryResponse.new( + group_id: null, + group_name: null, + picture_url: null +) +``` + diff --git a/lib/clients/messaging-api/docs/GroupUserProfileResponse.md b/lib/clients/messaging-api/docs/GroupUserProfileResponse.md new file mode 100644 index 00000000..8afc9420 --- /dev/null +++ b/lib/clients/messaging-api/docs/GroupUserProfileResponse.md @@ -0,0 +1,22 @@ +# LINE::Client::MessagingApi::GroupUserProfileResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **display_name** | **String** | User's display name | | +| **user_id** | **String** | User ID | | +| **picture_url** | **String** | Profile image URL. `https` image URL. Not included in the response if the user doesn't have a profile image. | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::GroupUserProfileResponse.new( + display_name: null, + user_id: null, + picture_url: null +) +``` + diff --git a/lib/clients/messaging-api/docs/ImageCarouselColumn.md b/lib/clients/messaging-api/docs/ImageCarouselColumn.md new file mode 100644 index 00000000..94682b13 --- /dev/null +++ b/lib/clients/messaging-api/docs/ImageCarouselColumn.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::ImageCarouselColumn + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **image_url** | **String** | | [optional] | +| **action** | [**Action**](Action.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::ImageCarouselColumn.new( + image_url: null, + action: null +) +``` + diff --git a/lib/clients/messaging-api/docs/ImageCarouselTemplate.md b/lib/clients/messaging-api/docs/ImageCarouselTemplate.md new file mode 100644 index 00000000..4b473129 --- /dev/null +++ b/lib/clients/messaging-api/docs/ImageCarouselTemplate.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::ImageCarouselTemplate + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **columns** | [**Array<ImageCarouselColumn>**](ImageCarouselColumn.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::ImageCarouselTemplate.new( + columns: null +) +``` + diff --git a/lib/clients/messaging-api/docs/ImageCarouselTemplateAllOf.md b/lib/clients/messaging-api/docs/ImageCarouselTemplateAllOf.md new file mode 100644 index 00000000..86aeff54 --- /dev/null +++ b/lib/clients/messaging-api/docs/ImageCarouselTemplateAllOf.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::ImageCarouselTemplateAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **columns** | [**Array<ImageCarouselColumn>**](ImageCarouselColumn.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::ImageCarouselTemplateAllOf.new( + columns: null +) +``` + diff --git a/lib/clients/messaging-api/docs/ImageMessage.md b/lib/clients/messaging-api/docs/ImageMessage.md new file mode 100644 index 00000000..89a9d19a --- /dev/null +++ b/lib/clients/messaging-api/docs/ImageMessage.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::ImageMessage + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **original_content_url** | **String** | | [optional] | +| **preview_image_url** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::ImageMessage.new( + original_content_url: null, + preview_image_url: null +) +``` + diff --git a/lib/clients/messaging-api/docs/ImageMessageAllOf.md b/lib/clients/messaging-api/docs/ImageMessageAllOf.md new file mode 100644 index 00000000..066ecf99 --- /dev/null +++ b/lib/clients/messaging-api/docs/ImageMessageAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::ImageMessageAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **original_content_url** | **String** | | [optional] | +| **preview_image_url** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::ImageMessageAllOf.new( + original_content_url: null, + preview_image_url: null +) +``` + diff --git a/lib/clients/messaging-api/docs/ImagemapAction.md b/lib/clients/messaging-api/docs/ImagemapAction.md new file mode 100644 index 00000000..3831d43e --- /dev/null +++ b/lib/clients/messaging-api/docs/ImagemapAction.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::ImagemapAction + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | | +| **area** | [**ImagemapArea**](ImagemapArea.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::ImagemapAction.new( + type: null, + area: null +) +``` + diff --git a/lib/clients/messaging-api/docs/ImagemapArea.md b/lib/clients/messaging-api/docs/ImagemapArea.md new file mode 100644 index 00000000..69eea8db --- /dev/null +++ b/lib/clients/messaging-api/docs/ImagemapArea.md @@ -0,0 +1,24 @@ +# LINE::Client::MessagingApi::ImagemapArea + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **x** | **Integer** | | [optional] | +| **y** | **Integer** | | [optional] | +| **width** | **Integer** | | [optional] | +| **height** | **Integer** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::ImagemapArea.new( + x: null, + y: null, + width: null, + height: null +) +``` + diff --git a/lib/clients/messaging-api/docs/ImagemapBaseSize.md b/lib/clients/messaging-api/docs/ImagemapBaseSize.md new file mode 100644 index 00000000..d76e0a74 --- /dev/null +++ b/lib/clients/messaging-api/docs/ImagemapBaseSize.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::ImagemapBaseSize + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **height** | **Integer** | | [optional] | +| **width** | **Integer** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::ImagemapBaseSize.new( + height: null, + width: null +) +``` + diff --git a/lib/clients/messaging-api/docs/ImagemapExternalLink.md b/lib/clients/messaging-api/docs/ImagemapExternalLink.md new file mode 100644 index 00000000..bb8c7b32 --- /dev/null +++ b/lib/clients/messaging-api/docs/ImagemapExternalLink.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::ImagemapExternalLink + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **link_uri** | **String** | | [optional] | +| **label** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::ImagemapExternalLink.new( + link_uri: null, + label: null +) +``` + diff --git a/lib/clients/messaging-api/docs/ImagemapMessage.md b/lib/clients/messaging-api/docs/ImagemapMessage.md new file mode 100644 index 00000000..0d91b53d --- /dev/null +++ b/lib/clients/messaging-api/docs/ImagemapMessage.md @@ -0,0 +1,26 @@ +# LINE::Client::MessagingApi::ImagemapMessage + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **base_url** | **String** | | [optional] | +| **alt_text** | **String** | | [optional] | +| **base_size** | [**ImagemapBaseSize**](ImagemapBaseSize.md) | | [optional] | +| **actions** | [**Array<ImagemapAction>**](ImagemapAction.md) | | [optional] | +| **video** | [**ImagemapVideo**](ImagemapVideo.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::ImagemapMessage.new( + base_url: null, + alt_text: null, + base_size: null, + actions: null, + video: null +) +``` + diff --git a/lib/clients/messaging-api/docs/ImagemapMessageAllOf.md b/lib/clients/messaging-api/docs/ImagemapMessageAllOf.md new file mode 100644 index 00000000..48672300 --- /dev/null +++ b/lib/clients/messaging-api/docs/ImagemapMessageAllOf.md @@ -0,0 +1,26 @@ +# LINE::Client::MessagingApi::ImagemapMessageAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **base_url** | **String** | | [optional] | +| **alt_text** | **String** | | [optional] | +| **base_size** | [**ImagemapBaseSize**](ImagemapBaseSize.md) | | [optional] | +| **actions** | [**Array<ImagemapAction>**](ImagemapAction.md) | | [optional] | +| **video** | [**ImagemapVideo**](ImagemapVideo.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::ImagemapMessageAllOf.new( + base_url: null, + alt_text: null, + base_size: null, + actions: null, + video: null +) +``` + diff --git a/lib/clients/messaging-api/docs/ImagemapVideo.md b/lib/clients/messaging-api/docs/ImagemapVideo.md new file mode 100644 index 00000000..c181ca5c --- /dev/null +++ b/lib/clients/messaging-api/docs/ImagemapVideo.md @@ -0,0 +1,24 @@ +# LINE::Client::MessagingApi::ImagemapVideo + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **original_content_url** | **String** | | [optional] | +| **preview_image_url** | **String** | | [optional] | +| **area** | [**ImagemapArea**](ImagemapArea.md) | | [optional] | +| **external_link** | [**ImagemapExternalLink**](ImagemapExternalLink.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::ImagemapVideo.new( + original_content_url: null, + preview_image_url: null, + area: null, + external_link: null +) +``` + diff --git a/lib/clients/messaging-api/docs/IssueLinkTokenResponse.md b/lib/clients/messaging-api/docs/IssueLinkTokenResponse.md new file mode 100644 index 00000000..1284b988 --- /dev/null +++ b/lib/clients/messaging-api/docs/IssueLinkTokenResponse.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::IssueLinkTokenResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **link_token** | **String** | Link token. Link tokens are valid for 10 minutes and can only be used once. | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::IssueLinkTokenResponse.new( + link_token: null +) +``` + diff --git a/lib/clients/messaging-api/docs/Limit.md b/lib/clients/messaging-api/docs/Limit.md new file mode 100644 index 00000000..c86e044b --- /dev/null +++ b/lib/clients/messaging-api/docs/Limit.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::Limit + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **max** | **Integer** | The maximum number of narrowcast messages to send. Use this parameter to limit the number of narrowcast messages sent. The recipients will be chosen at random. | [optional] | +| **up_to_remaining_quota** | **Boolean** | If true, the message will be sent within the maximum number of deliverable messages. The default value is `false`. Targets will be selected at random. | [optional][default to false] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::Limit.new( + max: null, + up_to_remaining_quota: null +) +``` + diff --git a/lib/clients/messaging-api/docs/LocationAction.md b/lib/clients/messaging-api/docs/LocationAction.md new file mode 100644 index 00000000..4691ca0f --- /dev/null +++ b/lib/clients/messaging-api/docs/LocationAction.md @@ -0,0 +1,15 @@ +# LINE::Client::MessagingApi::LocationAction + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::LocationAction.new() +``` + diff --git a/lib/clients/messaging-api/docs/LocationMessage.md b/lib/clients/messaging-api/docs/LocationMessage.md new file mode 100644 index 00000000..847f035b --- /dev/null +++ b/lib/clients/messaging-api/docs/LocationMessage.md @@ -0,0 +1,24 @@ +# LINE::Client::MessagingApi::LocationMessage + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **title** | **String** | | [optional] | +| **address** | **String** | | [optional] | +| **latitude** | **Float** | | [optional] | +| **longitude** | **Float** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::LocationMessage.new( + title: null, + address: null, + latitude: null, + longitude: null +) +``` + diff --git a/lib/clients/messaging-api/docs/LocationMessageAllOf.md b/lib/clients/messaging-api/docs/LocationMessageAllOf.md new file mode 100644 index 00000000..7a6851ce --- /dev/null +++ b/lib/clients/messaging-api/docs/LocationMessageAllOf.md @@ -0,0 +1,24 @@ +# LINE::Client::MessagingApi::LocationMessageAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **title** | **String** | | [optional] | +| **address** | **String** | | [optional] | +| **latitude** | **Float** | | [optional] | +| **longitude** | **Float** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::LocationMessageAllOf.new( + title: null, + address: null, + latitude: null, + longitude: null +) +``` + diff --git a/lib/clients/messaging-api/docs/MarkMessagesAsReadRequest.md b/lib/clients/messaging-api/docs/MarkMessagesAsReadRequest.md new file mode 100644 index 00000000..fc1ccc30 --- /dev/null +++ b/lib/clients/messaging-api/docs/MarkMessagesAsReadRequest.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::MarkMessagesAsReadRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **chat** | [**ChatReference**](ChatReference.md) | | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::MarkMessagesAsReadRequest.new( + chat: null +) +``` + diff --git a/lib/clients/messaging-api/docs/MembersIdsResponse.md b/lib/clients/messaging-api/docs/MembersIdsResponse.md new file mode 100644 index 00000000..34dfd900 --- /dev/null +++ b/lib/clients/messaging-api/docs/MembersIdsResponse.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::MembersIdsResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **member_ids** | **Array<String>** | List of user IDs of members in the group chat. Only users of LINE for iOS and LINE for Android are included in `memberIds`. | | +| **_next** | **String** | A continuation token to get the next array of user IDs of the members in the group chat. Returned only when there are remaining user IDs that were not returned in `memberIds` in the original request. | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::MembersIdsResponse.new( + member_ids: null, + _next: null +) +``` + diff --git a/lib/clients/messaging-api/docs/Message.md b/lib/clients/messaging-api/docs/Message.md new file mode 100644 index 00000000..48457d75 --- /dev/null +++ b/lib/clients/messaging-api/docs/Message.md @@ -0,0 +1,22 @@ +# LINE::Client::MessagingApi::Message + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | Type of message | | +| **quick_reply** | [**QuickReply**](QuickReply.md) | | [optional] | +| **sender** | [**Sender**](Sender.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::Message.new( + type: null, + quick_reply: null, + sender: null +) +``` + diff --git a/lib/clients/messaging-api/docs/MessageAction.md b/lib/clients/messaging-api/docs/MessageAction.md new file mode 100644 index 00000000..1281442e --- /dev/null +++ b/lib/clients/messaging-api/docs/MessageAction.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::MessageAction + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **text** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::MessageAction.new( + text: null +) +``` + diff --git a/lib/clients/messaging-api/docs/MessageActionAllOf.md b/lib/clients/messaging-api/docs/MessageActionAllOf.md new file mode 100644 index 00000000..cee94b5d --- /dev/null +++ b/lib/clients/messaging-api/docs/MessageActionAllOf.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::MessageActionAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **text** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::MessageActionAllOf.new( + text: null +) +``` + diff --git a/lib/clients/messaging-api/docs/MessageImagemapAction.md b/lib/clients/messaging-api/docs/MessageImagemapAction.md new file mode 100644 index 00000000..b5a24b26 --- /dev/null +++ b/lib/clients/messaging-api/docs/MessageImagemapAction.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::MessageImagemapAction + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **text** | **String** | | [optional] | +| **label** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::MessageImagemapAction.new( + text: null, + label: null +) +``` + diff --git a/lib/clients/messaging-api/docs/MessageImagemapActionAllOf.md b/lib/clients/messaging-api/docs/MessageImagemapActionAllOf.md new file mode 100644 index 00000000..903e3a8f --- /dev/null +++ b/lib/clients/messaging-api/docs/MessageImagemapActionAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::MessageImagemapActionAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **text** | **String** | | [optional] | +| **label** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::MessageImagemapActionAllOf.new( + text: null, + label: null +) +``` + diff --git a/lib/clients/messaging-api/docs/MessageQuotaResponse.md b/lib/clients/messaging-api/docs/MessageQuotaResponse.md new file mode 100644 index 00000000..7780d7d6 --- /dev/null +++ b/lib/clients/messaging-api/docs/MessageQuotaResponse.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::MessageQuotaResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | [**QuotaType**](QuotaType.md) | | | +| **value** | **Integer** | The target limit for sending messages in the current month. This property is returned when the `type` property has a value of `limited`. | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::MessageQuotaResponse.new( + type: null, + value: null +) +``` + diff --git a/lib/clients/messaging-api/docs/MessagingApiApi.md b/lib/clients/messaging-api/docs/MessagingApiApi.md new file mode 100644 index 00000000..105f2840 --- /dev/null +++ b/lib/clients/messaging-api/docs/MessagingApiApi.md @@ -0,0 +1,4272 @@ +# LINE::Client::MessagingApi::MessagingApiApi + +All URIs are relative to *https://api.line.me* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**audience_match**](MessagingApiApi.md#audience_match) | **POST** /bot/ad/multicast/phone | | +| [**broadcast**](MessagingApiApi.md#broadcast) | **POST** /v2/bot/message/broadcast | | +| [**cancel_default_rich_menu**](MessagingApiApi.md#cancel_default_rich_menu) | **DELETE** /v2/bot/user/all/richmenu | | +| [**create_rich_menu**](MessagingApiApi.md#create_rich_menu) | **POST** /v2/bot/richmenu | | +| [**create_rich_menu_alias**](MessagingApiApi.md#create_rich_menu_alias) | **POST** /v2/bot/richmenu/alias | | +| [**delete_rich_menu**](MessagingApiApi.md#delete_rich_menu) | **DELETE** /v2/bot/richmenu/{richMenuId} | | +| [**delete_rich_menu_alias**](MessagingApiApi.md#delete_rich_menu_alias) | **DELETE** /v2/bot/richmenu/alias/{richMenuAliasId} | | +| [**get_ad_phone_message_statistics**](MessagingApiApi.md#get_ad_phone_message_statistics) | **GET** /v2/bot/message/delivery/ad_phone | | +| [**get_aggregation_unit_name_list**](MessagingApiApi.md#get_aggregation_unit_name_list) | **GET** /v2/bot/message/aggregation/list | | +| [**get_aggregation_unit_usage**](MessagingApiApi.md#get_aggregation_unit_usage) | **GET** /v2/bot/message/aggregation/info | | +| [**get_bot_info**](MessagingApiApi.md#get_bot_info) | **GET** /v2/bot/info | | +| [**get_default_rich_menu_id**](MessagingApiApi.md#get_default_rich_menu_id) | **GET** /v2/bot/user/all/richmenu | | +| [**get_followers**](MessagingApiApi.md#get_followers) | **GET** /v2/bot/followers/ids | | +| [**get_group_member_count**](MessagingApiApi.md#get_group_member_count) | **GET** /v2/bot/group/{groupId}/members/count | | +| [**get_group_member_profile**](MessagingApiApi.md#get_group_member_profile) | **GET** /v2/bot/group/{groupId}/member/{userId} | | +| [**get_group_members_ids**](MessagingApiApi.md#get_group_members_ids) | **GET** /v2/bot/group/{groupId}/members/ids | | +| [**get_group_summary**](MessagingApiApi.md#get_group_summary) | **GET** /v2/bot/group/{groupId}/summary | | +| [**get_message_quota**](MessagingApiApi.md#get_message_quota) | **GET** /v2/bot/message/quota | | +| [**get_message_quota_consumption**](MessagingApiApi.md#get_message_quota_consumption) | **GET** /v2/bot/message/quota/consumption | | +| [**get_narrowcast_progress**](MessagingApiApi.md#get_narrowcast_progress) | **GET** /v2/bot/message/progress/narrowcast | | +| [**get_number_of_sent_broadcast_messages**](MessagingApiApi.md#get_number_of_sent_broadcast_messages) | **GET** /v2/bot/message/delivery/broadcast | | +| [**get_number_of_sent_multicast_messages**](MessagingApiApi.md#get_number_of_sent_multicast_messages) | **GET** /v2/bot/message/delivery/multicast | | +| [**get_number_of_sent_push_messages**](MessagingApiApi.md#get_number_of_sent_push_messages) | **GET** /v2/bot/message/delivery/push | | +| [**get_number_of_sent_reply_messages**](MessagingApiApi.md#get_number_of_sent_reply_messages) | **GET** /v2/bot/message/delivery/reply | | +| [**get_pnp_message_statistics**](MessagingApiApi.md#get_pnp_message_statistics) | **GET** /v2/bot/message/delivery/pnp | | +| [**get_profile**](MessagingApiApi.md#get_profile) | **GET** /v2/bot/profile/{userId} | | +| [**get_rich_menu**](MessagingApiApi.md#get_rich_menu) | **GET** /v2/bot/richmenu/{richMenuId} | | +| [**get_rich_menu_alias**](MessagingApiApi.md#get_rich_menu_alias) | **GET** /v2/bot/richmenu/alias/{richMenuAliasId} | | +| [**get_rich_menu_alias_list**](MessagingApiApi.md#get_rich_menu_alias_list) | **GET** /v2/bot/richmenu/alias/list | | +| [**get_rich_menu_batch_progress**](MessagingApiApi.md#get_rich_menu_batch_progress) | **GET** /v2/bot/richmenu/progress/batch | | +| [**get_rich_menu_id_of_user**](MessagingApiApi.md#get_rich_menu_id_of_user) | **GET** /v2/bot/user/{userId}/richmenu | | +| [**get_rich_menu_list**](MessagingApiApi.md#get_rich_menu_list) | **GET** /v2/bot/richmenu/list | | +| [**get_room_member_count**](MessagingApiApi.md#get_room_member_count) | **GET** /v2/bot/room/{roomId}/members/count | | +| [**get_room_member_profile**](MessagingApiApi.md#get_room_member_profile) | **GET** /v2/bot/room/{roomId}/member/{userId} | | +| [**get_room_members_ids**](MessagingApiApi.md#get_room_members_ids) | **GET** /v2/bot/room/{roomId}/members/ids | | +| [**get_webhook_endpoint**](MessagingApiApi.md#get_webhook_endpoint) | **GET** /v2/bot/channel/webhook/endpoint | | +| [**issue_link_token**](MessagingApiApi.md#issue_link_token) | **POST** /v2/bot/user/{userId}/linkToken | | +| [**leave_group**](MessagingApiApi.md#leave_group) | **POST** /v2/bot/group/{groupId}/leave | | +| [**leave_room**](MessagingApiApi.md#leave_room) | **POST** /v2/bot/room/{roomId}/leave | | +| [**link_rich_menu_id_to_user**](MessagingApiApi.md#link_rich_menu_id_to_user) | **POST** /v2/bot/user/{userId}/richmenu/{richMenuId} | | +| [**link_rich_menu_id_to_users**](MessagingApiApi.md#link_rich_menu_id_to_users) | **POST** /v2/bot/richmenu/bulk/link | | +| [**mark_messages_as_read**](MessagingApiApi.md#mark_messages_as_read) | **POST** /v2/bot/message/markAsRead | | +| [**multicast**](MessagingApiApi.md#multicast) | **POST** /v2/bot/message/multicast | | +| [**narrowcast**](MessagingApiApi.md#narrowcast) | **POST** /v2/bot/message/narrowcast | | +| [**push_message**](MessagingApiApi.md#push_message) | **POST** /v2/bot/message/push | | +| [**push_messages_by_phone**](MessagingApiApi.md#push_messages_by_phone) | **POST** /bot/pnp/push | | +| [**reply_message**](MessagingApiApi.md#reply_message) | **POST** /v2/bot/message/reply | | +| [**rich_menu_batch**](MessagingApiApi.md#rich_menu_batch) | **POST** /v2/bot/richmenu/batch | | +| [**set_default_rich_menu**](MessagingApiApi.md#set_default_rich_menu) | **POST** /v2/bot/user/all/richmenu/{richMenuId} | | +| [**set_webhook_endpoint**](MessagingApiApi.md#set_webhook_endpoint) | **PUT** /v2/bot/channel/webhook/endpoint | | +| [**test_webhook_endpoint**](MessagingApiApi.md#test_webhook_endpoint) | **POST** /v2/bot/channel/webhook/test | | +| [**unlink_rich_menu_id_from_user**](MessagingApiApi.md#unlink_rich_menu_id_from_user) | **DELETE** /v2/bot/user/{userId}/richmenu | | +| [**unlink_rich_menu_id_from_users**](MessagingApiApi.md#unlink_rich_menu_id_from_users) | **POST** /v2/bot/richmenu/bulk/unlink | | +| [**update_rich_menu_alias**](MessagingApiApi.md#update_rich_menu_alias) | **POST** /v2/bot/richmenu/alias/{richMenuAliasId} | | +| [**validate_broadcast**](MessagingApiApi.md#validate_broadcast) | **POST** /v2/bot/message/validate/broadcast | | +| [**validate_multicast**](MessagingApiApi.md#validate_multicast) | **POST** /v2/bot/message/validate/multicast | | +| [**validate_narrowcast**](MessagingApiApi.md#validate_narrowcast) | **POST** /v2/bot/message/validate/narrowcast | | +| [**validate_push**](MessagingApiApi.md#validate_push) | **POST** /v2/bot/message/validate/push | | +| [**validate_reply**](MessagingApiApi.md#validate_reply) | **POST** /v2/bot/message/validate/reply | | +| [**validate_rich_menu_batch_request**](MessagingApiApi.md#validate_rich_menu_batch_request) | **POST** /v2/bot/richmenu/validate/batch | | +| [**validate_rich_menu_object**](MessagingApiApi.md#validate_rich_menu_object) | **POST** /v2/bot/richmenu/validate | | + + +## audience_match + +> audience_match(audience_match_messages_request) + + + +Send a message using phone number + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +audience_match_messages_request = LINE::Client::MessagingApi::AudienceMatchMessagesRequest.new({messages: [LINE::Client::MessagingApi::Message.new({type: 'type_example'})], to: ['to_example']}) # AudienceMatchMessagesRequest | + +begin + + api_instance.audience_match(audience_match_messages_request) +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->audience_match: #{e}" +end +``` + +#### Using the audience_match_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> audience_match_with_http_info(audience_match_messages_request) + +```ruby +begin + + data, status_code, headers = api_instance.audience_match_with_http_info(audience_match_messages_request) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->audience_match_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **audience_match_messages_request** | [**AudienceMatchMessagesRequest**](AudienceMatchMessagesRequest.md) | | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## broadcast + +> Object broadcast(broadcast_request, opts) + + + +Sends a message to multiple users at any time. + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +broadcast_request = LINE::Client::MessagingApi::BroadcastRequest.new({messages: [LINE::Client::MessagingApi::Message.new({type: 'type_example'})]}) # BroadcastRequest | +opts = { + x_line_retry_key: '38400000-8cf0-11bd-b23e-10b96e4ef00d' # String | Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. +} + +begin + + result = api_instance.broadcast(broadcast_request, opts) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->broadcast: #{e}" +end +``` + +#### Using the broadcast_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> broadcast_with_http_info(broadcast_request, opts) + +```ruby +begin + + data, status_code, headers = api_instance.broadcast_with_http_info(broadcast_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => Object +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->broadcast_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **broadcast_request** | [**BroadcastRequest**](BroadcastRequest.md) | | | +| **x_line_retry_key** | **String** | Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. | [optional] | + +### Return type + +**Object** + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## cancel_default_rich_menu + +> cancel_default_rich_menu + + + +Cancel default rich menu + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new + +begin + + api_instance.cancel_default_rich_menu +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->cancel_default_rich_menu: #{e}" +end +``` + +#### Using the cancel_default_rich_menu_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> cancel_default_rich_menu_with_http_info + +```ruby +begin + + data, status_code, headers = api_instance.cancel_default_rich_menu_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->cancel_default_rich_menu_with_http_info: #{e}" +end +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## create_rich_menu + +> create_rich_menu(rich_menu_request) + + + +Create rich menu + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +rich_menu_request = LINE::Client::MessagingApi::RichMenuRequest.new # RichMenuRequest | + +begin + + result = api_instance.create_rich_menu(rich_menu_request) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->create_rich_menu: #{e}" +end +``` + +#### Using the create_rich_menu_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_rich_menu_with_http_info(rich_menu_request) + +```ruby +begin + + data, status_code, headers = api_instance.create_rich_menu_with_http_info(rich_menu_request) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->create_rich_menu_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rich_menu_request** | [**RichMenuRequest**](RichMenuRequest.md) | | | + +### Return type + +[**RichMenuIdResponse**](RichMenuIdResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## create_rich_menu_alias + +> create_rich_menu_alias(create_rich_menu_alias_request) + + + +Create rich menu alias + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +create_rich_menu_alias_request = LINE::Client::MessagingApi::CreateRichMenuAliasRequest.new({rich_menu_alias_id: 'rich_menu_alias_id_example', rich_menu_id: 'rich_menu_id_example'}) # CreateRichMenuAliasRequest | + +begin + + api_instance.create_rich_menu_alias(create_rich_menu_alias_request) +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->create_rich_menu_alias: #{e}" +end +``` + +#### Using the create_rich_menu_alias_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> create_rich_menu_alias_with_http_info(create_rich_menu_alias_request) + +```ruby +begin + + data, status_code, headers = api_instance.create_rich_menu_alias_with_http_info(create_rich_menu_alias_request) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->create_rich_menu_alias_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **create_rich_menu_alias_request** | [**CreateRichMenuAliasRequest**](CreateRichMenuAliasRequest.md) | | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## delete_rich_menu + +> delete_rich_menu(rich_menu_id) + + + +Deletes a rich menu. + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +rich_menu_id = 'rich_menu_id_example' # String | ID of a rich menu + +begin + + api_instance.delete_rich_menu(rich_menu_id) +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->delete_rich_menu: #{e}" +end +``` + +#### Using the delete_rich_menu_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> delete_rich_menu_with_http_info(rich_menu_id) + +```ruby +begin + + data, status_code, headers = api_instance.delete_rich_menu_with_http_info(rich_menu_id) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->delete_rich_menu_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rich_menu_id** | **String** | ID of a rich menu | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## delete_rich_menu_alias + +> delete_rich_menu_alias(rich_menu_alias_id) + + + +Delete rich menu alias + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +rich_menu_alias_id = 'rich_menu_alias_id_example' # String | Rich menu alias ID that you want to delete. + +begin + + api_instance.delete_rich_menu_alias(rich_menu_alias_id) +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->delete_rich_menu_alias: #{e}" +end +``` + +#### Using the delete_rich_menu_alias_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> delete_rich_menu_alias_with_http_info(rich_menu_alias_id) + +```ruby +begin + + data, status_code, headers = api_instance.delete_rich_menu_alias_with_http_info(rich_menu_alias_id) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->delete_rich_menu_alias_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rich_menu_alias_id** | **String** | Rich menu alias ID that you want to delete. | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_ad_phone_message_statistics + +> get_ad_phone_message_statistics(date) + + + +Get result of message delivery using phone number + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +date = 'date_example' # String | Date the message was sent Format: `yyyyMMdd` (e.g. `20190831`) Time Zone: UTC+9 + +begin + + result = api_instance.get_ad_phone_message_statistics(date) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_ad_phone_message_statistics: #{e}" +end +``` + +#### Using the get_ad_phone_message_statistics_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_ad_phone_message_statistics_with_http_info(date) + +```ruby +begin + + data, status_code, headers = api_instance.get_ad_phone_message_statistics_with_http_info(date) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_ad_phone_message_statistics_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **date** | **String** | Date the message was sent Format: `yyyyMMdd` (e.g. `20190831`) Time Zone: UTC+9 | | + +### Return type + +[**NumberOfMessagesResponse**](NumberOfMessagesResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_aggregation_unit_name_list + +> get_aggregation_unit_name_list(opts) + + + +Get name list of units used this month + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +opts = { + limit: 'limit_example', # String | The maximum number of aggregation units you can get per request. + start: 'start_example' # String | Value of the continuation token found in the next property of the JSON object returned in the response. If you can't get all the aggregation units in one request, include this parameter to get the remaining array. +} + +begin + + result = api_instance.get_aggregation_unit_name_list(opts) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_aggregation_unit_name_list: #{e}" +end +``` + +#### Using the get_aggregation_unit_name_list_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_aggregation_unit_name_list_with_http_info(opts) + +```ruby +begin + + data, status_code, headers = api_instance.get_aggregation_unit_name_list_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_aggregation_unit_name_list_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **limit** | **String** | The maximum number of aggregation units you can get per request. | [optional] | +| **start** | **String** | Value of the continuation token found in the next property of the JSON object returned in the response. If you can't get all the aggregation units in one request, include this parameter to get the remaining array. | [optional] | + +### Return type + +[**GetAggregationUnitNameListResponse**](GetAggregationUnitNameListResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_aggregation_unit_usage + +> get_aggregation_unit_usage + + + +Get number of units used this month + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new + +begin + + result = api_instance.get_aggregation_unit_usage + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_aggregation_unit_usage: #{e}" +end +``` + +#### Using the get_aggregation_unit_usage_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_aggregation_unit_usage_with_http_info + +```ruby +begin + + data, status_code, headers = api_instance.get_aggregation_unit_usage_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_aggregation_unit_usage_with_http_info: #{e}" +end +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**GetAggregationUnitUsageResponse**](GetAggregationUnitUsageResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_bot_info + +> get_bot_info + + + +Get bot info + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new + +begin + + result = api_instance.get_bot_info + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_bot_info: #{e}" +end +``` + +#### Using the get_bot_info_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_bot_info_with_http_info + +```ruby +begin + + data, status_code, headers = api_instance.get_bot_info_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_bot_info_with_http_info: #{e}" +end +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**BotInfoResponse**](BotInfoResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_default_rich_menu_id + +> get_default_rich_menu_id + + + +Gets the ID of the default rich menu set with the Messaging API. + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new + +begin + + result = api_instance.get_default_rich_menu_id + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_default_rich_menu_id: #{e}" +end +``` + +#### Using the get_default_rich_menu_id_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_default_rich_menu_id_with_http_info + +```ruby +begin + + data, status_code, headers = api_instance.get_default_rich_menu_id_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_default_rich_menu_id_with_http_info: #{e}" +end +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**RichMenuIdResponse**](RichMenuIdResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_followers + +> get_followers(opts) + + + +Get a list of users who added your LINE Official Account as a friend + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +opts = { + start: 'start_example', # String | Value of the continuation token found in the next property of the JSON object returned in the response. Include this parameter to get the next array of user IDs. + limit: 56 # Integer | The maximum number of user IDs to retrieve in a single request. +} + +begin + + result = api_instance.get_followers(opts) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_followers: #{e}" +end +``` + +#### Using the get_followers_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_followers_with_http_info(opts) + +```ruby +begin + + data, status_code, headers = api_instance.get_followers_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_followers_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **start** | **String** | Value of the continuation token found in the next property of the JSON object returned in the response. Include this parameter to get the next array of user IDs. | [optional] | +| **limit** | **Integer** | The maximum number of user IDs to retrieve in a single request. | [optional][default to 300] | + +### Return type + +[**GetFollowersResponse**](GetFollowersResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_group_member_count + +> get_group_member_count(group_id) + + + +Get number of users in a group chat + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +group_id = 'group_id_example' # String | Group ID + +begin + + result = api_instance.get_group_member_count(group_id) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_group_member_count: #{e}" +end +``` + +#### Using the get_group_member_count_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_group_member_count_with_http_info(group_id) + +```ruby +begin + + data, status_code, headers = api_instance.get_group_member_count_with_http_info(group_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_group_member_count_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **group_id** | **String** | Group ID | | + +### Return type + +[**GroupMemberCountResponse**](GroupMemberCountResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_group_member_profile + +> get_group_member_profile(group_id, user_id) + + + +Get group chat member profile + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +group_id = 'group_id_example' # String | Group ID +user_id = 'user_id_example' # String | User ID + +begin + + result = api_instance.get_group_member_profile(group_id, user_id) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_group_member_profile: #{e}" +end +``` + +#### Using the get_group_member_profile_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_group_member_profile_with_http_info(group_id, user_id) + +```ruby +begin + + data, status_code, headers = api_instance.get_group_member_profile_with_http_info(group_id, user_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_group_member_profile_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **group_id** | **String** | Group ID | | +| **user_id** | **String** | User ID | | + +### Return type + +[**GroupUserProfileResponse**](GroupUserProfileResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_group_members_ids + +> get_group_members_ids(group_id, opts) + + + +Get group chat member user IDs + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +group_id = 'group_id_example' # String | Group ID +opts = { + start: 'start_example' # String | Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group. +} + +begin + + result = api_instance.get_group_members_ids(group_id, opts) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_group_members_ids: #{e}" +end +``` + +#### Using the get_group_members_ids_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_group_members_ids_with_http_info(group_id, opts) + +```ruby +begin + + data, status_code, headers = api_instance.get_group_members_ids_with_http_info(group_id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_group_members_ids_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **group_id** | **String** | Group ID | | +| **start** | **String** | Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group. | [optional] | + +### Return type + +[**MembersIdsResponse**](MembersIdsResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_group_summary + +> get_group_summary(group_id) + + + +Get group chat summary + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +group_id = 'group_id_example' # String | Group ID + +begin + + result = api_instance.get_group_summary(group_id) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_group_summary: #{e}" +end +``` + +#### Using the get_group_summary_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_group_summary_with_http_info(group_id) + +```ruby +begin + + data, status_code, headers = api_instance.get_group_summary_with_http_info(group_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_group_summary_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **group_id** | **String** | Group ID | | + +### Return type + +[**GroupSummaryResponse**](GroupSummaryResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_message_quota + +> get_message_quota + + + +Gets the target limit for sending messages in the current month. The total number of the free messages and the additional messages is returned. + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new + +begin + + result = api_instance.get_message_quota + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_message_quota: #{e}" +end +``` + +#### Using the get_message_quota_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_message_quota_with_http_info + +```ruby +begin + + data, status_code, headers = api_instance.get_message_quota_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_message_quota_with_http_info: #{e}" +end +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**MessageQuotaResponse**](MessageQuotaResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_message_quota_consumption + +> get_message_quota_consumption + + + +Gets the number of messages sent in the current month. + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new + +begin + + result = api_instance.get_message_quota_consumption + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_message_quota_consumption: #{e}" +end +``` + +#### Using the get_message_quota_consumption_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_message_quota_consumption_with_http_info + +```ruby +begin + + data, status_code, headers = api_instance.get_message_quota_consumption_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_message_quota_consumption_with_http_info: #{e}" +end +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**QuotaConsumptionResponse**](QuotaConsumptionResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_narrowcast_progress + +> get_narrowcast_progress(request_id) + + + +Gets the status of a narrowcast message. + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +request_id = 'request_id_example' # String | The narrowcast message's request ID. Each Messaging API request has a request ID. + +begin + + result = api_instance.get_narrowcast_progress(request_id) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_narrowcast_progress: #{e}" +end +``` + +#### Using the get_narrowcast_progress_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_narrowcast_progress_with_http_info(request_id) + +```ruby +begin + + data, status_code, headers = api_instance.get_narrowcast_progress_with_http_info(request_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_narrowcast_progress_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **request_id** | **String** | The narrowcast message's request ID. Each Messaging API request has a request ID. | | + +### Return type + +[**NarrowcastProgressResponse**](NarrowcastProgressResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_number_of_sent_broadcast_messages + +> get_number_of_sent_broadcast_messages(date) + + + +Get number of sent broadcast messages + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +date = 'date_example' # String | Date the messages were sent Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9 + +begin + + result = api_instance.get_number_of_sent_broadcast_messages(date) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_number_of_sent_broadcast_messages: #{e}" +end +``` + +#### Using the get_number_of_sent_broadcast_messages_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_number_of_sent_broadcast_messages_with_http_info(date) + +```ruby +begin + + data, status_code, headers = api_instance.get_number_of_sent_broadcast_messages_with_http_info(date) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_number_of_sent_broadcast_messages_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **date** | **String** | Date the messages were sent Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9 | | + +### Return type + +[**NumberOfMessagesResponse**](NumberOfMessagesResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_number_of_sent_multicast_messages + +> get_number_of_sent_multicast_messages(date) + + + +Get number of sent multicast messages + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +date = 'date_example' # String | Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 + +begin + + result = api_instance.get_number_of_sent_multicast_messages(date) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_number_of_sent_multicast_messages: #{e}" +end +``` + +#### Using the get_number_of_sent_multicast_messages_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_number_of_sent_multicast_messages_with_http_info(date) + +```ruby +begin + + data, status_code, headers = api_instance.get_number_of_sent_multicast_messages_with_http_info(date) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_number_of_sent_multicast_messages_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **date** | **String** | Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 | | + +### Return type + +[**NumberOfMessagesResponse**](NumberOfMessagesResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_number_of_sent_push_messages + +> get_number_of_sent_push_messages(date) + + + +Get number of sent push messages + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +date = 'date_example' # String | Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 + +begin + + result = api_instance.get_number_of_sent_push_messages(date) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_number_of_sent_push_messages: #{e}" +end +``` + +#### Using the get_number_of_sent_push_messages_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_number_of_sent_push_messages_with_http_info(date) + +```ruby +begin + + data, status_code, headers = api_instance.get_number_of_sent_push_messages_with_http_info(date) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_number_of_sent_push_messages_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **date** | **String** | Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 | | + +### Return type + +[**NumberOfMessagesResponse**](NumberOfMessagesResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_number_of_sent_reply_messages + +> get_number_of_sent_reply_messages(date) + + + +Get number of sent reply messages + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +date = 'date_example' # String | Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 + +begin + + result = api_instance.get_number_of_sent_reply_messages(date) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_number_of_sent_reply_messages: #{e}" +end +``` + +#### Using the get_number_of_sent_reply_messages_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_number_of_sent_reply_messages_with_http_info(date) + +```ruby +begin + + data, status_code, headers = api_instance.get_number_of_sent_reply_messages_with_http_info(date) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_number_of_sent_reply_messages_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **date** | **String** | Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 | | + +### Return type + +[**NumberOfMessagesResponse**](NumberOfMessagesResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_pnp_message_statistics + +> get_pnp_message_statistics(date) + + + +Get number of sent LINE notification messages  + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +date = 'date_example' # String | Date the message was sent Format: `yyyyMMdd` (Example:`20211231`) Time zone: UTC+9 + +begin + + result = api_instance.get_pnp_message_statistics(date) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_pnp_message_statistics: #{e}" +end +``` + +#### Using the get_pnp_message_statistics_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_pnp_message_statistics_with_http_info(date) + +```ruby +begin + + data, status_code, headers = api_instance.get_pnp_message_statistics_with_http_info(date) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_pnp_message_statistics_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **date** | **String** | Date the message was sent Format: `yyyyMMdd` (Example:`20211231`) Time zone: UTC+9 | | + +### Return type + +[**NumberOfMessagesResponse**](NumberOfMessagesResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_profile + +> get_profile(user_id) + + + +Get profile + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +user_id = 'user_id_example' # String | User ID + +begin + + result = api_instance.get_profile(user_id) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_profile: #{e}" +end +``` + +#### Using the get_profile_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_profile_with_http_info(user_id) + +```ruby +begin + + data, status_code, headers = api_instance.get_profile_with_http_info(user_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_profile_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **user_id** | **String** | User ID | | + +### Return type + +[**UserProfileResponse**](UserProfileResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_rich_menu + +> get_rich_menu(rich_menu_id) + + + +Gets a rich menu via a rich menu ID. + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +rich_menu_id = 'rich_menu_id_example' # String | ID of a rich menu + +begin + + result = api_instance.get_rich_menu(rich_menu_id) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_rich_menu: #{e}" +end +``` + +#### Using the get_rich_menu_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_rich_menu_with_http_info(rich_menu_id) + +```ruby +begin + + data, status_code, headers = api_instance.get_rich_menu_with_http_info(rich_menu_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_rich_menu_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rich_menu_id** | **String** | ID of a rich menu | | + +### Return type + +[**RichMenuResponse**](RichMenuResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_rich_menu_alias + +> get_rich_menu_alias(rich_menu_alias_id) + + + +Get rich menu alias information + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +rich_menu_alias_id = 'rich_menu_alias_id_example' # String | The rich menu alias ID whose information you want to obtain. + +begin + + result = api_instance.get_rich_menu_alias(rich_menu_alias_id) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_rich_menu_alias: #{e}" +end +``` + +#### Using the get_rich_menu_alias_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_rich_menu_alias_with_http_info(rich_menu_alias_id) + +```ruby +begin + + data, status_code, headers = api_instance.get_rich_menu_alias_with_http_info(rich_menu_alias_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_rich_menu_alias_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rich_menu_alias_id** | **String** | The rich menu alias ID whose information you want to obtain. | | + +### Return type + +[**RichMenuAliasResponse**](RichMenuAliasResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_rich_menu_alias_list + +> get_rich_menu_alias_list + + + +Get list of rich menu alias + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new + +begin + + result = api_instance.get_rich_menu_alias_list + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_rich_menu_alias_list: #{e}" +end +``` + +#### Using the get_rich_menu_alias_list_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_rich_menu_alias_list_with_http_info + +```ruby +begin + + data, status_code, headers = api_instance.get_rich_menu_alias_list_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_rich_menu_alias_list_with_http_info: #{e}" +end +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**RichMenuAliasListResponse**](RichMenuAliasListResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_rich_menu_batch_progress + +> get_rich_menu_batch_progress(request_id) + + + +Get the status of Replace or unlink a linked rich menus in batches. + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +request_id = 'request_id_example' # String | A request ID used to batch control the rich menu linked to the user. Each Messaging API request has a request ID. + +begin + + result = api_instance.get_rich_menu_batch_progress(request_id) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_rich_menu_batch_progress: #{e}" +end +``` + +#### Using the get_rich_menu_batch_progress_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_rich_menu_batch_progress_with_http_info(request_id) + +```ruby +begin + + data, status_code, headers = api_instance.get_rich_menu_batch_progress_with_http_info(request_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_rich_menu_batch_progress_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **request_id** | **String** | A request ID used to batch control the rich menu linked to the user. Each Messaging API request has a request ID. | | + +### Return type + +[**RichMenuBatchProgressResponse**](RichMenuBatchProgressResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_rich_menu_id_of_user + +> get_rich_menu_id_of_user(user_id) + + + +Get rich menu ID of user + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +user_id = 'user_id_example' # String | User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. + +begin + + result = api_instance.get_rich_menu_id_of_user(user_id) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_rich_menu_id_of_user: #{e}" +end +``` + +#### Using the get_rich_menu_id_of_user_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_rich_menu_id_of_user_with_http_info(user_id) + +```ruby +begin + + data, status_code, headers = api_instance.get_rich_menu_id_of_user_with_http_info(user_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_rich_menu_id_of_user_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **user_id** | **String** | User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. | | + +### Return type + +[**RichMenuIdResponse**](RichMenuIdResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_rich_menu_list + +> get_rich_menu_list + + + +Get rich menu list + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new + +begin + + result = api_instance.get_rich_menu_list + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_rich_menu_list: #{e}" +end +``` + +#### Using the get_rich_menu_list_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_rich_menu_list_with_http_info + +```ruby +begin + + data, status_code, headers = api_instance.get_rich_menu_list_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_rich_menu_list_with_http_info: #{e}" +end +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**RichMenuListResponse**](RichMenuListResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_room_member_count + +> get_room_member_count(room_id) + + + +Get number of users in a multi-person chat + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +room_id = 'room_id_example' # String | Room ID + +begin + + result = api_instance.get_room_member_count(room_id) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_room_member_count: #{e}" +end +``` + +#### Using the get_room_member_count_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_room_member_count_with_http_info(room_id) + +```ruby +begin + + data, status_code, headers = api_instance.get_room_member_count_with_http_info(room_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_room_member_count_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **room_id** | **String** | Room ID | | + +### Return type + +[**RoomMemberCountResponse**](RoomMemberCountResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_room_member_profile + +> get_room_member_profile(room_id, user_id) + + + +Get multi-person chat member profile + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +room_id = 'room_id_example' # String | Room ID +user_id = 'user_id_example' # String | User ID + +begin + + result = api_instance.get_room_member_profile(room_id, user_id) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_room_member_profile: #{e}" +end +``` + +#### Using the get_room_member_profile_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_room_member_profile_with_http_info(room_id, user_id) + +```ruby +begin + + data, status_code, headers = api_instance.get_room_member_profile_with_http_info(room_id, user_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_room_member_profile_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **room_id** | **String** | Room ID | | +| **user_id** | **String** | User ID | | + +### Return type + +[**RoomUserProfileResponse**](RoomUserProfileResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_room_members_ids + +> get_room_members_ids(room_id, opts) + + + +Get multi-person chat member user IDs + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +room_id = 'room_id_example' # String | Room ID +opts = { + start: 'start_example' # String | Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group. +} + +begin + + result = api_instance.get_room_members_ids(room_id, opts) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_room_members_ids: #{e}" +end +``` + +#### Using the get_room_members_ids_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_room_members_ids_with_http_info(room_id, opts) + +```ruby +begin + + data, status_code, headers = api_instance.get_room_members_ids_with_http_info(room_id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_room_members_ids_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **room_id** | **String** | Room ID | | +| **start** | **String** | Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group. | [optional] | + +### Return type + +[**MembersIdsResponse**](MembersIdsResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_webhook_endpoint + +> get_webhook_endpoint + + + +Get webhook endpoint information + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new + +begin + + result = api_instance.get_webhook_endpoint + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_webhook_endpoint: #{e}" +end +``` + +#### Using the get_webhook_endpoint_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_webhook_endpoint_with_http_info + +```ruby +begin + + data, status_code, headers = api_instance.get_webhook_endpoint_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->get_webhook_endpoint_with_http_info: #{e}" +end +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**GetWebhookEndpointResponse**](GetWebhookEndpointResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## issue_link_token + +> issue_link_token(user_id) + + + +Issue link token + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +user_id = 'user_id_example' # String | User ID for the LINE account to be linked. Found in the `source` object of account link event objects. Do not use the LINE ID used in LINE. + +begin + + result = api_instance.issue_link_token(user_id) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->issue_link_token: #{e}" +end +``` + +#### Using the issue_link_token_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> issue_link_token_with_http_info(user_id) + +```ruby +begin + + data, status_code, headers = api_instance.issue_link_token_with_http_info(user_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->issue_link_token_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **user_id** | **String** | User ID for the LINE account to be linked. Found in the `source` object of account link event objects. Do not use the LINE ID used in LINE. | | + +### Return type + +[**IssueLinkTokenResponse**](IssueLinkTokenResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## leave_group + +> leave_group(group_id) + + + +Leave group chat + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +group_id = 'group_id_example' # String | Group ID + +begin + + api_instance.leave_group(group_id) +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->leave_group: #{e}" +end +``` + +#### Using the leave_group_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> leave_group_with_http_info(group_id) + +```ruby +begin + + data, status_code, headers = api_instance.leave_group_with_http_info(group_id) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->leave_group_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **group_id** | **String** | Group ID | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## leave_room + +> leave_room(room_id) + + + +Leave multi-person chat + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +room_id = 'room_id_example' # String | Room ID + +begin + + api_instance.leave_room(room_id) +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->leave_room: #{e}" +end +``` + +#### Using the leave_room_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> leave_room_with_http_info(room_id) + +```ruby +begin + + data, status_code, headers = api_instance.leave_room_with_http_info(room_id) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->leave_room_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **room_id** | **String** | Room ID | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## link_rich_menu_id_to_user + +> link_rich_menu_id_to_user(user_id, rich_menu_id) + + + +Link rich menu to user. + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +user_id = 'user_id_example' # String | User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. +rich_menu_id = 'rich_menu_id_example' # String | ID of a rich menu + +begin + + api_instance.link_rich_menu_id_to_user(user_id, rich_menu_id) +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->link_rich_menu_id_to_user: #{e}" +end +``` + +#### Using the link_rich_menu_id_to_user_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> link_rich_menu_id_to_user_with_http_info(user_id, rich_menu_id) + +```ruby +begin + + data, status_code, headers = api_instance.link_rich_menu_id_to_user_with_http_info(user_id, rich_menu_id) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->link_rich_menu_id_to_user_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **user_id** | **String** | User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. | | +| **rich_menu_id** | **String** | ID of a rich menu | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## link_rich_menu_id_to_users + +> link_rich_menu_id_to_users(rich_menu_bulk_link_request) + + + +Link rich menu to multiple users + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +rich_menu_bulk_link_request = LINE::Client::MessagingApi::RichMenuBulkLinkRequest.new({rich_menu_id: 'rich_menu_id_example', user_ids: ['user_ids_example']}) # RichMenuBulkLinkRequest | + +begin + + api_instance.link_rich_menu_id_to_users(rich_menu_bulk_link_request) +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->link_rich_menu_id_to_users: #{e}" +end +``` + +#### Using the link_rich_menu_id_to_users_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> link_rich_menu_id_to_users_with_http_info(rich_menu_bulk_link_request) + +```ruby +begin + + data, status_code, headers = api_instance.link_rich_menu_id_to_users_with_http_info(rich_menu_bulk_link_request) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->link_rich_menu_id_to_users_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rich_menu_bulk_link_request** | [**RichMenuBulkLinkRequest**](RichMenuBulkLinkRequest.md) | | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## mark_messages_as_read + +> mark_messages_as_read(mark_messages_as_read_request) + + + +Mark messages from users as read + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +mark_messages_as_read_request = LINE::Client::MessagingApi::MarkMessagesAsReadRequest.new({chat: LINE::Client::MessagingApi::ChatReference.new({user_id: 'user_id_example'})}) # MarkMessagesAsReadRequest | + +begin + + api_instance.mark_messages_as_read(mark_messages_as_read_request) +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->mark_messages_as_read: #{e}" +end +``` + +#### Using the mark_messages_as_read_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> mark_messages_as_read_with_http_info(mark_messages_as_read_request) + +```ruby +begin + + data, status_code, headers = api_instance.mark_messages_as_read_with_http_info(mark_messages_as_read_request) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->mark_messages_as_read_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **mark_messages_as_read_request** | [**MarkMessagesAsReadRequest**](MarkMessagesAsReadRequest.md) | | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## multicast + +> Object multicast(multicast_request, opts) + + + +An API that efficiently sends the same message to multiple user IDs. You can't send messages to group chats or multi-person chats. + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +multicast_request = LINE::Client::MessagingApi::MulticastRequest.new({messages: [LINE::Client::MessagingApi::Message.new({type: 'type_example'})], to: ['to_example']}) # MulticastRequest | +opts = { + x_line_retry_key: '38400000-8cf0-11bd-b23e-10b96e4ef00d' # String | Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. +} + +begin + + result = api_instance.multicast(multicast_request, opts) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->multicast: #{e}" +end +``` + +#### Using the multicast_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> multicast_with_http_info(multicast_request, opts) + +```ruby +begin + + data, status_code, headers = api_instance.multicast_with_http_info(multicast_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => Object +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->multicast_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **multicast_request** | [**MulticastRequest**](MulticastRequest.md) | | | +| **x_line_retry_key** | **String** | Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. | [optional] | + +### Return type + +**Object** + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## narrowcast + +> Object narrowcast(narrowcast_request, opts) + + + +Send narrowcast message + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +narrowcast_request = LINE::Client::MessagingApi::NarrowcastRequest.new({messages: [LINE::Client::MessagingApi::Message.new({type: 'type_example'})]}) # NarrowcastRequest | +opts = { + x_line_retry_key: '38400000-8cf0-11bd-b23e-10b96e4ef00d' # String | Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. +} + +begin + + result = api_instance.narrowcast(narrowcast_request, opts) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->narrowcast: #{e}" +end +``` + +#### Using the narrowcast_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> narrowcast_with_http_info(narrowcast_request, opts) + +```ruby +begin + + data, status_code, headers = api_instance.narrowcast_with_http_info(narrowcast_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => Object +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->narrowcast_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **narrowcast_request** | [**NarrowcastRequest**](NarrowcastRequest.md) | | | +| **x_line_retry_key** | **String** | Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. | [optional] | + +### Return type + +**Object** + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## push_message + +> push_message(push_message_request, opts) + + + +Sends a message to a user, group chat, or multi-person chat at any time. + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +push_message_request = LINE::Client::MessagingApi::PushMessageRequest.new({to: 'to_example', messages: [LINE::Client::MessagingApi::Message.new({type: 'type_example'})]}) # PushMessageRequest | +opts = { + x_line_retry_key: '38400000-8cf0-11bd-b23e-10b96e4ef00d' # String | Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. +} + +begin + + result = api_instance.push_message(push_message_request, opts) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->push_message: #{e}" +end +``` + +#### Using the push_message_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> push_message_with_http_info(push_message_request, opts) + +```ruby +begin + + data, status_code, headers = api_instance.push_message_with_http_info(push_message_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->push_message_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **push_message_request** | [**PushMessageRequest**](PushMessageRequest.md) | | | +| **x_line_retry_key** | **String** | Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. | [optional] | + +### Return type + +[**PushMessageResponse**](PushMessageResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## push_messages_by_phone + +> push_messages_by_phone(pnp_messages_request, opts) + + + +Send LINE notification message + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +pnp_messages_request = LINE::Client::MessagingApi::PnpMessagesRequest.new({messages: [LINE::Client::MessagingApi::Message.new({type: 'type_example'})], to: 'to_example'}) # PnpMessagesRequest | +opts = { + x_line_delivery_tag: 'x_line_delivery_tag_example' # String | String returned in the delivery.data property of the delivery completion event via Webhook. +} + +begin + + api_instance.push_messages_by_phone(pnp_messages_request, opts) +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->push_messages_by_phone: #{e}" +end +``` + +#### Using the push_messages_by_phone_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> push_messages_by_phone_with_http_info(pnp_messages_request, opts) + +```ruby +begin + + data, status_code, headers = api_instance.push_messages_by_phone_with_http_info(pnp_messages_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->push_messages_by_phone_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **pnp_messages_request** | [**PnpMessagesRequest**](PnpMessagesRequest.md) | | | +| **x_line_delivery_tag** | **String** | String returned in the delivery.data property of the delivery completion event via Webhook. | [optional] | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## reply_message + +> reply_message(reply_message_request) + + + +Send reply message + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +reply_message_request = LINE::Client::MessagingApi::ReplyMessageRequest.new({reply_token: 'reply_token_example', messages: [LINE::Client::MessagingApi::Message.new({type: 'type_example'})]}) # ReplyMessageRequest | + +begin + + result = api_instance.reply_message(reply_message_request) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->reply_message: #{e}" +end +``` + +#### Using the reply_message_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> reply_message_with_http_info(reply_message_request) + +```ruby +begin + + data, status_code, headers = api_instance.reply_message_with_http_info(reply_message_request) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->reply_message_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **reply_message_request** | [**ReplyMessageRequest**](ReplyMessageRequest.md) | | | + +### Return type + +[**ReplyMessageResponse**](ReplyMessageResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## rich_menu_batch + +> rich_menu_batch(rich_menu_batch_request) + + + +You can use this endpoint to batch control the rich menu linked to the users using the endpoint such as Link rich menu to user. The following operations are available: 1. Replace a rich menu with another rich menu for all users linked to a specific rich menu 2. Unlink a rich menu for all users linked to a specific rich menu 3. Unlink a rich menu for all users linked the rich menu + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +rich_menu_batch_request = LINE::Client::MessagingApi::RichMenuBatchRequest.new({operations: [LINE::Client::MessagingApi::RichMenuBatchOperation.new({type: 'type_example'})]}) # RichMenuBatchRequest | + +begin + + api_instance.rich_menu_batch(rich_menu_batch_request) +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->rich_menu_batch: #{e}" +end +``` + +#### Using the rich_menu_batch_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> rich_menu_batch_with_http_info(rich_menu_batch_request) + +```ruby +begin + + data, status_code, headers = api_instance.rich_menu_batch_with_http_info(rich_menu_batch_request) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->rich_menu_batch_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rich_menu_batch_request** | [**RichMenuBatchRequest**](RichMenuBatchRequest.md) | | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## set_default_rich_menu + +> set_default_rich_menu(rich_menu_id) + + + +Set default rich menu + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +rich_menu_id = 'rich_menu_id_example' # String | ID of a rich menu + +begin + + api_instance.set_default_rich_menu(rich_menu_id) +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->set_default_rich_menu: #{e}" +end +``` + +#### Using the set_default_rich_menu_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> set_default_rich_menu_with_http_info(rich_menu_id) + +```ruby +begin + + data, status_code, headers = api_instance.set_default_rich_menu_with_http_info(rich_menu_id) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->set_default_rich_menu_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rich_menu_id** | **String** | ID of a rich menu | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## set_webhook_endpoint + +> set_webhook_endpoint(set_webhook_endpoint_request) + + + +Set webhook endpoint URL + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +set_webhook_endpoint_request = LINE::Client::MessagingApi::SetWebhookEndpointRequest.new({endpoint: 'endpoint_example'}) # SetWebhookEndpointRequest | + +begin + + api_instance.set_webhook_endpoint(set_webhook_endpoint_request) +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->set_webhook_endpoint: #{e}" +end +``` + +#### Using the set_webhook_endpoint_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> set_webhook_endpoint_with_http_info(set_webhook_endpoint_request) + +```ruby +begin + + data, status_code, headers = api_instance.set_webhook_endpoint_with_http_info(set_webhook_endpoint_request) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->set_webhook_endpoint_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **set_webhook_endpoint_request** | [**SetWebhookEndpointRequest**](SetWebhookEndpointRequest.md) | | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## test_webhook_endpoint + +> test_webhook_endpoint(opts) + + + +Test webhook endpoint + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +opts = { + test_webhook_endpoint_request: LINE::Client::MessagingApi::TestWebhookEndpointRequest.new # TestWebhookEndpointRequest | +} + +begin + + result = api_instance.test_webhook_endpoint(opts) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->test_webhook_endpoint: #{e}" +end +``` + +#### Using the test_webhook_endpoint_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> test_webhook_endpoint_with_http_info(opts) + +```ruby +begin + + data, status_code, headers = api_instance.test_webhook_endpoint_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->test_webhook_endpoint_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **test_webhook_endpoint_request** | [**TestWebhookEndpointRequest**](TestWebhookEndpointRequest.md) | | [optional] | + +### Return type + +[**TestWebhookEndpointResponse**](TestWebhookEndpointResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## unlink_rich_menu_id_from_user + +> unlink_rich_menu_id_from_user(user_id) + + + +Unlink rich menu from user + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +user_id = 'user_id_example' # String | User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. + +begin + + api_instance.unlink_rich_menu_id_from_user(user_id) +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->unlink_rich_menu_id_from_user: #{e}" +end +``` + +#### Using the unlink_rich_menu_id_from_user_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> unlink_rich_menu_id_from_user_with_http_info(user_id) + +```ruby +begin + + data, status_code, headers = api_instance.unlink_rich_menu_id_from_user_with_http_info(user_id) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->unlink_rich_menu_id_from_user_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **user_id** | **String** | User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +## unlink_rich_menu_id_from_users + +> unlink_rich_menu_id_from_users(rich_menu_bulk_unlink_request) + + + +Unlink rich menus from multiple users + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +rich_menu_bulk_unlink_request = LINE::Client::MessagingApi::RichMenuBulkUnlinkRequest.new({user_ids: ['user_ids_example']}) # RichMenuBulkUnlinkRequest | + +begin + + api_instance.unlink_rich_menu_id_from_users(rich_menu_bulk_unlink_request) +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->unlink_rich_menu_id_from_users: #{e}" +end +``` + +#### Using the unlink_rich_menu_id_from_users_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> unlink_rich_menu_id_from_users_with_http_info(rich_menu_bulk_unlink_request) + +```ruby +begin + + data, status_code, headers = api_instance.unlink_rich_menu_id_from_users_with_http_info(rich_menu_bulk_unlink_request) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->unlink_rich_menu_id_from_users_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rich_menu_bulk_unlink_request** | [**RichMenuBulkUnlinkRequest**](RichMenuBulkUnlinkRequest.md) | | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## update_rich_menu_alias + +> update_rich_menu_alias(rich_menu_alias_id, update_rich_menu_alias_request) + + + +Update rich menu alias + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +rich_menu_alias_id = 'rich_menu_alias_id_example' # String | The rich menu alias ID you want to update. +update_rich_menu_alias_request = LINE::Client::MessagingApi::UpdateRichMenuAliasRequest.new({rich_menu_id: 'rich_menu_id_example'}) # UpdateRichMenuAliasRequest | + +begin + + api_instance.update_rich_menu_alias(rich_menu_alias_id, update_rich_menu_alias_request) +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->update_rich_menu_alias: #{e}" +end +``` + +#### Using the update_rich_menu_alias_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> update_rich_menu_alias_with_http_info(rich_menu_alias_id, update_rich_menu_alias_request) + +```ruby +begin + + data, status_code, headers = api_instance.update_rich_menu_alias_with_http_info(rich_menu_alias_id, update_rich_menu_alias_request) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->update_rich_menu_alias_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rich_menu_alias_id** | **String** | The rich menu alias ID you want to update. | | +| **update_rich_menu_alias_request** | [**UpdateRichMenuAliasRequest**](UpdateRichMenuAliasRequest.md) | | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## validate_broadcast + +> validate_broadcast(validate_message_request) + + + +Validate message objects of a broadcast message + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +validate_message_request = LINE::Client::MessagingApi::ValidateMessageRequest.new({messages: [LINE::Client::MessagingApi::Message.new({type: 'type_example'})]}) # ValidateMessageRequest | + +begin + + api_instance.validate_broadcast(validate_message_request) +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->validate_broadcast: #{e}" +end +``` + +#### Using the validate_broadcast_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> validate_broadcast_with_http_info(validate_message_request) + +```ruby +begin + + data, status_code, headers = api_instance.validate_broadcast_with_http_info(validate_message_request) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->validate_broadcast_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **validate_message_request** | [**ValidateMessageRequest**](ValidateMessageRequest.md) | | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## validate_multicast + +> validate_multicast(validate_message_request) + + + +Validate message objects of a multicast message + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +validate_message_request = LINE::Client::MessagingApi::ValidateMessageRequest.new({messages: [LINE::Client::MessagingApi::Message.new({type: 'type_example'})]}) # ValidateMessageRequest | + +begin + + api_instance.validate_multicast(validate_message_request) +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->validate_multicast: #{e}" +end +``` + +#### Using the validate_multicast_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> validate_multicast_with_http_info(validate_message_request) + +```ruby +begin + + data, status_code, headers = api_instance.validate_multicast_with_http_info(validate_message_request) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->validate_multicast_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **validate_message_request** | [**ValidateMessageRequest**](ValidateMessageRequest.md) | | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## validate_narrowcast + +> validate_narrowcast(validate_message_request) + + + +Validate message objects of a narrowcast message + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +validate_message_request = LINE::Client::MessagingApi::ValidateMessageRequest.new({messages: [LINE::Client::MessagingApi::Message.new({type: 'type_example'})]}) # ValidateMessageRequest | + +begin + + api_instance.validate_narrowcast(validate_message_request) +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->validate_narrowcast: #{e}" +end +``` + +#### Using the validate_narrowcast_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> validate_narrowcast_with_http_info(validate_message_request) + +```ruby +begin + + data, status_code, headers = api_instance.validate_narrowcast_with_http_info(validate_message_request) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->validate_narrowcast_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **validate_message_request** | [**ValidateMessageRequest**](ValidateMessageRequest.md) | | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## validate_push + +> validate_push(validate_message_request) + + + +Validate message objects of a push message + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +validate_message_request = LINE::Client::MessagingApi::ValidateMessageRequest.new({messages: [LINE::Client::MessagingApi::Message.new({type: 'type_example'})]}) # ValidateMessageRequest | + +begin + + api_instance.validate_push(validate_message_request) +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->validate_push: #{e}" +end +``` + +#### Using the validate_push_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> validate_push_with_http_info(validate_message_request) + +```ruby +begin + + data, status_code, headers = api_instance.validate_push_with_http_info(validate_message_request) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->validate_push_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **validate_message_request** | [**ValidateMessageRequest**](ValidateMessageRequest.md) | | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## validate_reply + +> validate_reply(validate_message_request) + + + +Validate message objects of a reply message + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +validate_message_request = LINE::Client::MessagingApi::ValidateMessageRequest.new({messages: [LINE::Client::MessagingApi::Message.new({type: 'type_example'})]}) # ValidateMessageRequest | + +begin + + api_instance.validate_reply(validate_message_request) +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->validate_reply: #{e}" +end +``` + +#### Using the validate_reply_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> validate_reply_with_http_info(validate_message_request) + +```ruby +begin + + data, status_code, headers = api_instance.validate_reply_with_http_info(validate_message_request) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->validate_reply_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **validate_message_request** | [**ValidateMessageRequest**](ValidateMessageRequest.md) | | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## validate_rich_menu_batch_request + +> validate_rich_menu_batch_request(rich_menu_batch_request) + + + +Validate a request body of the Replace or unlink the linked rich menus in batches endpoint. + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +rich_menu_batch_request = LINE::Client::MessagingApi::RichMenuBatchRequest.new({operations: [LINE::Client::MessagingApi::RichMenuBatchOperation.new({type: 'type_example'})]}) # RichMenuBatchRequest | + +begin + + api_instance.validate_rich_menu_batch_request(rich_menu_batch_request) +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->validate_rich_menu_batch_request: #{e}" +end +``` + +#### Using the validate_rich_menu_batch_request_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> validate_rich_menu_batch_request_with_http_info(rich_menu_batch_request) + +```ruby +begin + + data, status_code, headers = api_instance.validate_rich_menu_batch_request_with_http_info(rich_menu_batch_request) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->validate_rich_menu_batch_request_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rich_menu_batch_request** | [**RichMenuBatchRequest**](RichMenuBatchRequest.md) | | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## validate_rich_menu_object + +> validate_rich_menu_object(rich_menu_request) + + + +Validate rich menu object + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiApi.new +rich_menu_request = LINE::Client::MessagingApi::RichMenuRequest.new # RichMenuRequest | + +begin + + api_instance.validate_rich_menu_object(rich_menu_request) +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->validate_rich_menu_object: #{e}" +end +``` + +#### Using the validate_rich_menu_object_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> validate_rich_menu_object_with_http_info(rich_menu_request) + +```ruby +begin + + data, status_code, headers = api_instance.validate_rich_menu_object_with_http_info(rich_menu_request) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiApi->validate_rich_menu_object_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rich_menu_request** | [**RichMenuRequest**](RichMenuRequest.md) | | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + diff --git a/lib/clients/messaging-api/docs/MessagingApiBlobApi.md b/lib/clients/messaging-api/docs/MessagingApiBlobApi.md new file mode 100644 index 00000000..ac093c3f --- /dev/null +++ b/lib/clients/messaging-api/docs/MessagingApiBlobApi.md @@ -0,0 +1,360 @@ +# LINE::Client::MessagingApi::MessagingApiBlobApi + +All URIs are relative to *https://api.line.me* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**get_message_content**](MessagingApiBlobApi.md#get_message_content) | **GET** /v2/bot/message/{messageId}/content | | +| [**get_message_content_preview**](MessagingApiBlobApi.md#get_message_content_preview) | **GET** /v2/bot/message/{messageId}/content/preview | | +| [**get_message_content_transcoding_by_message_id**](MessagingApiBlobApi.md#get_message_content_transcoding_by_message_id) | **GET** /v2/bot/message/{messageId}/content/transcoding | | +| [**get_rich_menu_image**](MessagingApiBlobApi.md#get_rich_menu_image) | **GET** /v2/bot/richmenu/{richMenuId}/content | | +| [**set_rich_menu_image**](MessagingApiBlobApi.md#set_rich_menu_image) | **POST** /v2/bot/richmenu/{richMenuId}/content | | + + +## get_message_content + +> File get_message_content(message_id) + + + +Download image, video, and audio data sent from users. + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiBlobApi.new +message_id = 'message_id_example' # String | Message ID of video or audio + +begin + + result = api_instance.get_message_content(message_id) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiBlobApi->get_message_content: #{e}" +end +``` + +#### Using the get_message_content_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> get_message_content_with_http_info(message_id) + +```ruby +begin + + data, status_code, headers = api_instance.get_message_content_with_http_info(message_id) + p status_code # => 2xx + p headers # => { ... } + p data # => File +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiBlobApi->get_message_content_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **message_id** | **String** | Message ID of video or audio | | + +### Return type + +**File** + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + + +## get_message_content_preview + +> File get_message_content_preview(message_id) + + + +Get a preview image of the image or video + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiBlobApi.new +message_id = 'message_id_example' # String | Message ID of image or video + +begin + + result = api_instance.get_message_content_preview(message_id) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiBlobApi->get_message_content_preview: #{e}" +end +``` + +#### Using the get_message_content_preview_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> get_message_content_preview_with_http_info(message_id) + +```ruby +begin + + data, status_code, headers = api_instance.get_message_content_preview_with_http_info(message_id) + p status_code # => 2xx + p headers # => { ... } + p data # => File +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiBlobApi->get_message_content_preview_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **message_id** | **String** | Message ID of image or video | | + +### Return type + +**File** + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + + +## get_message_content_transcoding_by_message_id + +> get_message_content_transcoding_by_message_id(message_id) + + + +Verify the preparation status of a video or audio for getting + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiBlobApi.new +message_id = 'message_id_example' # String | Message ID of video or audio + +begin + + result = api_instance.get_message_content_transcoding_by_message_id(message_id) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiBlobApi->get_message_content_transcoding_by_message_id: #{e}" +end +``` + +#### Using the get_message_content_transcoding_by_message_id_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_message_content_transcoding_by_message_id_with_http_info(message_id) + +```ruby +begin + + data, status_code, headers = api_instance.get_message_content_transcoding_by_message_id_with_http_info(message_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiBlobApi->get_message_content_transcoding_by_message_id_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **message_id** | **String** | Message ID of video or audio | | + +### Return type + +[**GetMessageContentTranscodingResponse**](GetMessageContentTranscodingResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_rich_menu_image + +> File get_rich_menu_image(rich_menu_id) + + + +Download rich menu image. + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiBlobApi.new +rich_menu_id = 'rich_menu_id_example' # String | ID of the rich menu with the image to be downloaded + +begin + + result = api_instance.get_rich_menu_image(rich_menu_id) + p result +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiBlobApi->get_rich_menu_image: #{e}" +end +``` + +#### Using the get_rich_menu_image_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> get_rich_menu_image_with_http_info(rich_menu_id) + +```ruby +begin + + data, status_code, headers = api_instance.get_rich_menu_image_with_http_info(rich_menu_id) + p status_code # => 2xx + p headers # => { ... } + p data # => File +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiBlobApi->get_rich_menu_image_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rich_menu_id** | **String** | ID of the rich menu with the image to be downloaded | | + +### Return type + +**File** + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + + +## set_rich_menu_image + +> set_rich_menu_image(rich_menu_id, opts) + + + +Upload rich menu image + +### Examples + +```ruby +require 'time' +require 'line_client_messaging_api' +# setup authorization +LINE::Client::MessagingApi.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::MessagingApi::MessagingApiBlobApi.new +rich_menu_id = 'rich_menu_id_example' # String | The ID of the rich menu to attach the image to +opts = { + body: File.new('/path/to/some/file') # File | +} + +begin + + api_instance.set_rich_menu_image(rich_menu_id, opts) +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiBlobApi->set_rich_menu_image: #{e}" +end +``` + +#### Using the set_rich_menu_image_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> set_rich_menu_image_with_http_info(rich_menu_id, opts) + +```ruby +begin + + data, status_code, headers = api_instance.set_rich_menu_image_with_http_info(rich_menu_id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::MessagingApi::ApiError => e + puts "Error when calling MessagingApiBlobApi->set_rich_menu_image_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rich_menu_id** | **String** | The ID of the rich menu to attach the image to | | +| **body** | **File** | | [optional] | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + diff --git a/lib/clients/messaging-api/docs/MulticastRequest.md b/lib/clients/messaging-api/docs/MulticastRequest.md new file mode 100644 index 00000000..4a3fc159 --- /dev/null +++ b/lib/clients/messaging-api/docs/MulticastRequest.md @@ -0,0 +1,24 @@ +# LINE::Client::MessagingApi::MulticastRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **messages** | [**Array<Message>**](Message.md) | Messages to send | | +| **to** | **Array<String>** | Array of user IDs. Use userId values which are returned in webhook event objects. Do not use LINE IDs found on LINE. | | +| **notification_disabled** | **Boolean** | `true`: The user doesn’t receive a push notification when a message is sent. `false`: The user receives a push notification when the message is sent (unless they have disabled push notifications in LINE and/or their device). The default value is false. | [optional][default to false] | +| **custom_aggregation_units** | **Array<String>** | Name of aggregation unit. Case-sensitive. | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::MulticastRequest.new( + messages: null, + to: null, + notification_disabled: null, + custom_aggregation_units: null +) +``` + diff --git a/lib/clients/messaging-api/docs/NarrowcastProgressResponse.md b/lib/clients/messaging-api/docs/NarrowcastProgressResponse.md new file mode 100644 index 00000000..7c204b74 --- /dev/null +++ b/lib/clients/messaging-api/docs/NarrowcastProgressResponse.md @@ -0,0 +1,32 @@ +# LINE::Client::MessagingApi::NarrowcastProgressResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **phase** | **String** | The current status. One of: `waiting`: Messages are not yet ready to be sent. They are currently being filtered or processed in some way. `sending`: Messages are currently being sent. `succeeded`: Messages were sent successfully. This may not mean the messages were successfully received. `failed`: Messages failed to be sent. Use the failedDescription property to find the cause of the failure. | | +| **success_count** | **Integer** | The number of users who successfully received the message. | [optional] | +| **failure_count** | **Integer** | The number of users who failed to send the message. | [optional] | +| **target_count** | **Integer** | The number of intended recipients of the message. | [optional] | +| **failed_description** | **String** | The reason the message failed to be sent. This is only included with a `phase` property value of `failed`. | [optional] | +| **error_code** | **Integer** | Error summary. This is only included with a phase property value of failed. One of: `1`: An internal error occurred. `2`: An error occurred because there weren't enough recipients. `3`: A conflict error of requests occurs because a request that has already been accepted is retried. | [optional] | +| **accepted_time** | **Time** | Narrowcast message request accepted time in milliseconds. Format: ISO 8601 (e.g. 2020-12-03T10:15:30.121Z) Timezone: UTC | | +| **completed_time** | **Time** | Processing of narrowcast message request completion time in milliseconds. Returned when the phase property is succeeded or failed. Format: ISO 8601 (e.g. 2020-12-03T10:15:30.121Z) Timezone: UTC | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::NarrowcastProgressResponse.new( + phase: null, + success_count: null, + failure_count: null, + target_count: null, + failed_description: null, + error_code: null, + accepted_time: null, + completed_time: null +) +``` + diff --git a/lib/clients/messaging-api/docs/NarrowcastRequest.md b/lib/clients/messaging-api/docs/NarrowcastRequest.md new file mode 100644 index 00000000..17942a6f --- /dev/null +++ b/lib/clients/messaging-api/docs/NarrowcastRequest.md @@ -0,0 +1,26 @@ +# LINE::Client::MessagingApi::NarrowcastRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **messages** | [**Array<Message>**](Message.md) | List of Message objects. | | +| **recipient** | [**Recipient**](Recipient.md) | | [optional] | +| **filter** | [**Filter**](Filter.md) | | [optional] | +| **limit** | [**Limit**](Limit.md) | | [optional] | +| **notification_disabled** | **Boolean** | `true`: The user doesn’t receive a push notification when a message is sent. `false`: The user receives a push notification when the message is sent (unless they have disabled push notifications in LINE and/or their device). The default value is false. | [optional][default to false] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::NarrowcastRequest.new( + messages: null, + recipient: null, + filter: null, + limit: null, + notification_disabled: null +) +``` + diff --git a/lib/clients/messaging-api/docs/NumberOfMessagesResponse.md b/lib/clients/messaging-api/docs/NumberOfMessagesResponse.md new file mode 100644 index 00000000..2b16a794 --- /dev/null +++ b/lib/clients/messaging-api/docs/NumberOfMessagesResponse.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::NumberOfMessagesResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **status** | **String** | Aggregation process status. One of: `ready`: The number of messages can be obtained. `unready`: We haven't finished calculating the number of sent messages for the specified in date. For example, this property is returned when the delivery date or a future date is specified. Calculation usually takes about a day. `unavailable_for_privacy`: The total number of messages on the specified day is less than 20. `out_of_service`: The specified date is earlier than the date on which we first started calculating sent messages (March 31, 2018). | | +| **success** | **Integer** | The number of messages delivered using the phone number on the date specified in `date`. The response has this property only when the value of `status` is `ready`. | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::NumberOfMessagesResponse.new( + status: null, + success: null +) +``` + diff --git a/lib/clients/messaging-api/docs/OperatorDemographicFilter.md b/lib/clients/messaging-api/docs/OperatorDemographicFilter.md new file mode 100644 index 00000000..46a105f5 --- /dev/null +++ b/lib/clients/messaging-api/docs/OperatorDemographicFilter.md @@ -0,0 +1,22 @@ +# LINE::Client::MessagingApi::OperatorDemographicFilter + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **_and** | [**Array<DemographicFilter>**](DemographicFilter.md) | | [optional] | +| **_or** | [**Array<DemographicFilter>**](DemographicFilter.md) | | [optional] | +| **_not** | [**DemographicFilter**](DemographicFilter.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::OperatorDemographicFilter.new( + _and: null, + _or: null, + _not: null +) +``` + diff --git a/lib/clients/messaging-api/docs/OperatorDemographicFilterAllOf.md b/lib/clients/messaging-api/docs/OperatorDemographicFilterAllOf.md new file mode 100644 index 00000000..12d9b72c --- /dev/null +++ b/lib/clients/messaging-api/docs/OperatorDemographicFilterAllOf.md @@ -0,0 +1,22 @@ +# LINE::Client::MessagingApi::OperatorDemographicFilterAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **_and** | [**Array<DemographicFilter>**](DemographicFilter.md) | | [optional] | +| **_or** | [**Array<DemographicFilter>**](DemographicFilter.md) | | [optional] | +| **_not** | [**DemographicFilter**](DemographicFilter.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::OperatorDemographicFilterAllOf.new( + _and: null, + _or: null, + _not: null +) +``` + diff --git a/lib/clients/messaging-api/docs/OperatorRecipient.md b/lib/clients/messaging-api/docs/OperatorRecipient.md new file mode 100644 index 00000000..36a4fd80 --- /dev/null +++ b/lib/clients/messaging-api/docs/OperatorRecipient.md @@ -0,0 +1,22 @@ +# LINE::Client::MessagingApi::OperatorRecipient + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **_and** | [**Array<Recipient>**](Recipient.md) | Create a new recipient object by taking the logical conjunction (AND) of the specified array of recipient objects. | [optional] | +| **_or** | [**Array<Recipient>**](Recipient.md) | Create a new recipient object by taking the logical disjunction (OR) of the specified array of recipient objects. | [optional] | +| **_not** | [**Recipient**](Recipient.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::OperatorRecipient.new( + _and: null, + _or: null, + _not: null +) +``` + diff --git a/lib/clients/messaging-api/docs/OperatorRecipientAllOf.md b/lib/clients/messaging-api/docs/OperatorRecipientAllOf.md new file mode 100644 index 00000000..67ff494e --- /dev/null +++ b/lib/clients/messaging-api/docs/OperatorRecipientAllOf.md @@ -0,0 +1,22 @@ +# LINE::Client::MessagingApi::OperatorRecipientAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **_and** | [**Array<Recipient>**](Recipient.md) | Create a new recipient object by taking the logical conjunction (AND) of the specified array of recipient objects. | [optional] | +| **_or** | [**Array<Recipient>**](Recipient.md) | Create a new recipient object by taking the logical disjunction (OR) of the specified array of recipient objects. | [optional] | +| **_not** | [**Recipient**](Recipient.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::OperatorRecipientAllOf.new( + _and: null, + _or: null, + _not: null +) +``` + diff --git a/lib/clients/messaging-api/docs/PnpMessagesRequest.md b/lib/clients/messaging-api/docs/PnpMessagesRequest.md new file mode 100644 index 00000000..b7696ecd --- /dev/null +++ b/lib/clients/messaging-api/docs/PnpMessagesRequest.md @@ -0,0 +1,22 @@ +# LINE::Client::MessagingApi::PnpMessagesRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **messages** | [**Array<Message>**](Message.md) | Message to be sent. | | +| **to** | **String** | Message destination. Specify a phone number that has been normalized to E.164 format and hashed with SHA256. | | +| **notification_disabled** | **Boolean** | `true`: The user doesn’t receive a push notification when a message is sent. `false`: The user receives a push notification when the message is sent (unless they have disabled push notifications in LINE and/or their device). The default value is false. | [optional][default to false] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::PnpMessagesRequest.new( + messages: null, + to: null, + notification_disabled: null +) +``` + diff --git a/lib/clients/messaging-api/docs/PostbackAction.md b/lib/clients/messaging-api/docs/PostbackAction.md new file mode 100644 index 00000000..13820913 --- /dev/null +++ b/lib/clients/messaging-api/docs/PostbackAction.md @@ -0,0 +1,26 @@ +# LINE::Client::MessagingApi::PostbackAction + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | **String** | | [optional] | +| **display_text** | **String** | | [optional] | +| **text** | **String** | | [optional] | +| **input_option** | **String** | | [optional] | +| **fill_in_text** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::PostbackAction.new( + data: null, + display_text: null, + text: null, + input_option: null, + fill_in_text: null +) +``` + diff --git a/lib/clients/messaging-api/docs/PostbackActionAllOf.md b/lib/clients/messaging-api/docs/PostbackActionAllOf.md new file mode 100644 index 00000000..de9c49b3 --- /dev/null +++ b/lib/clients/messaging-api/docs/PostbackActionAllOf.md @@ -0,0 +1,26 @@ +# LINE::Client::MessagingApi::PostbackActionAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | **String** | | [optional] | +| **display_text** | **String** | | [optional] | +| **text** | **String** | | [optional] | +| **input_option** | **String** | | [optional] | +| **fill_in_text** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::PostbackActionAllOf.new( + data: null, + display_text: null, + text: null, + input_option: null, + fill_in_text: null +) +``` + diff --git a/lib/clients/messaging-api/docs/PushMessageRequest.md b/lib/clients/messaging-api/docs/PushMessageRequest.md new file mode 100644 index 00000000..b10731c2 --- /dev/null +++ b/lib/clients/messaging-api/docs/PushMessageRequest.md @@ -0,0 +1,24 @@ +# LINE::Client::MessagingApi::PushMessageRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **to** | **String** | ID of the receiver. | | +| **messages** | [**Array<Message>**](Message.md) | List of Message objects. | | +| **notification_disabled** | **Boolean** | `true`: The user doesn’t receive a push notification when a message is sent. `false`: The user receives a push notification when the message is sent (unless they have disabled push notifications in LINE and/or their device). The default value is false. | [optional][default to false] | +| **custom_aggregation_units** | **Array<String>** | List of aggregation unit name. Case-sensitive. This functions can only be used by corporate users who have submitted the required applications. | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::PushMessageRequest.new( + to: null, + messages: null, + notification_disabled: null, + custom_aggregation_units: null +) +``` + diff --git a/lib/clients/messaging-api/docs/PushMessageResponse.md b/lib/clients/messaging-api/docs/PushMessageResponse.md new file mode 100644 index 00000000..1216dc87 --- /dev/null +++ b/lib/clients/messaging-api/docs/PushMessageResponse.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::PushMessageResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **sent_messages** | [**Array<SentMessage>**](SentMessage.md) | Array of sent messages. | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::PushMessageResponse.new( + sent_messages: null +) +``` + diff --git a/lib/clients/messaging-api/docs/QuickReply.md b/lib/clients/messaging-api/docs/QuickReply.md new file mode 100644 index 00000000..dedaa242 --- /dev/null +++ b/lib/clients/messaging-api/docs/QuickReply.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::QuickReply + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **items** | [**Array<QuickReplyItem>**](QuickReplyItem.md) | Quick reply button objects. | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::QuickReply.new( + items: null +) +``` + diff --git a/lib/clients/messaging-api/docs/QuickReplyItem.md b/lib/clients/messaging-api/docs/QuickReplyItem.md new file mode 100644 index 00000000..c985985e --- /dev/null +++ b/lib/clients/messaging-api/docs/QuickReplyItem.md @@ -0,0 +1,22 @@ +# LINE::Client::MessagingApi::QuickReplyItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **image_url** | **String** | URL of the icon that is displayed at the beginning of the button | [optional] | +| **action** | [**Action**](Action.md) | | [optional] | +| **type** | **String** | `action` | [optional][default to 'action'] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::QuickReplyItem.new( + image_url: null, + action: null, + type: null +) +``` + diff --git a/lib/clients/messaging-api/docs/QuotaConsumptionResponse.md b/lib/clients/messaging-api/docs/QuotaConsumptionResponse.md new file mode 100644 index 00000000..9200fa4a --- /dev/null +++ b/lib/clients/messaging-api/docs/QuotaConsumptionResponse.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::QuotaConsumptionResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **total_usage** | **Integer** | The number of sent messages in the current month | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::QuotaConsumptionResponse.new( + total_usage: null +) +``` + diff --git a/lib/clients/messaging-api/docs/QuotaType.md b/lib/clients/messaging-api/docs/QuotaType.md new file mode 100644 index 00000000..bdf8a856 --- /dev/null +++ b/lib/clients/messaging-api/docs/QuotaType.md @@ -0,0 +1,15 @@ +# LINE::Client::MessagingApi::QuotaType + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::QuotaType.new() +``` + diff --git a/lib/clients/messaging-api/docs/Recipient.md b/lib/clients/messaging-api/docs/Recipient.md new file mode 100644 index 00000000..19b1050f --- /dev/null +++ b/lib/clients/messaging-api/docs/Recipient.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::Recipient + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | Type of recipient | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::Recipient.new( + type: null +) +``` + diff --git a/lib/clients/messaging-api/docs/RedeliveryRecipient.md b/lib/clients/messaging-api/docs/RedeliveryRecipient.md new file mode 100644 index 00000000..9876ad51 --- /dev/null +++ b/lib/clients/messaging-api/docs/RedeliveryRecipient.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::RedeliveryRecipient + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **request_id** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::RedeliveryRecipient.new( + request_id: null +) +``` + diff --git a/lib/clients/messaging-api/docs/RedeliveryRecipientAllOf.md b/lib/clients/messaging-api/docs/RedeliveryRecipientAllOf.md new file mode 100644 index 00000000..28e832b8 --- /dev/null +++ b/lib/clients/messaging-api/docs/RedeliveryRecipientAllOf.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::RedeliveryRecipientAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **request_id** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::RedeliveryRecipientAllOf.new( + request_id: null +) +``` + diff --git a/lib/clients/messaging-api/docs/ReplyMessageRequest.md b/lib/clients/messaging-api/docs/ReplyMessageRequest.md new file mode 100644 index 00000000..e9fc9e7e --- /dev/null +++ b/lib/clients/messaging-api/docs/ReplyMessageRequest.md @@ -0,0 +1,22 @@ +# LINE::Client::MessagingApi::ReplyMessageRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **reply_token** | **String** | replyToken received via webhook. | | +| **messages** | [**Array<Message>**](Message.md) | List of messages. | | +| **notification_disabled** | **Boolean** | `true`: The user doesn’t receive a push notification when a message is sent. `false`: The user receives a push notification when the message is sent (unless they have disabled push notifications in LINE and/or their device). The default value is false. | [optional][default to false] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::ReplyMessageRequest.new( + reply_token: null, + messages: null, + notification_disabled: null +) +``` + diff --git a/lib/clients/messaging-api/docs/ReplyMessageResponse.md b/lib/clients/messaging-api/docs/ReplyMessageResponse.md new file mode 100644 index 00000000..526e06b6 --- /dev/null +++ b/lib/clients/messaging-api/docs/ReplyMessageResponse.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::ReplyMessageResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **sent_messages** | [**Array<SentMessage>**](SentMessage.md) | Array of sent messages. | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::ReplyMessageResponse.new( + sent_messages: null +) +``` + diff --git a/lib/clients/messaging-api/docs/RichMenuAliasListResponse.md b/lib/clients/messaging-api/docs/RichMenuAliasListResponse.md new file mode 100644 index 00000000..f46bf3c7 --- /dev/null +++ b/lib/clients/messaging-api/docs/RichMenuAliasListResponse.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::RichMenuAliasListResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **aliases** | [**Array<RichMenuAliasResponse>**](RichMenuAliasResponse.md) | Rich menu aliases. | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::RichMenuAliasListResponse.new( + aliases: null +) +``` + diff --git a/lib/clients/messaging-api/docs/RichMenuAliasResponse.md b/lib/clients/messaging-api/docs/RichMenuAliasResponse.md new file mode 100644 index 00000000..4521ed46 --- /dev/null +++ b/lib/clients/messaging-api/docs/RichMenuAliasResponse.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::RichMenuAliasResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rich_menu_alias_id** | **String** | Rich menu alias ID. | | +| **rich_menu_id** | **String** | The rich menu ID associated with the rich menu alias. | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::RichMenuAliasResponse.new( + rich_menu_alias_id: null, + rich_menu_id: null +) +``` + diff --git a/lib/clients/messaging-api/docs/RichMenuArea.md b/lib/clients/messaging-api/docs/RichMenuArea.md new file mode 100644 index 00000000..033dc048 --- /dev/null +++ b/lib/clients/messaging-api/docs/RichMenuArea.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::RichMenuArea + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **bounds** | [**RichMenuBounds**](RichMenuBounds.md) | | [optional] | +| **action** | [**Action**](Action.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::RichMenuArea.new( + bounds: null, + action: null +) +``` + diff --git a/lib/clients/messaging-api/docs/RichMenuBatchLinkOperation.md b/lib/clients/messaging-api/docs/RichMenuBatchLinkOperation.md new file mode 100644 index 00000000..1a1d6b57 --- /dev/null +++ b/lib/clients/messaging-api/docs/RichMenuBatchLinkOperation.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::RichMenuBatchLinkOperation + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **from** | **String** | | | +| **to** | **String** | | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::RichMenuBatchLinkOperation.new( + from: null, + to: null +) +``` + diff --git a/lib/clients/messaging-api/docs/RichMenuBatchLinkOperationAllOf.md b/lib/clients/messaging-api/docs/RichMenuBatchLinkOperationAllOf.md new file mode 100644 index 00000000..4deab9e4 --- /dev/null +++ b/lib/clients/messaging-api/docs/RichMenuBatchLinkOperationAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::RichMenuBatchLinkOperationAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **from** | **String** | | [optional] | +| **to** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::RichMenuBatchLinkOperationAllOf.new( + from: null, + to: null +) +``` + diff --git a/lib/clients/messaging-api/docs/RichMenuBatchOperation.md b/lib/clients/messaging-api/docs/RichMenuBatchOperation.md new file mode 100644 index 00000000..968668a7 --- /dev/null +++ b/lib/clients/messaging-api/docs/RichMenuBatchOperation.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::RichMenuBatchOperation + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | The type of operation to the rich menu linked to the user. One of link, unlink, or unlinkAll. | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::RichMenuBatchOperation.new( + type: null +) +``` + diff --git a/lib/clients/messaging-api/docs/RichMenuBatchProgressPhase.md b/lib/clients/messaging-api/docs/RichMenuBatchProgressPhase.md new file mode 100644 index 00000000..05c8a85c --- /dev/null +++ b/lib/clients/messaging-api/docs/RichMenuBatchProgressPhase.md @@ -0,0 +1,15 @@ +# LINE::Client::MessagingApi::RichMenuBatchProgressPhase + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::RichMenuBatchProgressPhase.new() +``` + diff --git a/lib/clients/messaging-api/docs/RichMenuBatchProgressResponse.md b/lib/clients/messaging-api/docs/RichMenuBatchProgressResponse.md new file mode 100644 index 00000000..269aacdd --- /dev/null +++ b/lib/clients/messaging-api/docs/RichMenuBatchProgressResponse.md @@ -0,0 +1,22 @@ +# LINE::Client::MessagingApi::RichMenuBatchProgressResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **phase** | [**RichMenuBatchProgressPhase**](RichMenuBatchProgressPhase.md) | | | +| **accepted_time** | **Time** | The accepted time in milliseconds of the request of batch control the rich menu. Format: ISO 8601 (e.g. 2023-06-08T10:15:30.121Z) Timezone: UTC | | +| **completed_time** | **Time** | The completed time in milliseconds of rich menu batch control. Returned when the phase property is succeeded or failed. Format: ISO 8601 (e.g. 2023-06-08T10:15:30.121Z) Timezone: UTC | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::RichMenuBatchProgressResponse.new( + phase: null, + accepted_time: null, + completed_time: null +) +``` + diff --git a/lib/clients/messaging-api/docs/RichMenuBatchRequest.md b/lib/clients/messaging-api/docs/RichMenuBatchRequest.md new file mode 100644 index 00000000..b23ae977 --- /dev/null +++ b/lib/clients/messaging-api/docs/RichMenuBatchRequest.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::RichMenuBatchRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **operations** | [**Array<RichMenuBatchOperation>**](RichMenuBatchOperation.md) | Array of Rich menu operation object... | | +| **resume_request_key** | **String** | Key for retry. Key value is a string matching the regular expression pattern | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::RichMenuBatchRequest.new( + operations: null, + resume_request_key: null +) +``` + diff --git a/lib/clients/messaging-api/docs/RichMenuBatchUnlinkAllOperation.md b/lib/clients/messaging-api/docs/RichMenuBatchUnlinkAllOperation.md new file mode 100644 index 00000000..aa384f2a --- /dev/null +++ b/lib/clients/messaging-api/docs/RichMenuBatchUnlinkAllOperation.md @@ -0,0 +1,15 @@ +# LINE::Client::MessagingApi::RichMenuBatchUnlinkAllOperation + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::RichMenuBatchUnlinkAllOperation.new() +``` + diff --git a/lib/clients/messaging-api/docs/RichMenuBatchUnlinkOperation.md b/lib/clients/messaging-api/docs/RichMenuBatchUnlinkOperation.md new file mode 100644 index 00000000..1a09371a --- /dev/null +++ b/lib/clients/messaging-api/docs/RichMenuBatchUnlinkOperation.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::RichMenuBatchUnlinkOperation + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **from** | **String** | | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::RichMenuBatchUnlinkOperation.new( + from: null +) +``` + diff --git a/lib/clients/messaging-api/docs/RichMenuBatchUnlinkOperationAllOf.md b/lib/clients/messaging-api/docs/RichMenuBatchUnlinkOperationAllOf.md new file mode 100644 index 00000000..1ac3aaf9 --- /dev/null +++ b/lib/clients/messaging-api/docs/RichMenuBatchUnlinkOperationAllOf.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::RichMenuBatchUnlinkOperationAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **from** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::RichMenuBatchUnlinkOperationAllOf.new( + from: null +) +``` + diff --git a/lib/clients/messaging-api/docs/RichMenuBounds.md b/lib/clients/messaging-api/docs/RichMenuBounds.md new file mode 100644 index 00000000..e273b3ac --- /dev/null +++ b/lib/clients/messaging-api/docs/RichMenuBounds.md @@ -0,0 +1,24 @@ +# LINE::Client::MessagingApi::RichMenuBounds + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **x** | **Integer** | Horizontal position relative to the top-left corner of the area. | [optional] | +| **y** | **Integer** | Vertical position relative to the top-left corner of the area. | [optional] | +| **width** | **Integer** | Width of the area. | [optional] | +| **height** | **Integer** | Height of the area. | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::RichMenuBounds.new( + x: null, + y: null, + width: null, + height: null +) +``` + diff --git a/lib/clients/messaging-api/docs/RichMenuBulkLinkRequest.md b/lib/clients/messaging-api/docs/RichMenuBulkLinkRequest.md new file mode 100644 index 00000000..35e31a91 --- /dev/null +++ b/lib/clients/messaging-api/docs/RichMenuBulkLinkRequest.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::RichMenuBulkLinkRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rich_menu_id** | **String** | ID of a rich menu | | +| **user_ids** | **Array<String>** | Array of user IDs. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::RichMenuBulkLinkRequest.new( + rich_menu_id: null, + user_ids: null +) +``` + diff --git a/lib/clients/messaging-api/docs/RichMenuBulkUnlinkRequest.md b/lib/clients/messaging-api/docs/RichMenuBulkUnlinkRequest.md new file mode 100644 index 00000000..e4bd2d32 --- /dev/null +++ b/lib/clients/messaging-api/docs/RichMenuBulkUnlinkRequest.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::RichMenuBulkUnlinkRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **user_ids** | **Array<String>** | Array of user IDs. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::RichMenuBulkUnlinkRequest.new( + user_ids: null +) +``` + diff --git a/lib/clients/messaging-api/docs/RichMenuIdResponse.md b/lib/clients/messaging-api/docs/RichMenuIdResponse.md new file mode 100644 index 00000000..24f17a60 --- /dev/null +++ b/lib/clients/messaging-api/docs/RichMenuIdResponse.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::RichMenuIdResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rich_menu_id** | **String** | Rich menu ID | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::RichMenuIdResponse.new( + rich_menu_id: null +) +``` + diff --git a/lib/clients/messaging-api/docs/RichMenuListResponse.md b/lib/clients/messaging-api/docs/RichMenuListResponse.md new file mode 100644 index 00000000..8f177d00 --- /dev/null +++ b/lib/clients/messaging-api/docs/RichMenuListResponse.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::RichMenuListResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **richmenus** | [**Array<RichMenuResponse>**](RichMenuResponse.md) | Rich menus | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::RichMenuListResponse.new( + richmenus: null +) +``` + diff --git a/lib/clients/messaging-api/docs/RichMenuRequest.md b/lib/clients/messaging-api/docs/RichMenuRequest.md new file mode 100644 index 00000000..a616a3ea --- /dev/null +++ b/lib/clients/messaging-api/docs/RichMenuRequest.md @@ -0,0 +1,26 @@ +# LINE::Client::MessagingApi::RichMenuRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **size** | [**RichMenuSize**](RichMenuSize.md) | | [optional] | +| **selected** | **Boolean** | `true` to display the rich menu by default. Otherwise, `false`. | [optional] | +| **name** | **String** | Name of the rich menu. This value can be used to help manage your rich menus and is not displayed to users. | [optional] | +| **chat_bar_text** | **String** | Text displayed in the chat bar | [optional] | +| **areas** | [**Array<RichMenuArea>**](RichMenuArea.md) | Array of area objects which define the coordinates and size of tappable areas | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::RichMenuRequest.new( + size: null, + selected: null, + name: null, + chat_bar_text: null, + areas: null +) +``` + diff --git a/lib/clients/messaging-api/docs/RichMenuResponse.md b/lib/clients/messaging-api/docs/RichMenuResponse.md new file mode 100644 index 00000000..1d89d170 --- /dev/null +++ b/lib/clients/messaging-api/docs/RichMenuResponse.md @@ -0,0 +1,28 @@ +# LINE::Client::MessagingApi::RichMenuResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rich_menu_id** | **String** | ID of a rich menu | | +| **size** | [**RichMenuSize**](RichMenuSize.md) | | | +| **selected** | **Boolean** | `true` to display the rich menu by default. Otherwise, `false`. | | +| **name** | **String** | Name of the rich menu. This value can be used to help manage your rich menus and is not displayed to users. | | +| **chat_bar_text** | **String** | Text displayed in the chat bar | | +| **areas** | [**Array<RichMenuArea>**](RichMenuArea.md) | Array of area objects which define the coordinates and size of tappable areas | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::RichMenuResponse.new( + rich_menu_id: null, + size: null, + selected: null, + name: null, + chat_bar_text: null, + areas: null +) +``` + diff --git a/lib/clients/messaging-api/docs/RichMenuSize.md b/lib/clients/messaging-api/docs/RichMenuSize.md new file mode 100644 index 00000000..5d3bfa4c --- /dev/null +++ b/lib/clients/messaging-api/docs/RichMenuSize.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::RichMenuSize + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **width** | **Integer** | width | [optional] | +| **height** | **Integer** | height | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::RichMenuSize.new( + width: null, + height: null +) +``` + diff --git a/lib/clients/messaging-api/docs/RichMenuSwitchAction.md b/lib/clients/messaging-api/docs/RichMenuSwitchAction.md new file mode 100644 index 00000000..de0791fc --- /dev/null +++ b/lib/clients/messaging-api/docs/RichMenuSwitchAction.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::RichMenuSwitchAction + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | **String** | | [optional] | +| **rich_menu_alias_id** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::RichMenuSwitchAction.new( + data: null, + rich_menu_alias_id: null +) +``` + diff --git a/lib/clients/messaging-api/docs/RichMenuSwitchActionAllOf.md b/lib/clients/messaging-api/docs/RichMenuSwitchActionAllOf.md new file mode 100644 index 00000000..e9d651af --- /dev/null +++ b/lib/clients/messaging-api/docs/RichMenuSwitchActionAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::RichMenuSwitchActionAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | **String** | | [optional] | +| **rich_menu_alias_id** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::RichMenuSwitchActionAllOf.new( + data: null, + rich_menu_alias_id: null +) +``` + diff --git a/lib/clients/messaging-api/docs/RoomMemberCountResponse.md b/lib/clients/messaging-api/docs/RoomMemberCountResponse.md new file mode 100644 index 00000000..eae9caec --- /dev/null +++ b/lib/clients/messaging-api/docs/RoomMemberCountResponse.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::RoomMemberCountResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **count** | **Integer** | The count of members in the multi-person chat. The number returned excludes the LINE Official Account. | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::RoomMemberCountResponse.new( + count: null +) +``` + diff --git a/lib/clients/messaging-api/docs/RoomUserProfileResponse.md b/lib/clients/messaging-api/docs/RoomUserProfileResponse.md new file mode 100644 index 00000000..f32528d6 --- /dev/null +++ b/lib/clients/messaging-api/docs/RoomUserProfileResponse.md @@ -0,0 +1,22 @@ +# LINE::Client::MessagingApi::RoomUserProfileResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **display_name** | **String** | User's display name | | +| **user_id** | **String** | User ID | | +| **picture_url** | **String** | Profile image URL. `https` image URL. Not included in the response if the user doesn't have a profile image. | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::RoomUserProfileResponse.new( + display_name: null, + user_id: null, + picture_url: null +) +``` + diff --git a/lib/clients/messaging-api/docs/Sender.md b/lib/clients/messaging-api/docs/Sender.md new file mode 100644 index 00000000..fc53e079 --- /dev/null +++ b/lib/clients/messaging-api/docs/Sender.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::Sender + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | Display name. Certain words such as `LINE` may not be used. | [optional] | +| **icon_url** | **String** | URL of the image to display as an icon when sending a message | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::Sender.new( + name: null, + icon_url: null +) +``` + diff --git a/lib/clients/messaging-api/docs/SentMessage.md b/lib/clients/messaging-api/docs/SentMessage.md new file mode 100644 index 00000000..c5766a4a --- /dev/null +++ b/lib/clients/messaging-api/docs/SentMessage.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::SentMessage + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | ID of the sent message. | | +| **quote_token** | **String** | Quote token of the message. Only included when a message object that can be specified as a quote target was sent as a push or reply message. | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::SentMessage.new( + id: null, + quote_token: null +) +``` + diff --git a/lib/clients/messaging-api/docs/SetWebhookEndpointRequest.md b/lib/clients/messaging-api/docs/SetWebhookEndpointRequest.md new file mode 100644 index 00000000..513fa882 --- /dev/null +++ b/lib/clients/messaging-api/docs/SetWebhookEndpointRequest.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::SetWebhookEndpointRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **endpoint** | **String** | A valid webhook URL. | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::SetWebhookEndpointRequest.new( + endpoint: null +) +``` + diff --git a/lib/clients/messaging-api/docs/StickerMessage.md b/lib/clients/messaging-api/docs/StickerMessage.md new file mode 100644 index 00000000..02d06b9d --- /dev/null +++ b/lib/clients/messaging-api/docs/StickerMessage.md @@ -0,0 +1,22 @@ +# LINE::Client::MessagingApi::StickerMessage + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **package_id** | **String** | | [optional] | +| **sticker_id** | **String** | | [optional] | +| **quote_token** | **String** | Quote token of the message you want to quote. | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::StickerMessage.new( + package_id: null, + sticker_id: null, + quote_token: null +) +``` + diff --git a/lib/clients/messaging-api/docs/StickerMessageAllOf.md b/lib/clients/messaging-api/docs/StickerMessageAllOf.md new file mode 100644 index 00000000..d0b2ada0 --- /dev/null +++ b/lib/clients/messaging-api/docs/StickerMessageAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::StickerMessageAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **package_id** | **String** | | [optional] | +| **sticker_id** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::StickerMessageAllOf.new( + package_id: null, + sticker_id: null +) +``` + diff --git a/lib/clients/messaging-api/docs/SubscriptionPeriodDemographic.md b/lib/clients/messaging-api/docs/SubscriptionPeriodDemographic.md new file mode 100644 index 00000000..9e5e9b29 --- /dev/null +++ b/lib/clients/messaging-api/docs/SubscriptionPeriodDemographic.md @@ -0,0 +1,15 @@ +# LINE::Client::MessagingApi::SubscriptionPeriodDemographic + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::SubscriptionPeriodDemographic.new() +``` + diff --git a/lib/clients/messaging-api/docs/SubscriptionPeriodDemographicFilter.md b/lib/clients/messaging-api/docs/SubscriptionPeriodDemographicFilter.md new file mode 100644 index 00000000..68fd81b8 --- /dev/null +++ b/lib/clients/messaging-api/docs/SubscriptionPeriodDemographicFilter.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::SubscriptionPeriodDemographicFilter + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **gte** | [**SubscriptionPeriodDemographic**](SubscriptionPeriodDemographic.md) | | [optional] | +| **lt** | [**SubscriptionPeriodDemographic**](SubscriptionPeriodDemographic.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::SubscriptionPeriodDemographicFilter.new( + gte: null, + lt: null +) +``` + diff --git a/lib/clients/messaging-api/docs/SubscriptionPeriodDemographicFilterAllOf.md b/lib/clients/messaging-api/docs/SubscriptionPeriodDemographicFilterAllOf.md new file mode 100644 index 00000000..4744dee9 --- /dev/null +++ b/lib/clients/messaging-api/docs/SubscriptionPeriodDemographicFilterAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::SubscriptionPeriodDemographicFilterAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **gte** | [**SubscriptionPeriodDemographic**](SubscriptionPeriodDemographic.md) | | [optional] | +| **lt** | [**SubscriptionPeriodDemographic**](SubscriptionPeriodDemographic.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::SubscriptionPeriodDemographicFilterAllOf.new( + gte: null, + lt: null +) +``` + diff --git a/lib/clients/messaging-api/docs/Template.md b/lib/clients/messaging-api/docs/Template.md new file mode 100644 index 00000000..3314e064 --- /dev/null +++ b/lib/clients/messaging-api/docs/Template.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::Template + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::Template.new( + type: null +) +``` + diff --git a/lib/clients/messaging-api/docs/TemplateMessage.md b/lib/clients/messaging-api/docs/TemplateMessage.md new file mode 100644 index 00000000..2a6548b1 --- /dev/null +++ b/lib/clients/messaging-api/docs/TemplateMessage.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::TemplateMessage + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **alt_text** | **String** | | [optional] | +| **template** | [**Template**](Template.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::TemplateMessage.new( + alt_text: null, + template: null +) +``` + diff --git a/lib/clients/messaging-api/docs/TemplateMessageAllOf.md b/lib/clients/messaging-api/docs/TemplateMessageAllOf.md new file mode 100644 index 00000000..ddb8b86e --- /dev/null +++ b/lib/clients/messaging-api/docs/TemplateMessageAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::TemplateMessageAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **alt_text** | **String** | | [optional] | +| **template** | [**Template**](Template.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::TemplateMessageAllOf.new( + alt_text: null, + template: null +) +``` + diff --git a/lib/clients/messaging-api/docs/TestWebhookEndpointRequest.md b/lib/clients/messaging-api/docs/TestWebhookEndpointRequest.md new file mode 100644 index 00000000..a746b733 --- /dev/null +++ b/lib/clients/messaging-api/docs/TestWebhookEndpointRequest.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::TestWebhookEndpointRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **endpoint** | **String** | A webhook URL to be validated. | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::TestWebhookEndpointRequest.new( + endpoint: null +) +``` + diff --git a/lib/clients/messaging-api/docs/TestWebhookEndpointResponse.md b/lib/clients/messaging-api/docs/TestWebhookEndpointResponse.md new file mode 100644 index 00000000..ab467f07 --- /dev/null +++ b/lib/clients/messaging-api/docs/TestWebhookEndpointResponse.md @@ -0,0 +1,26 @@ +# LINE::Client::MessagingApi::TestWebhookEndpointResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **success** | **Boolean** | Result of the communication from the LINE platform to the webhook URL. | [optional] | +| **timestamp** | **Time** | Time of the event in milliseconds. Even in the case of a redelivered webhook, it represents the time the event occurred, not the time it was redelivered. | | +| **status_code** | **Integer** | The HTTP status code. If the webhook response isn't received, the status code is set to zero or a negative number. | | +| **reason** | **String** | Reason for the response. | | +| **detail** | **String** | Details of the response. | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::TestWebhookEndpointResponse.new( + success: null, + timestamp: null, + status_code: null, + reason: null, + detail: null +) +``` + diff --git a/lib/clients/messaging-api/docs/TextMessage.md b/lib/clients/messaging-api/docs/TextMessage.md new file mode 100644 index 00000000..a72568bc --- /dev/null +++ b/lib/clients/messaging-api/docs/TextMessage.md @@ -0,0 +1,22 @@ +# LINE::Client::MessagingApi::TextMessage + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **text** | **String** | | [optional] | +| **emojis** | [**Array<Emoji>**](Emoji.md) | | [optional] | +| **quote_token** | **String** | Quote token of the message you want to quote. | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::TextMessage.new( + text: null, + emojis: null, + quote_token: null +) +``` + diff --git a/lib/clients/messaging-api/docs/TextMessageAllOf.md b/lib/clients/messaging-api/docs/TextMessageAllOf.md new file mode 100644 index 00000000..1ed8ffe6 --- /dev/null +++ b/lib/clients/messaging-api/docs/TextMessageAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::TextMessageAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **text** | **String** | | [optional] | +| **emojis** | [**Array<Emoji>**](Emoji.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::TextMessageAllOf.new( + text: null, + emojis: null +) +``` + diff --git a/lib/clients/messaging-api/docs/URIAction.md b/lib/clients/messaging-api/docs/URIAction.md new file mode 100644 index 00000000..17125164 --- /dev/null +++ b/lib/clients/messaging-api/docs/URIAction.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::URIAction + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **uri** | **String** | | [optional] | +| **alt_uri** | [**AltUri**](AltUri.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::URIAction.new( + uri: null, + alt_uri: null +) +``` + diff --git a/lib/clients/messaging-api/docs/URIActionAllOf.md b/lib/clients/messaging-api/docs/URIActionAllOf.md new file mode 100644 index 00000000..1ca61015 --- /dev/null +++ b/lib/clients/messaging-api/docs/URIActionAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::URIActionAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **uri** | **String** | | [optional] | +| **alt_uri** | [**AltUri**](AltUri.md) | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::URIActionAllOf.new( + uri: null, + alt_uri: null +) +``` + diff --git a/lib/clients/messaging-api/docs/URIImagemapAction.md b/lib/clients/messaging-api/docs/URIImagemapAction.md new file mode 100644 index 00000000..0f6730a4 --- /dev/null +++ b/lib/clients/messaging-api/docs/URIImagemapAction.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::URIImagemapAction + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **link_uri** | **String** | | [optional] | +| **label** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::URIImagemapAction.new( + link_uri: null, + label: null +) +``` + diff --git a/lib/clients/messaging-api/docs/URIImagemapActionAllOf.md b/lib/clients/messaging-api/docs/URIImagemapActionAllOf.md new file mode 100644 index 00000000..001cc05a --- /dev/null +++ b/lib/clients/messaging-api/docs/URIImagemapActionAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::MessagingApi::URIImagemapActionAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **link_uri** | **String** | | [optional] | +| **label** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::URIImagemapActionAllOf.new( + link_uri: null, + label: null +) +``` + diff --git a/lib/clients/messaging-api/docs/UpdateRichMenuAliasRequest.md b/lib/clients/messaging-api/docs/UpdateRichMenuAliasRequest.md new file mode 100644 index 00000000..78bdb7f0 --- /dev/null +++ b/lib/clients/messaging-api/docs/UpdateRichMenuAliasRequest.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::UpdateRichMenuAliasRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rich_menu_id** | **String** | The rich menu ID to be associated with the rich menu alias. | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::UpdateRichMenuAliasRequest.new( + rich_menu_id: null +) +``` + diff --git a/lib/clients/messaging-api/docs/UserProfileResponse.md b/lib/clients/messaging-api/docs/UserProfileResponse.md new file mode 100644 index 00000000..949ec770 --- /dev/null +++ b/lib/clients/messaging-api/docs/UserProfileResponse.md @@ -0,0 +1,26 @@ +# LINE::Client::MessagingApi::UserProfileResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **display_name** | **String** | User's display name | | +| **user_id** | **String** | User ID | | +| **picture_url** | **String** | Profile image URL. `https` image URL. Not included in the response if the user doesn't have a profile image. | [optional] | +| **status_message** | **String** | User's status message. Not included in the response if the user doesn't have a status message. | [optional] | +| **language** | **String** | User's language, as a BCP 47 language tag. Not included in the response if the user hasn't yet consented to the LINE Privacy Policy. | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::UserProfileResponse.new( + display_name: null, + user_id: null, + picture_url: null, + status_message: null, + language: en +) +``` + diff --git a/lib/clients/messaging-api/docs/ValidateMessageRequest.md b/lib/clients/messaging-api/docs/ValidateMessageRequest.md new file mode 100644 index 00000000..16aa9f62 --- /dev/null +++ b/lib/clients/messaging-api/docs/ValidateMessageRequest.md @@ -0,0 +1,18 @@ +# LINE::Client::MessagingApi::ValidateMessageRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **messages** | [**Array<Message>**](Message.md) | Array of message objects to validate | | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::ValidateMessageRequest.new( + messages: null +) +``` + diff --git a/lib/clients/messaging-api/docs/VideoMessage.md b/lib/clients/messaging-api/docs/VideoMessage.md new file mode 100644 index 00000000..4cafa96b --- /dev/null +++ b/lib/clients/messaging-api/docs/VideoMessage.md @@ -0,0 +1,22 @@ +# LINE::Client::MessagingApi::VideoMessage + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **original_content_url** | **String** | | [optional] | +| **preview_image_url** | **String** | | [optional] | +| **tracking_id** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::VideoMessage.new( + original_content_url: null, + preview_image_url: null, + tracking_id: null +) +``` + diff --git a/lib/clients/messaging-api/docs/VideoMessageAllOf.md b/lib/clients/messaging-api/docs/VideoMessageAllOf.md new file mode 100644 index 00000000..2c9ba43b --- /dev/null +++ b/lib/clients/messaging-api/docs/VideoMessageAllOf.md @@ -0,0 +1,22 @@ +# LINE::Client::MessagingApi::VideoMessageAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **original_content_url** | **String** | | [optional] | +| **preview_image_url** | **String** | | [optional] | +| **tracking_id** | **String** | | [optional] | + +## Example + +```ruby +require 'line_client_messaging_api' + +instance = LINE::Client::MessagingApi::VideoMessageAllOf.new( + original_content_url: null, + preview_image_url: null, + tracking_id: null +) +``` + diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api.rb b/lib/clients/messaging-api/lib/line_client_messaging_api.rb new file mode 100644 index 00000000..61e507d5 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api.rb @@ -0,0 +1,171 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +# Common files +require 'line_client_messaging_api/api_client' +require 'line_client_messaging_api/api_error' +require 'line_client_messaging_api/version' +require 'line_client_messaging_api/configuration' + +# Models +require 'line_client_messaging_api/models/action' +require 'line_client_messaging_api/models/age_demographic' +require 'line_client_messaging_api/models/alt_uri' +require 'line_client_messaging_api/models/app_type_demographic' +require 'line_client_messaging_api/models/area_demographic' +require 'line_client_messaging_api/models/audience_match_messages_request' +require 'line_client_messaging_api/models/bot_info_response' +require 'line_client_messaging_api/models/broadcast_request' +require 'line_client_messaging_api/models/carousel_column' +require 'line_client_messaging_api/models/chat_reference' +require 'line_client_messaging_api/models/create_rich_menu_alias_request' +require 'line_client_messaging_api/models/demographic_filter' +require 'line_client_messaging_api/models/emoji' +require 'line_client_messaging_api/models/error_detail' +require 'line_client_messaging_api/models/error_response' +require 'line_client_messaging_api/models/filter' +require 'line_client_messaging_api/models/flex_block_style' +require 'line_client_messaging_api/models/flex_box_background' +require 'line_client_messaging_api/models/flex_bubble_styles' +require 'line_client_messaging_api/models/flex_component' +require 'line_client_messaging_api/models/flex_container' +require 'line_client_messaging_api/models/gender_demographic' +require 'line_client_messaging_api/models/get_aggregation_unit_name_list_response' +require 'line_client_messaging_api/models/get_aggregation_unit_usage_response' +require 'line_client_messaging_api/models/get_followers_response' +require 'line_client_messaging_api/models/get_message_content_transcoding_response' +require 'line_client_messaging_api/models/get_webhook_endpoint_response' +require 'line_client_messaging_api/models/group_member_count_response' +require 'line_client_messaging_api/models/group_summary_response' +require 'line_client_messaging_api/models/group_user_profile_response' +require 'line_client_messaging_api/models/image_carousel_column' +require 'line_client_messaging_api/models/imagemap_action' +require 'line_client_messaging_api/models/imagemap_area' +require 'line_client_messaging_api/models/imagemap_base_size' +require 'line_client_messaging_api/models/imagemap_external_link' +require 'line_client_messaging_api/models/imagemap_video' +require 'line_client_messaging_api/models/issue_link_token_response' +require 'line_client_messaging_api/models/limit' +require 'line_client_messaging_api/models/mark_messages_as_read_request' +require 'line_client_messaging_api/models/members_ids_response' +require 'line_client_messaging_api/models/message' +require 'line_client_messaging_api/models/message_quota_response' +require 'line_client_messaging_api/models/multicast_request' +require 'line_client_messaging_api/models/narrowcast_progress_response' +require 'line_client_messaging_api/models/narrowcast_request' +require 'line_client_messaging_api/models/number_of_messages_response' +require 'line_client_messaging_api/models/pnp_messages_request' +require 'line_client_messaging_api/models/push_message_request' +require 'line_client_messaging_api/models/push_message_response' +require 'line_client_messaging_api/models/quick_reply' +require 'line_client_messaging_api/models/quick_reply_item' +require 'line_client_messaging_api/models/quota_consumption_response' +require 'line_client_messaging_api/models/quota_type' +require 'line_client_messaging_api/models/recipient' +require 'line_client_messaging_api/models/reply_message_request' +require 'line_client_messaging_api/models/reply_message_response' +require 'line_client_messaging_api/models/rich_menu_alias_list_response' +require 'line_client_messaging_api/models/rich_menu_alias_response' +require 'line_client_messaging_api/models/rich_menu_area' +require 'line_client_messaging_api/models/rich_menu_batch_operation' +require 'line_client_messaging_api/models/rich_menu_batch_progress_phase' +require 'line_client_messaging_api/models/rich_menu_batch_progress_response' +require 'line_client_messaging_api/models/rich_menu_batch_request' +require 'line_client_messaging_api/models/rich_menu_bounds' +require 'line_client_messaging_api/models/rich_menu_bulk_link_request' +require 'line_client_messaging_api/models/rich_menu_bulk_unlink_request' +require 'line_client_messaging_api/models/rich_menu_id_response' +require 'line_client_messaging_api/models/rich_menu_list_response' +require 'line_client_messaging_api/models/rich_menu_request' +require 'line_client_messaging_api/models/rich_menu_response' +require 'line_client_messaging_api/models/rich_menu_size' +require 'line_client_messaging_api/models/room_member_count_response' +require 'line_client_messaging_api/models/room_user_profile_response' +require 'line_client_messaging_api/models/sender' +require 'line_client_messaging_api/models/sent_message' +require 'line_client_messaging_api/models/set_webhook_endpoint_request' +require 'line_client_messaging_api/models/subscription_period_demographic' +require 'line_client_messaging_api/models/template' +require 'line_client_messaging_api/models/test_webhook_endpoint_request' +require 'line_client_messaging_api/models/test_webhook_endpoint_response' +require 'line_client_messaging_api/models/update_rich_menu_alias_request' +require 'line_client_messaging_api/models/user_profile_response' +require 'line_client_messaging_api/models/validate_message_request' +require 'line_client_messaging_api/models/age_demographic_filter' +require 'line_client_messaging_api/models/app_type_demographic_filter' +require 'line_client_messaging_api/models/area_demographic_filter' +require 'line_client_messaging_api/models/audience_recipient' +require 'line_client_messaging_api/models/audio_message' +require 'line_client_messaging_api/models/buttons_template' +require 'line_client_messaging_api/models/camera_action' +require 'line_client_messaging_api/models/camera_roll_action' +require 'line_client_messaging_api/models/carousel_template' +require 'line_client_messaging_api/models/confirm_template' +require 'line_client_messaging_api/models/datetime_picker_action' +require 'line_client_messaging_api/models/flex_box' +require 'line_client_messaging_api/models/flex_box_linear_gradient' +require 'line_client_messaging_api/models/flex_bubble' +require 'line_client_messaging_api/models/flex_button' +require 'line_client_messaging_api/models/flex_carousel' +require 'line_client_messaging_api/models/flex_filler' +require 'line_client_messaging_api/models/flex_icon' +require 'line_client_messaging_api/models/flex_image' +require 'line_client_messaging_api/models/flex_message' +require 'line_client_messaging_api/models/flex_separator' +require 'line_client_messaging_api/models/flex_span' +require 'line_client_messaging_api/models/flex_text' +require 'line_client_messaging_api/models/flex_video' +require 'line_client_messaging_api/models/gender_demographic_filter' +require 'line_client_messaging_api/models/image_carousel_template' +require 'line_client_messaging_api/models/image_message' +require 'line_client_messaging_api/models/imagemap_message' +require 'line_client_messaging_api/models/location_action' +require 'line_client_messaging_api/models/location_message' +require 'line_client_messaging_api/models/message_action' +require 'line_client_messaging_api/models/message_imagemap_action' +require 'line_client_messaging_api/models/operator_demographic_filter' +require 'line_client_messaging_api/models/operator_recipient' +require 'line_client_messaging_api/models/postback_action' +require 'line_client_messaging_api/models/redelivery_recipient' +require 'line_client_messaging_api/models/rich_menu_batch_link_operation' +require 'line_client_messaging_api/models/rich_menu_batch_unlink_all_operation' +require 'line_client_messaging_api/models/rich_menu_batch_unlink_operation' +require 'line_client_messaging_api/models/rich_menu_switch_action' +require 'line_client_messaging_api/models/sticker_message' +require 'line_client_messaging_api/models/subscription_period_demographic_filter' +require 'line_client_messaging_api/models/template_message' +require 'line_client_messaging_api/models/text_message' +require 'line_client_messaging_api/models/uri_action' +require 'line_client_messaging_api/models/uri_imagemap_action' +require 'line_client_messaging_api/models/video_message' + +# APIs +require 'line_client_messaging_api/api/messaging_api_api' +require 'line_client_messaging_api/api/messaging_api_blob_api' + +module LINE::Client::MessagingApi + class << self + # Customize default settings for the SDK using block. + # LINE::Client::MessagingApi.configure do |config| + # config.username = "xxx" + # config.password = "xxx" + # end + # If no block given, return the default Configuration object. + def configure + if block_given? + yield(Configuration.default) + else + Configuration.default + end + end + end +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/api/messaging_api_api.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/api/messaging_api_api.rb new file mode 100644 index 00000000..1b019339 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/api/messaging_api_api.rb @@ -0,0 +1,3832 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'cgi' + +module LINE::Client::MessagingApi + class MessagingApiApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Send a message using phone number + # @param audience_match_messages_request [AudienceMatchMessagesRequest] + # @param [Hash] opts the optional parameters + # @return [nil] + def audience_match(audience_match_messages_request, opts = {}) + audience_match_with_http_info(audience_match_messages_request, opts) + nil + end + + # Send a message using phone number + # @param audience_match_messages_request [AudienceMatchMessagesRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def audience_match_with_http_info(audience_match_messages_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.audience_match ...' + end + # verify the required parameter 'audience_match_messages_request' is set + if @api_client.config.client_side_validation && audience_match_messages_request.nil? + fail ArgumentError, "Missing the required parameter 'audience_match_messages_request' when calling MessagingApiApi.audience_match" + end + # resource path + local_var_path = '/bot/ad/multicast/phone' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(audience_match_messages_request) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.audience_match", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#audience_match\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Sends a message to multiple users at any time. + # @param broadcast_request [BroadcastRequest] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_line_retry_key Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. + # @return [Object] + def broadcast(broadcast_request, opts = {}) + data, _status_code, _headers = broadcast_with_http_info(broadcast_request, opts) + data + end + + # Sends a message to multiple users at any time. + # @param broadcast_request [BroadcastRequest] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_line_retry_key Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. + # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers + def broadcast_with_http_info(broadcast_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.broadcast ...' + end + # verify the required parameter 'broadcast_request' is set + if @api_client.config.client_side_validation && broadcast_request.nil? + fail ArgumentError, "Missing the required parameter 'broadcast_request' when calling MessagingApiApi.broadcast" + end + # resource path + local_var_path = '/v2/bot/message/broadcast' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'X-Line-Retry-Key'] = opts[:'x_line_retry_key'] if !opts[:'x_line_retry_key'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(broadcast_request) + + # return_type + return_type = opts[:debug_return_type] || 'Object' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.broadcast", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#broadcast\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Cancel default rich menu + # @param [Hash] opts the optional parameters + # @return [nil] + def cancel_default_rich_menu(opts = {}) + cancel_default_rich_menu_with_http_info(opts) + nil + end + + # Cancel default rich menu + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def cancel_default_rich_menu_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.cancel_default_rich_menu ...' + end + # resource path + local_var_path = '/v2/bot/user/all/richmenu' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.cancel_default_rich_menu", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#cancel_default_rich_menu\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create rich menu + # @param rich_menu_request [RichMenuRequest] + # @param [Hash] opts the optional parameters + # @return [RichMenuIdResponse] + def create_rich_menu(rich_menu_request, opts = {}) + data, _status_code, _headers = create_rich_menu_with_http_info(rich_menu_request, opts) + data + end + + # Create rich menu + # @param rich_menu_request [RichMenuRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(RichMenuIdResponse, Integer, Hash)>] RichMenuIdResponse data, response status code and response headers + def create_rich_menu_with_http_info(rich_menu_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.create_rich_menu ...' + end + # verify the required parameter 'rich_menu_request' is set + if @api_client.config.client_side_validation && rich_menu_request.nil? + fail ArgumentError, "Missing the required parameter 'rich_menu_request' when calling MessagingApiApi.create_rich_menu" + end + # resource path + local_var_path = '/v2/bot/richmenu' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(rich_menu_request) + + # return_type + return_type = opts[:debug_return_type] || 'RichMenuIdResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.create_rich_menu", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#create_rich_menu\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create rich menu alias + # @param create_rich_menu_alias_request [CreateRichMenuAliasRequest] + # @param [Hash] opts the optional parameters + # @return [nil] + def create_rich_menu_alias(create_rich_menu_alias_request, opts = {}) + create_rich_menu_alias_with_http_info(create_rich_menu_alias_request, opts) + nil + end + + # Create rich menu alias + # @param create_rich_menu_alias_request [CreateRichMenuAliasRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def create_rich_menu_alias_with_http_info(create_rich_menu_alias_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.create_rich_menu_alias ...' + end + # verify the required parameter 'create_rich_menu_alias_request' is set + if @api_client.config.client_side_validation && create_rich_menu_alias_request.nil? + fail ArgumentError, "Missing the required parameter 'create_rich_menu_alias_request' when calling MessagingApiApi.create_rich_menu_alias" + end + # resource path + local_var_path = '/v2/bot/richmenu/alias' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(create_rich_menu_alias_request) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.create_rich_menu_alias", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#create_rich_menu_alias\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Deletes a rich menu. + # @param rich_menu_id [String] ID of a rich menu + # @param [Hash] opts the optional parameters + # @return [nil] + def delete_rich_menu(rich_menu_id, opts = {}) + delete_rich_menu_with_http_info(rich_menu_id, opts) + nil + end + + # Deletes a rich menu. + # @param rich_menu_id [String] ID of a rich menu + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_rich_menu_with_http_info(rich_menu_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.delete_rich_menu ...' + end + # verify the required parameter 'rich_menu_id' is set + if @api_client.config.client_side_validation && rich_menu_id.nil? + fail ArgumentError, "Missing the required parameter 'rich_menu_id' when calling MessagingApiApi.delete_rich_menu" + end + # resource path + local_var_path = '/v2/bot/richmenu/{richMenuId}'.sub('{' + 'richMenuId' + '}', CGI.escape(rich_menu_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.delete_rich_menu", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#delete_rich_menu\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete rich menu alias + # @param rich_menu_alias_id [String] Rich menu alias ID that you want to delete. + # @param [Hash] opts the optional parameters + # @return [nil] + def delete_rich_menu_alias(rich_menu_alias_id, opts = {}) + delete_rich_menu_alias_with_http_info(rich_menu_alias_id, opts) + nil + end + + # Delete rich menu alias + # @param rich_menu_alias_id [String] Rich menu alias ID that you want to delete. + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_rich_menu_alias_with_http_info(rich_menu_alias_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.delete_rich_menu_alias ...' + end + # verify the required parameter 'rich_menu_alias_id' is set + if @api_client.config.client_side_validation && rich_menu_alias_id.nil? + fail ArgumentError, "Missing the required parameter 'rich_menu_alias_id' when calling MessagingApiApi.delete_rich_menu_alias" + end + # resource path + local_var_path = '/v2/bot/richmenu/alias/{richMenuAliasId}'.sub('{' + 'richMenuAliasId' + '}', CGI.escape(rich_menu_alias_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.delete_rich_menu_alias", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#delete_rich_menu_alias\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get result of message delivery using phone number + # @param date [String] Date the message was sent Format: `yyyyMMdd` (e.g. `20190831`) Time Zone: UTC+9 + # @param [Hash] opts the optional parameters + # @return [NumberOfMessagesResponse] + def get_ad_phone_message_statistics(date, opts = {}) + data, _status_code, _headers = get_ad_phone_message_statistics_with_http_info(date, opts) + data + end + + # Get result of message delivery using phone number + # @param date [String] Date the message was sent Format: `yyyyMMdd` (e.g. `20190831`) Time Zone: UTC+9 + # @param [Hash] opts the optional parameters + # @return [Array<(NumberOfMessagesResponse, Integer, Hash)>] NumberOfMessagesResponse data, response status code and response headers + def get_ad_phone_message_statistics_with_http_info(date, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_ad_phone_message_statistics ...' + end + # verify the required parameter 'date' is set + if @api_client.config.client_side_validation && date.nil? + fail ArgumentError, "Missing the required parameter 'date' when calling MessagingApiApi.get_ad_phone_message_statistics" + end + # resource path + local_var_path = '/v2/bot/message/delivery/ad_phone' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'date'] = date + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'NumberOfMessagesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_ad_phone_message_statistics", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_ad_phone_message_statistics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get name list of units used this month + # @param [Hash] opts the optional parameters + # @option opts [String] :limit The maximum number of aggregation units you can get per request. + # @option opts [String] :start Value of the continuation token found in the next property of the JSON object returned in the response. If you can't get all the aggregation units in one request, include this parameter to get the remaining array. + # @return [GetAggregationUnitNameListResponse] + def get_aggregation_unit_name_list(opts = {}) + data, _status_code, _headers = get_aggregation_unit_name_list_with_http_info(opts) + data + end + + # Get name list of units used this month + # @param [Hash] opts the optional parameters + # @option opts [String] :limit The maximum number of aggregation units you can get per request. + # @option opts [String] :start Value of the continuation token found in the next property of the JSON object returned in the response. If you can't get all the aggregation units in one request, include this parameter to get the remaining array. + # @return [Array<(GetAggregationUnitNameListResponse, Integer, Hash)>] GetAggregationUnitNameListResponse data, response status code and response headers + def get_aggregation_unit_name_list_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_aggregation_unit_name_list ...' + end + # resource path + local_var_path = '/v2/bot/message/aggregation/list' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetAggregationUnitNameListResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_aggregation_unit_name_list", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_aggregation_unit_name_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get number of units used this month + # @param [Hash] opts the optional parameters + # @return [GetAggregationUnitUsageResponse] + def get_aggregation_unit_usage(opts = {}) + data, _status_code, _headers = get_aggregation_unit_usage_with_http_info(opts) + data + end + + # Get number of units used this month + # @param [Hash] opts the optional parameters + # @return [Array<(GetAggregationUnitUsageResponse, Integer, Hash)>] GetAggregationUnitUsageResponse data, response status code and response headers + def get_aggregation_unit_usage_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_aggregation_unit_usage ...' + end + # resource path + local_var_path = '/v2/bot/message/aggregation/info' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetAggregationUnitUsageResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_aggregation_unit_usage", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_aggregation_unit_usage\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get bot info + # @param [Hash] opts the optional parameters + # @return [BotInfoResponse] + def get_bot_info(opts = {}) + data, _status_code, _headers = get_bot_info_with_http_info(opts) + data + end + + # Get bot info + # @param [Hash] opts the optional parameters + # @return [Array<(BotInfoResponse, Integer, Hash)>] BotInfoResponse data, response status code and response headers + def get_bot_info_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_bot_info ...' + end + # resource path + local_var_path = '/v2/bot/info' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'BotInfoResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_bot_info", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_bot_info\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Gets the ID of the default rich menu set with the Messaging API. + # @param [Hash] opts the optional parameters + # @return [RichMenuIdResponse] + def get_default_rich_menu_id(opts = {}) + data, _status_code, _headers = get_default_rich_menu_id_with_http_info(opts) + data + end + + # Gets the ID of the default rich menu set with the Messaging API. + # @param [Hash] opts the optional parameters + # @return [Array<(RichMenuIdResponse, Integer, Hash)>] RichMenuIdResponse data, response status code and response headers + def get_default_rich_menu_id_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_default_rich_menu_id ...' + end + # resource path + local_var_path = '/v2/bot/user/all/richmenu' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'RichMenuIdResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_default_rich_menu_id", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_default_rich_menu_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get a list of users who added your LINE Official Account as a friend + # @param [Hash] opts the optional parameters + # @option opts [String] :start Value of the continuation token found in the next property of the JSON object returned in the response. Include this parameter to get the next array of user IDs. + # @option opts [Integer] :limit The maximum number of user IDs to retrieve in a single request. (default to 300) + # @return [GetFollowersResponse] + def get_followers(opts = {}) + data, _status_code, _headers = get_followers_with_http_info(opts) + data + end + + # Get a list of users who added your LINE Official Account as a friend + # @param [Hash] opts the optional parameters + # @option opts [String] :start Value of the continuation token found in the next property of the JSON object returned in the response. Include this parameter to get the next array of user IDs. + # @option opts [Integer] :limit The maximum number of user IDs to retrieve in a single request. (default to 300) + # @return [Array<(GetFollowersResponse, Integer, Hash)>] GetFollowersResponse data, response status code and response headers + def get_followers_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_followers ...' + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling MessagingApiApi.get_followers, must be smaller than or equal to 1000.' + end + + # resource path + local_var_path = '/v2/bot/followers/ids' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil? + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetFollowersResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_followers", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_followers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get number of users in a group chat + # @param group_id [String] Group ID + # @param [Hash] opts the optional parameters + # @return [GroupMemberCountResponse] + def get_group_member_count(group_id, opts = {}) + data, _status_code, _headers = get_group_member_count_with_http_info(group_id, opts) + data + end + + # Get number of users in a group chat + # @param group_id [String] Group ID + # @param [Hash] opts the optional parameters + # @return [Array<(GroupMemberCountResponse, Integer, Hash)>] GroupMemberCountResponse data, response status code and response headers + def get_group_member_count_with_http_info(group_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_group_member_count ...' + end + # verify the required parameter 'group_id' is set + if @api_client.config.client_side_validation && group_id.nil? + fail ArgumentError, "Missing the required parameter 'group_id' when calling MessagingApiApi.get_group_member_count" + end + # resource path + local_var_path = '/v2/bot/group/{groupId}/members/count'.sub('{' + 'groupId' + '}', CGI.escape(group_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GroupMemberCountResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_group_member_count", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_group_member_count\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get group chat member profile + # @param group_id [String] Group ID + # @param user_id [String] User ID + # @param [Hash] opts the optional parameters + # @return [GroupUserProfileResponse] + def get_group_member_profile(group_id, user_id, opts = {}) + data, _status_code, _headers = get_group_member_profile_with_http_info(group_id, user_id, opts) + data + end + + # Get group chat member profile + # @param group_id [String] Group ID + # @param user_id [String] User ID + # @param [Hash] opts the optional parameters + # @return [Array<(GroupUserProfileResponse, Integer, Hash)>] GroupUserProfileResponse data, response status code and response headers + def get_group_member_profile_with_http_info(group_id, user_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_group_member_profile ...' + end + # verify the required parameter 'group_id' is set + if @api_client.config.client_side_validation && group_id.nil? + fail ArgumentError, "Missing the required parameter 'group_id' when calling MessagingApiApi.get_group_member_profile" + end + # verify the required parameter 'user_id' is set + if @api_client.config.client_side_validation && user_id.nil? + fail ArgumentError, "Missing the required parameter 'user_id' when calling MessagingApiApi.get_group_member_profile" + end + # resource path + local_var_path = '/v2/bot/group/{groupId}/member/{userId}'.sub('{' + 'groupId' + '}', CGI.escape(group_id.to_s)).sub('{' + 'userId' + '}', CGI.escape(user_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GroupUserProfileResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_group_member_profile", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_group_member_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get group chat member user IDs + # @param group_id [String] Group ID + # @param [Hash] opts the optional parameters + # @option opts [String] :start Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group. + # @return [MembersIdsResponse] + def get_group_members_ids(group_id, opts = {}) + data, _status_code, _headers = get_group_members_ids_with_http_info(group_id, opts) + data + end + + # Get group chat member user IDs + # @param group_id [String] Group ID + # @param [Hash] opts the optional parameters + # @option opts [String] :start Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group. + # @return [Array<(MembersIdsResponse, Integer, Hash)>] MembersIdsResponse data, response status code and response headers + def get_group_members_ids_with_http_info(group_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_group_members_ids ...' + end + # verify the required parameter 'group_id' is set + if @api_client.config.client_side_validation && group_id.nil? + fail ArgumentError, "Missing the required parameter 'group_id' when calling MessagingApiApi.get_group_members_ids" + end + # resource path + local_var_path = '/v2/bot/group/{groupId}/members/ids'.sub('{' + 'groupId' + '}', CGI.escape(group_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'MembersIdsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_group_members_ids", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_group_members_ids\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get group chat summary + # @param group_id [String] Group ID + # @param [Hash] opts the optional parameters + # @return [GroupSummaryResponse] + def get_group_summary(group_id, opts = {}) + data, _status_code, _headers = get_group_summary_with_http_info(group_id, opts) + data + end + + # Get group chat summary + # @param group_id [String] Group ID + # @param [Hash] opts the optional parameters + # @return [Array<(GroupSummaryResponse, Integer, Hash)>] GroupSummaryResponse data, response status code and response headers + def get_group_summary_with_http_info(group_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_group_summary ...' + end + # verify the required parameter 'group_id' is set + if @api_client.config.client_side_validation && group_id.nil? + fail ArgumentError, "Missing the required parameter 'group_id' when calling MessagingApiApi.get_group_summary" + end + # resource path + local_var_path = '/v2/bot/group/{groupId}/summary'.sub('{' + 'groupId' + '}', CGI.escape(group_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GroupSummaryResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_group_summary", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_group_summary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Gets the target limit for sending messages in the current month. The total number of the free messages and the additional messages is returned. + # @param [Hash] opts the optional parameters + # @return [MessageQuotaResponse] + def get_message_quota(opts = {}) + data, _status_code, _headers = get_message_quota_with_http_info(opts) + data + end + + # Gets the target limit for sending messages in the current month. The total number of the free messages and the additional messages is returned. + # @param [Hash] opts the optional parameters + # @return [Array<(MessageQuotaResponse, Integer, Hash)>] MessageQuotaResponse data, response status code and response headers + def get_message_quota_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_message_quota ...' + end + # resource path + local_var_path = '/v2/bot/message/quota' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'MessageQuotaResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_message_quota", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_message_quota\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Gets the number of messages sent in the current month. + # @param [Hash] opts the optional parameters + # @return [QuotaConsumptionResponse] + def get_message_quota_consumption(opts = {}) + data, _status_code, _headers = get_message_quota_consumption_with_http_info(opts) + data + end + + # Gets the number of messages sent in the current month. + # @param [Hash] opts the optional parameters + # @return [Array<(QuotaConsumptionResponse, Integer, Hash)>] QuotaConsumptionResponse data, response status code and response headers + def get_message_quota_consumption_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_message_quota_consumption ...' + end + # resource path + local_var_path = '/v2/bot/message/quota/consumption' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'QuotaConsumptionResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_message_quota_consumption", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_message_quota_consumption\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Gets the status of a narrowcast message. + # @param request_id [String] The narrowcast message's request ID. Each Messaging API request has a request ID. + # @param [Hash] opts the optional parameters + # @return [NarrowcastProgressResponse] + def get_narrowcast_progress(request_id, opts = {}) + data, _status_code, _headers = get_narrowcast_progress_with_http_info(request_id, opts) + data + end + + # Gets the status of a narrowcast message. + # @param request_id [String] The narrowcast message's request ID. Each Messaging API request has a request ID. + # @param [Hash] opts the optional parameters + # @return [Array<(NarrowcastProgressResponse, Integer, Hash)>] NarrowcastProgressResponse data, response status code and response headers + def get_narrowcast_progress_with_http_info(request_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_narrowcast_progress ...' + end + # verify the required parameter 'request_id' is set + if @api_client.config.client_side_validation && request_id.nil? + fail ArgumentError, "Missing the required parameter 'request_id' when calling MessagingApiApi.get_narrowcast_progress" + end + # resource path + local_var_path = '/v2/bot/message/progress/narrowcast' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'requestId'] = request_id + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'NarrowcastProgressResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_narrowcast_progress", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_narrowcast_progress\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get number of sent broadcast messages + # @param date [String] Date the messages were sent Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9 + # @param [Hash] opts the optional parameters + # @return [NumberOfMessagesResponse] + def get_number_of_sent_broadcast_messages(date, opts = {}) + data, _status_code, _headers = get_number_of_sent_broadcast_messages_with_http_info(date, opts) + data + end + + # Get number of sent broadcast messages + # @param date [String] Date the messages were sent Format: yyyyMMdd (e.g. 20191231) Timezone: UTC+9 + # @param [Hash] opts the optional parameters + # @return [Array<(NumberOfMessagesResponse, Integer, Hash)>] NumberOfMessagesResponse data, response status code and response headers + def get_number_of_sent_broadcast_messages_with_http_info(date, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_number_of_sent_broadcast_messages ...' + end + # verify the required parameter 'date' is set + if @api_client.config.client_side_validation && date.nil? + fail ArgumentError, "Missing the required parameter 'date' when calling MessagingApiApi.get_number_of_sent_broadcast_messages" + end + # resource path + local_var_path = '/v2/bot/message/delivery/broadcast' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'date'] = date + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'NumberOfMessagesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_number_of_sent_broadcast_messages", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_number_of_sent_broadcast_messages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get number of sent multicast messages + # @param date [String] Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 + # @param [Hash] opts the optional parameters + # @return [NumberOfMessagesResponse] + def get_number_of_sent_multicast_messages(date, opts = {}) + data, _status_code, _headers = get_number_of_sent_multicast_messages_with_http_info(date, opts) + data + end + + # Get number of sent multicast messages + # @param date [String] Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 + # @param [Hash] opts the optional parameters + # @return [Array<(NumberOfMessagesResponse, Integer, Hash)>] NumberOfMessagesResponse data, response status code and response headers + def get_number_of_sent_multicast_messages_with_http_info(date, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_number_of_sent_multicast_messages ...' + end + # verify the required parameter 'date' is set + if @api_client.config.client_side_validation && date.nil? + fail ArgumentError, "Missing the required parameter 'date' when calling MessagingApiApi.get_number_of_sent_multicast_messages" + end + # resource path + local_var_path = '/v2/bot/message/delivery/multicast' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'date'] = date + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'NumberOfMessagesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_number_of_sent_multicast_messages", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_number_of_sent_multicast_messages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get number of sent push messages + # @param date [String] Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 + # @param [Hash] opts the optional parameters + # @return [NumberOfMessagesResponse] + def get_number_of_sent_push_messages(date, opts = {}) + data, _status_code, _headers = get_number_of_sent_push_messages_with_http_info(date, opts) + data + end + + # Get number of sent push messages + # @param date [String] Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 + # @param [Hash] opts the optional parameters + # @return [Array<(NumberOfMessagesResponse, Integer, Hash)>] NumberOfMessagesResponse data, response status code and response headers + def get_number_of_sent_push_messages_with_http_info(date, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_number_of_sent_push_messages ...' + end + # verify the required parameter 'date' is set + if @api_client.config.client_side_validation && date.nil? + fail ArgumentError, "Missing the required parameter 'date' when calling MessagingApiApi.get_number_of_sent_push_messages" + end + # resource path + local_var_path = '/v2/bot/message/delivery/push' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'date'] = date + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'NumberOfMessagesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_number_of_sent_push_messages", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_number_of_sent_push_messages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get number of sent reply messages + # @param date [String] Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 + # @param [Hash] opts the optional parameters + # @return [NumberOfMessagesResponse] + def get_number_of_sent_reply_messages(date, opts = {}) + data, _status_code, _headers = get_number_of_sent_reply_messages_with_http_info(date, opts) + data + end + + # Get number of sent reply messages + # @param date [String] Date the messages were sent Format: `yyyyMMdd` (e.g. `20191231`) Timezone: UTC+9 + # @param [Hash] opts the optional parameters + # @return [Array<(NumberOfMessagesResponse, Integer, Hash)>] NumberOfMessagesResponse data, response status code and response headers + def get_number_of_sent_reply_messages_with_http_info(date, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_number_of_sent_reply_messages ...' + end + # verify the required parameter 'date' is set + if @api_client.config.client_side_validation && date.nil? + fail ArgumentError, "Missing the required parameter 'date' when calling MessagingApiApi.get_number_of_sent_reply_messages" + end + # resource path + local_var_path = '/v2/bot/message/delivery/reply' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'date'] = date + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'NumberOfMessagesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_number_of_sent_reply_messages", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_number_of_sent_reply_messages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get number of sent LINE notification messages  + # @param date [String] Date the message was sent Format: `yyyyMMdd` (Example:`20211231`) Time zone: UTC+9 + # @param [Hash] opts the optional parameters + # @return [NumberOfMessagesResponse] + def get_pnp_message_statistics(date, opts = {}) + data, _status_code, _headers = get_pnp_message_statistics_with_http_info(date, opts) + data + end + + # Get number of sent LINE notification messages  + # @param date [String] Date the message was sent Format: `yyyyMMdd` (Example:`20211231`) Time zone: UTC+9 + # @param [Hash] opts the optional parameters + # @return [Array<(NumberOfMessagesResponse, Integer, Hash)>] NumberOfMessagesResponse data, response status code and response headers + def get_pnp_message_statistics_with_http_info(date, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_pnp_message_statistics ...' + end + # verify the required parameter 'date' is set + if @api_client.config.client_side_validation && date.nil? + fail ArgumentError, "Missing the required parameter 'date' when calling MessagingApiApi.get_pnp_message_statistics" + end + pattern = Regexp.new(/^[0-9]{8}$/) + if @api_client.config.client_side_validation && date !~ pattern + fail ArgumentError, "invalid value for 'date' when calling MessagingApiApi.get_pnp_message_statistics, must conform to the pattern #{pattern}." + end + + # resource path + local_var_path = '/v2/bot/message/delivery/pnp' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'date'] = date + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'NumberOfMessagesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_pnp_message_statistics", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_pnp_message_statistics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get profile + # @param user_id [String] User ID + # @param [Hash] opts the optional parameters + # @return [UserProfileResponse] + def get_profile(user_id, opts = {}) + data, _status_code, _headers = get_profile_with_http_info(user_id, opts) + data + end + + # Get profile + # @param user_id [String] User ID + # @param [Hash] opts the optional parameters + # @return [Array<(UserProfileResponse, Integer, Hash)>] UserProfileResponse data, response status code and response headers + def get_profile_with_http_info(user_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_profile ...' + end + # verify the required parameter 'user_id' is set + if @api_client.config.client_side_validation && user_id.nil? + fail ArgumentError, "Missing the required parameter 'user_id' when calling MessagingApiApi.get_profile" + end + # resource path + local_var_path = '/v2/bot/profile/{userId}'.sub('{' + 'userId' + '}', CGI.escape(user_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'UserProfileResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_profile", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Gets a rich menu via a rich menu ID. + # @param rich_menu_id [String] ID of a rich menu + # @param [Hash] opts the optional parameters + # @return [RichMenuResponse] + def get_rich_menu(rich_menu_id, opts = {}) + data, _status_code, _headers = get_rich_menu_with_http_info(rich_menu_id, opts) + data + end + + # Gets a rich menu via a rich menu ID. + # @param rich_menu_id [String] ID of a rich menu + # @param [Hash] opts the optional parameters + # @return [Array<(RichMenuResponse, Integer, Hash)>] RichMenuResponse data, response status code and response headers + def get_rich_menu_with_http_info(rich_menu_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_rich_menu ...' + end + # verify the required parameter 'rich_menu_id' is set + if @api_client.config.client_side_validation && rich_menu_id.nil? + fail ArgumentError, "Missing the required parameter 'rich_menu_id' when calling MessagingApiApi.get_rich_menu" + end + # resource path + local_var_path = '/v2/bot/richmenu/{richMenuId}'.sub('{' + 'richMenuId' + '}', CGI.escape(rich_menu_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'RichMenuResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_rich_menu", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_rich_menu\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get rich menu alias information + # @param rich_menu_alias_id [String] The rich menu alias ID whose information you want to obtain. + # @param [Hash] opts the optional parameters + # @return [RichMenuAliasResponse] + def get_rich_menu_alias(rich_menu_alias_id, opts = {}) + data, _status_code, _headers = get_rich_menu_alias_with_http_info(rich_menu_alias_id, opts) + data + end + + # Get rich menu alias information + # @param rich_menu_alias_id [String] The rich menu alias ID whose information you want to obtain. + # @param [Hash] opts the optional parameters + # @return [Array<(RichMenuAliasResponse, Integer, Hash)>] RichMenuAliasResponse data, response status code and response headers + def get_rich_menu_alias_with_http_info(rich_menu_alias_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_rich_menu_alias ...' + end + # verify the required parameter 'rich_menu_alias_id' is set + if @api_client.config.client_side_validation && rich_menu_alias_id.nil? + fail ArgumentError, "Missing the required parameter 'rich_menu_alias_id' when calling MessagingApiApi.get_rich_menu_alias" + end + # resource path + local_var_path = '/v2/bot/richmenu/alias/{richMenuAliasId}'.sub('{' + 'richMenuAliasId' + '}', CGI.escape(rich_menu_alias_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'RichMenuAliasResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_rich_menu_alias", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_rich_menu_alias\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get list of rich menu alias + # @param [Hash] opts the optional parameters + # @return [RichMenuAliasListResponse] + def get_rich_menu_alias_list(opts = {}) + data, _status_code, _headers = get_rich_menu_alias_list_with_http_info(opts) + data + end + + # Get list of rich menu alias + # @param [Hash] opts the optional parameters + # @return [Array<(RichMenuAliasListResponse, Integer, Hash)>] RichMenuAliasListResponse data, response status code and response headers + def get_rich_menu_alias_list_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_rich_menu_alias_list ...' + end + # resource path + local_var_path = '/v2/bot/richmenu/alias/list' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'RichMenuAliasListResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_rich_menu_alias_list", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_rich_menu_alias_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get the status of Replace or unlink a linked rich menus in batches. + # @param request_id [String] A request ID used to batch control the rich menu linked to the user. Each Messaging API request has a request ID. + # @param [Hash] opts the optional parameters + # @return [RichMenuBatchProgressResponse] + def get_rich_menu_batch_progress(request_id, opts = {}) + data, _status_code, _headers = get_rich_menu_batch_progress_with_http_info(request_id, opts) + data + end + + # Get the status of Replace or unlink a linked rich menus in batches. + # @param request_id [String] A request ID used to batch control the rich menu linked to the user. Each Messaging API request has a request ID. + # @param [Hash] opts the optional parameters + # @return [Array<(RichMenuBatchProgressResponse, Integer, Hash)>] RichMenuBatchProgressResponse data, response status code and response headers + def get_rich_menu_batch_progress_with_http_info(request_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_rich_menu_batch_progress ...' + end + # verify the required parameter 'request_id' is set + if @api_client.config.client_side_validation && request_id.nil? + fail ArgumentError, "Missing the required parameter 'request_id' when calling MessagingApiApi.get_rich_menu_batch_progress" + end + # resource path + local_var_path = '/v2/bot/richmenu/progress/batch' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'requestId'] = request_id + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'RichMenuBatchProgressResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_rich_menu_batch_progress", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_rich_menu_batch_progress\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get rich menu ID of user + # @param user_id [String] User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. + # @param [Hash] opts the optional parameters + # @return [RichMenuIdResponse] + def get_rich_menu_id_of_user(user_id, opts = {}) + data, _status_code, _headers = get_rich_menu_id_of_user_with_http_info(user_id, opts) + data + end + + # Get rich menu ID of user + # @param user_id [String] User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. + # @param [Hash] opts the optional parameters + # @return [Array<(RichMenuIdResponse, Integer, Hash)>] RichMenuIdResponse data, response status code and response headers + def get_rich_menu_id_of_user_with_http_info(user_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_rich_menu_id_of_user ...' + end + # verify the required parameter 'user_id' is set + if @api_client.config.client_side_validation && user_id.nil? + fail ArgumentError, "Missing the required parameter 'user_id' when calling MessagingApiApi.get_rich_menu_id_of_user" + end + # resource path + local_var_path = '/v2/bot/user/{userId}/richmenu'.sub('{' + 'userId' + '}', CGI.escape(user_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'RichMenuIdResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_rich_menu_id_of_user", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_rich_menu_id_of_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get rich menu list + # @param [Hash] opts the optional parameters + # @return [RichMenuListResponse] + def get_rich_menu_list(opts = {}) + data, _status_code, _headers = get_rich_menu_list_with_http_info(opts) + data + end + + # Get rich menu list + # @param [Hash] opts the optional parameters + # @return [Array<(RichMenuListResponse, Integer, Hash)>] RichMenuListResponse data, response status code and response headers + def get_rich_menu_list_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_rich_menu_list ...' + end + # resource path + local_var_path = '/v2/bot/richmenu/list' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'RichMenuListResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_rich_menu_list", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_rich_menu_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get number of users in a multi-person chat + # @param room_id [String] Room ID + # @param [Hash] opts the optional parameters + # @return [RoomMemberCountResponse] + def get_room_member_count(room_id, opts = {}) + data, _status_code, _headers = get_room_member_count_with_http_info(room_id, opts) + data + end + + # Get number of users in a multi-person chat + # @param room_id [String] Room ID + # @param [Hash] opts the optional parameters + # @return [Array<(RoomMemberCountResponse, Integer, Hash)>] RoomMemberCountResponse data, response status code and response headers + def get_room_member_count_with_http_info(room_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_room_member_count ...' + end + # verify the required parameter 'room_id' is set + if @api_client.config.client_side_validation && room_id.nil? + fail ArgumentError, "Missing the required parameter 'room_id' when calling MessagingApiApi.get_room_member_count" + end + # resource path + local_var_path = '/v2/bot/room/{roomId}/members/count'.sub('{' + 'roomId' + '}', CGI.escape(room_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'RoomMemberCountResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_room_member_count", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_room_member_count\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get multi-person chat member profile + # @param room_id [String] Room ID + # @param user_id [String] User ID + # @param [Hash] opts the optional parameters + # @return [RoomUserProfileResponse] + def get_room_member_profile(room_id, user_id, opts = {}) + data, _status_code, _headers = get_room_member_profile_with_http_info(room_id, user_id, opts) + data + end + + # Get multi-person chat member profile + # @param room_id [String] Room ID + # @param user_id [String] User ID + # @param [Hash] opts the optional parameters + # @return [Array<(RoomUserProfileResponse, Integer, Hash)>] RoomUserProfileResponse data, response status code and response headers + def get_room_member_profile_with_http_info(room_id, user_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_room_member_profile ...' + end + # verify the required parameter 'room_id' is set + if @api_client.config.client_side_validation && room_id.nil? + fail ArgumentError, "Missing the required parameter 'room_id' when calling MessagingApiApi.get_room_member_profile" + end + # verify the required parameter 'user_id' is set + if @api_client.config.client_side_validation && user_id.nil? + fail ArgumentError, "Missing the required parameter 'user_id' when calling MessagingApiApi.get_room_member_profile" + end + # resource path + local_var_path = '/v2/bot/room/{roomId}/member/{userId}'.sub('{' + 'roomId' + '}', CGI.escape(room_id.to_s)).sub('{' + 'userId' + '}', CGI.escape(user_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'RoomUserProfileResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_room_member_profile", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_room_member_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get multi-person chat member user IDs + # @param room_id [String] Room ID + # @param [Hash] opts the optional parameters + # @option opts [String] :start Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group. + # @return [MembersIdsResponse] + def get_room_members_ids(room_id, opts = {}) + data, _status_code, _headers = get_room_members_ids_with_http_info(room_id, opts) + data + end + + # Get multi-person chat member user IDs + # @param room_id [String] Room ID + # @param [Hash] opts the optional parameters + # @option opts [String] :start Value of the continuation token found in the `next` property of the JSON object returned in the response. Include this parameter to get the next array of user IDs for the members of the group. + # @return [Array<(MembersIdsResponse, Integer, Hash)>] MembersIdsResponse data, response status code and response headers + def get_room_members_ids_with_http_info(room_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_room_members_ids ...' + end + # verify the required parameter 'room_id' is set + if @api_client.config.client_side_validation && room_id.nil? + fail ArgumentError, "Missing the required parameter 'room_id' when calling MessagingApiApi.get_room_members_ids" + end + # resource path + local_var_path = '/v2/bot/room/{roomId}/members/ids'.sub('{' + 'roomId' + '}', CGI.escape(room_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'MembersIdsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_room_members_ids", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_room_members_ids\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get webhook endpoint information + # @param [Hash] opts the optional parameters + # @return [GetWebhookEndpointResponse] + def get_webhook_endpoint(opts = {}) + data, _status_code, _headers = get_webhook_endpoint_with_http_info(opts) + data + end + + # Get webhook endpoint information + # @param [Hash] opts the optional parameters + # @return [Array<(GetWebhookEndpointResponse, Integer, Hash)>] GetWebhookEndpointResponse data, response status code and response headers + def get_webhook_endpoint_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.get_webhook_endpoint ...' + end + # resource path + local_var_path = '/v2/bot/channel/webhook/endpoint' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetWebhookEndpointResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.get_webhook_endpoint", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#get_webhook_endpoint\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Issue link token + # @param user_id [String] User ID for the LINE account to be linked. Found in the `source` object of account link event objects. Do not use the LINE ID used in LINE. + # @param [Hash] opts the optional parameters + # @return [IssueLinkTokenResponse] + def issue_link_token(user_id, opts = {}) + data, _status_code, _headers = issue_link_token_with_http_info(user_id, opts) + data + end + + # Issue link token + # @param user_id [String] User ID for the LINE account to be linked. Found in the `source` object of account link event objects. Do not use the LINE ID used in LINE. + # @param [Hash] opts the optional parameters + # @return [Array<(IssueLinkTokenResponse, Integer, Hash)>] IssueLinkTokenResponse data, response status code and response headers + def issue_link_token_with_http_info(user_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.issue_link_token ...' + end + # verify the required parameter 'user_id' is set + if @api_client.config.client_side_validation && user_id.nil? + fail ArgumentError, "Missing the required parameter 'user_id' when calling MessagingApiApi.issue_link_token" + end + # resource path + local_var_path = '/v2/bot/user/{userId}/linkToken'.sub('{' + 'userId' + '}', CGI.escape(user_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'IssueLinkTokenResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.issue_link_token", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#issue_link_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Leave group chat + # @param group_id [String] Group ID + # @param [Hash] opts the optional parameters + # @return [nil] + def leave_group(group_id, opts = {}) + leave_group_with_http_info(group_id, opts) + nil + end + + # Leave group chat + # @param group_id [String] Group ID + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def leave_group_with_http_info(group_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.leave_group ...' + end + # verify the required parameter 'group_id' is set + if @api_client.config.client_side_validation && group_id.nil? + fail ArgumentError, "Missing the required parameter 'group_id' when calling MessagingApiApi.leave_group" + end + # resource path + local_var_path = '/v2/bot/group/{groupId}/leave'.sub('{' + 'groupId' + '}', CGI.escape(group_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.leave_group", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#leave_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Leave multi-person chat + # @param room_id [String] Room ID + # @param [Hash] opts the optional parameters + # @return [nil] + def leave_room(room_id, opts = {}) + leave_room_with_http_info(room_id, opts) + nil + end + + # Leave multi-person chat + # @param room_id [String] Room ID + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def leave_room_with_http_info(room_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.leave_room ...' + end + # verify the required parameter 'room_id' is set + if @api_client.config.client_side_validation && room_id.nil? + fail ArgumentError, "Missing the required parameter 'room_id' when calling MessagingApiApi.leave_room" + end + # resource path + local_var_path = '/v2/bot/room/{roomId}/leave'.sub('{' + 'roomId' + '}', CGI.escape(room_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.leave_room", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#leave_room\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Link rich menu to user. + # @param user_id [String] User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. + # @param rich_menu_id [String] ID of a rich menu + # @param [Hash] opts the optional parameters + # @return [nil] + def link_rich_menu_id_to_user(user_id, rich_menu_id, opts = {}) + link_rich_menu_id_to_user_with_http_info(user_id, rich_menu_id, opts) + nil + end + + # Link rich menu to user. + # @param user_id [String] User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. + # @param rich_menu_id [String] ID of a rich menu + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def link_rich_menu_id_to_user_with_http_info(user_id, rich_menu_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.link_rich_menu_id_to_user ...' + end + # verify the required parameter 'user_id' is set + if @api_client.config.client_side_validation && user_id.nil? + fail ArgumentError, "Missing the required parameter 'user_id' when calling MessagingApiApi.link_rich_menu_id_to_user" + end + # verify the required parameter 'rich_menu_id' is set + if @api_client.config.client_side_validation && rich_menu_id.nil? + fail ArgumentError, "Missing the required parameter 'rich_menu_id' when calling MessagingApiApi.link_rich_menu_id_to_user" + end + # resource path + local_var_path = '/v2/bot/user/{userId}/richmenu/{richMenuId}'.sub('{' + 'userId' + '}', CGI.escape(user_id.to_s)).sub('{' + 'richMenuId' + '}', CGI.escape(rich_menu_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.link_rich_menu_id_to_user", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#link_rich_menu_id_to_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Link rich menu to multiple users + # @param rich_menu_bulk_link_request [RichMenuBulkLinkRequest] + # @param [Hash] opts the optional parameters + # @return [nil] + def link_rich_menu_id_to_users(rich_menu_bulk_link_request, opts = {}) + link_rich_menu_id_to_users_with_http_info(rich_menu_bulk_link_request, opts) + nil + end + + # Link rich menu to multiple users + # @param rich_menu_bulk_link_request [RichMenuBulkLinkRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def link_rich_menu_id_to_users_with_http_info(rich_menu_bulk_link_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.link_rich_menu_id_to_users ...' + end + # verify the required parameter 'rich_menu_bulk_link_request' is set + if @api_client.config.client_side_validation && rich_menu_bulk_link_request.nil? + fail ArgumentError, "Missing the required parameter 'rich_menu_bulk_link_request' when calling MessagingApiApi.link_rich_menu_id_to_users" + end + # resource path + local_var_path = '/v2/bot/richmenu/bulk/link' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(rich_menu_bulk_link_request) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.link_rich_menu_id_to_users", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#link_rich_menu_id_to_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Mark messages from users as read + # @param mark_messages_as_read_request [MarkMessagesAsReadRequest] + # @param [Hash] opts the optional parameters + # @return [nil] + def mark_messages_as_read(mark_messages_as_read_request, opts = {}) + mark_messages_as_read_with_http_info(mark_messages_as_read_request, opts) + nil + end + + # Mark messages from users as read + # @param mark_messages_as_read_request [MarkMessagesAsReadRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def mark_messages_as_read_with_http_info(mark_messages_as_read_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.mark_messages_as_read ...' + end + # verify the required parameter 'mark_messages_as_read_request' is set + if @api_client.config.client_side_validation && mark_messages_as_read_request.nil? + fail ArgumentError, "Missing the required parameter 'mark_messages_as_read_request' when calling MessagingApiApi.mark_messages_as_read" + end + # resource path + local_var_path = '/v2/bot/message/markAsRead' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(mark_messages_as_read_request) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.mark_messages_as_read", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#mark_messages_as_read\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # An API that efficiently sends the same message to multiple user IDs. You can't send messages to group chats or multi-person chats. + # @param multicast_request [MulticastRequest] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_line_retry_key Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. + # @return [Object] + def multicast(multicast_request, opts = {}) + data, _status_code, _headers = multicast_with_http_info(multicast_request, opts) + data + end + + # An API that efficiently sends the same message to multiple user IDs. You can't send messages to group chats or multi-person chats. + # @param multicast_request [MulticastRequest] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_line_retry_key Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. + # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers + def multicast_with_http_info(multicast_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.multicast ...' + end + # verify the required parameter 'multicast_request' is set + if @api_client.config.client_side_validation && multicast_request.nil? + fail ArgumentError, "Missing the required parameter 'multicast_request' when calling MessagingApiApi.multicast" + end + # resource path + local_var_path = '/v2/bot/message/multicast' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'X-Line-Retry-Key'] = opts[:'x_line_retry_key'] if !opts[:'x_line_retry_key'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(multicast_request) + + # return_type + return_type = opts[:debug_return_type] || 'Object' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.multicast", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#multicast\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Send narrowcast message + # @param narrowcast_request [NarrowcastRequest] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_line_retry_key Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. + # @return [Object] + def narrowcast(narrowcast_request, opts = {}) + data, _status_code, _headers = narrowcast_with_http_info(narrowcast_request, opts) + data + end + + # Send narrowcast message + # @param narrowcast_request [NarrowcastRequest] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_line_retry_key Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. + # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers + def narrowcast_with_http_info(narrowcast_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.narrowcast ...' + end + # verify the required parameter 'narrowcast_request' is set + if @api_client.config.client_side_validation && narrowcast_request.nil? + fail ArgumentError, "Missing the required parameter 'narrowcast_request' when calling MessagingApiApi.narrowcast" + end + # resource path + local_var_path = '/v2/bot/message/narrowcast' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'X-Line-Retry-Key'] = opts[:'x_line_retry_key'] if !opts[:'x_line_retry_key'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(narrowcast_request) + + # return_type + return_type = opts[:debug_return_type] || 'Object' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.narrowcast", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#narrowcast\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Sends a message to a user, group chat, or multi-person chat at any time. + # @param push_message_request [PushMessageRequest] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_line_retry_key Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. + # @return [PushMessageResponse] + def push_message(push_message_request, opts = {}) + data, _status_code, _headers = push_message_with_http_info(push_message_request, opts) + data + end + + # Sends a message to a user, group chat, or multi-person chat at any time. + # @param push_message_request [PushMessageRequest] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_line_retry_key Retry key. Specifies the UUID in hexadecimal format (e.g., `123e4567-e89b-12d3-a456-426614174000`) generated by any method. The retry key isn't generated by LINE. Each developer must generate their own retry key. + # @return [Array<(PushMessageResponse, Integer, Hash)>] PushMessageResponse data, response status code and response headers + def push_message_with_http_info(push_message_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.push_message ...' + end + # verify the required parameter 'push_message_request' is set + if @api_client.config.client_side_validation && push_message_request.nil? + fail ArgumentError, "Missing the required parameter 'push_message_request' when calling MessagingApiApi.push_message" + end + # resource path + local_var_path = '/v2/bot/message/push' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'X-Line-Retry-Key'] = opts[:'x_line_retry_key'] if !opts[:'x_line_retry_key'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(push_message_request) + + # return_type + return_type = opts[:debug_return_type] || 'PushMessageResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.push_message", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#push_message\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Send LINE notification message + # @param pnp_messages_request [PnpMessagesRequest] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_line_delivery_tag String returned in the delivery.data property of the delivery completion event via Webhook. + # @return [nil] + def push_messages_by_phone(pnp_messages_request, opts = {}) + push_messages_by_phone_with_http_info(pnp_messages_request, opts) + nil + end + + # Send LINE notification message + # @param pnp_messages_request [PnpMessagesRequest] + # @param [Hash] opts the optional parameters + # @option opts [String] :x_line_delivery_tag String returned in the delivery.data property of the delivery completion event via Webhook. + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def push_messages_by_phone_with_http_info(pnp_messages_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.push_messages_by_phone ...' + end + # verify the required parameter 'pnp_messages_request' is set + if @api_client.config.client_side_validation && pnp_messages_request.nil? + fail ArgumentError, "Missing the required parameter 'pnp_messages_request' when calling MessagingApiApi.push_messages_by_phone" + end + if @api_client.config.client_side_validation && !opts[:'x_line_delivery_tag'].nil? && opts[:'x_line_delivery_tag'].to_s.length > 100 + fail ArgumentError, 'invalid value for "opts[:"x_line_delivery_tag"]" when calling MessagingApiApi.push_messages_by_phone, the character length must be smaller than or equal to 100.' + end + + if @api_client.config.client_side_validation && !opts[:'x_line_delivery_tag'].nil? && opts[:'x_line_delivery_tag'].to_s.length < 16 + fail ArgumentError, 'invalid value for "opts[:"x_line_delivery_tag"]" when calling MessagingApiApi.push_messages_by_phone, the character length must be great than or equal to 16.' + end + + # resource path + local_var_path = '/bot/pnp/push' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + header_params[:'X-Line-Delivery-Tag'] = opts[:'x_line_delivery_tag'] if !opts[:'x_line_delivery_tag'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(pnp_messages_request) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.push_messages_by_phone", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#push_messages_by_phone\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Send reply message + # @param reply_message_request [ReplyMessageRequest] + # @param [Hash] opts the optional parameters + # @return [ReplyMessageResponse] + def reply_message(reply_message_request, opts = {}) + data, _status_code, _headers = reply_message_with_http_info(reply_message_request, opts) + data + end + + # Send reply message + # @param reply_message_request [ReplyMessageRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(ReplyMessageResponse, Integer, Hash)>] ReplyMessageResponse data, response status code and response headers + def reply_message_with_http_info(reply_message_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.reply_message ...' + end + # verify the required parameter 'reply_message_request' is set + if @api_client.config.client_side_validation && reply_message_request.nil? + fail ArgumentError, "Missing the required parameter 'reply_message_request' when calling MessagingApiApi.reply_message" + end + # resource path + local_var_path = '/v2/bot/message/reply' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(reply_message_request) + + # return_type + return_type = opts[:debug_return_type] || 'ReplyMessageResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.reply_message", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#reply_message\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # You can use this endpoint to batch control the rich menu linked to the users using the endpoint such as Link rich menu to user. The following operations are available: 1. Replace a rich menu with another rich menu for all users linked to a specific rich menu 2. Unlink a rich menu for all users linked to a specific rich menu 3. Unlink a rich menu for all users linked the rich menu + # @param rich_menu_batch_request [RichMenuBatchRequest] + # @param [Hash] opts the optional parameters + # @return [nil] + def rich_menu_batch(rich_menu_batch_request, opts = {}) + rich_menu_batch_with_http_info(rich_menu_batch_request, opts) + nil + end + + # You can use this endpoint to batch control the rich menu linked to the users using the endpoint such as Link rich menu to user. The following operations are available: 1. Replace a rich menu with another rich menu for all users linked to a specific rich menu 2. Unlink a rich menu for all users linked to a specific rich menu 3. Unlink a rich menu for all users linked the rich menu + # @param rich_menu_batch_request [RichMenuBatchRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def rich_menu_batch_with_http_info(rich_menu_batch_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.rich_menu_batch ...' + end + # verify the required parameter 'rich_menu_batch_request' is set + if @api_client.config.client_side_validation && rich_menu_batch_request.nil? + fail ArgumentError, "Missing the required parameter 'rich_menu_batch_request' when calling MessagingApiApi.rich_menu_batch" + end + # resource path + local_var_path = '/v2/bot/richmenu/batch' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(rich_menu_batch_request) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.rich_menu_batch", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#rich_menu_batch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Set default rich menu + # @param rich_menu_id [String] ID of a rich menu + # @param [Hash] opts the optional parameters + # @return [nil] + def set_default_rich_menu(rich_menu_id, opts = {}) + set_default_rich_menu_with_http_info(rich_menu_id, opts) + nil + end + + # Set default rich menu + # @param rich_menu_id [String] ID of a rich menu + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def set_default_rich_menu_with_http_info(rich_menu_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.set_default_rich_menu ...' + end + # verify the required parameter 'rich_menu_id' is set + if @api_client.config.client_side_validation && rich_menu_id.nil? + fail ArgumentError, "Missing the required parameter 'rich_menu_id' when calling MessagingApiApi.set_default_rich_menu" + end + # resource path + local_var_path = '/v2/bot/user/all/richmenu/{richMenuId}'.sub('{' + 'richMenuId' + '}', CGI.escape(rich_menu_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.set_default_rich_menu", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#set_default_rich_menu\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Set webhook endpoint URL + # @param set_webhook_endpoint_request [SetWebhookEndpointRequest] + # @param [Hash] opts the optional parameters + # @return [nil] + def set_webhook_endpoint(set_webhook_endpoint_request, opts = {}) + set_webhook_endpoint_with_http_info(set_webhook_endpoint_request, opts) + nil + end + + # Set webhook endpoint URL + # @param set_webhook_endpoint_request [SetWebhookEndpointRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def set_webhook_endpoint_with_http_info(set_webhook_endpoint_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.set_webhook_endpoint ...' + end + # verify the required parameter 'set_webhook_endpoint_request' is set + if @api_client.config.client_side_validation && set_webhook_endpoint_request.nil? + fail ArgumentError, "Missing the required parameter 'set_webhook_endpoint_request' when calling MessagingApiApi.set_webhook_endpoint" + end + # resource path + local_var_path = '/v2/bot/channel/webhook/endpoint' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(set_webhook_endpoint_request) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.set_webhook_endpoint", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#set_webhook_endpoint\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Test webhook endpoint + # @param [Hash] opts the optional parameters + # @option opts [TestWebhookEndpointRequest] :test_webhook_endpoint_request + # @return [TestWebhookEndpointResponse] + def test_webhook_endpoint(opts = {}) + data, _status_code, _headers = test_webhook_endpoint_with_http_info(opts) + data + end + + # Test webhook endpoint + # @param [Hash] opts the optional parameters + # @option opts [TestWebhookEndpointRequest] :test_webhook_endpoint_request + # @return [Array<(TestWebhookEndpointResponse, Integer, Hash)>] TestWebhookEndpointResponse data, response status code and response headers + def test_webhook_endpoint_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.test_webhook_endpoint ...' + end + # resource path + local_var_path = '/v2/bot/channel/webhook/test' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'test_webhook_endpoint_request']) + + # return_type + return_type = opts[:debug_return_type] || 'TestWebhookEndpointResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.test_webhook_endpoint", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#test_webhook_endpoint\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Unlink rich menu from user + # @param user_id [String] User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. + # @param [Hash] opts the optional parameters + # @return [nil] + def unlink_rich_menu_id_from_user(user_id, opts = {}) + unlink_rich_menu_id_from_user_with_http_info(user_id, opts) + nil + end + + # Unlink rich menu from user + # @param user_id [String] User ID. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def unlink_rich_menu_id_from_user_with_http_info(user_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.unlink_rich_menu_id_from_user ...' + end + # verify the required parameter 'user_id' is set + if @api_client.config.client_side_validation && user_id.nil? + fail ArgumentError, "Missing the required parameter 'user_id' when calling MessagingApiApi.unlink_rich_menu_id_from_user" + end + # resource path + local_var_path = '/v2/bot/user/{userId}/richmenu'.sub('{' + 'userId' + '}', CGI.escape(user_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.unlink_rich_menu_id_from_user", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#unlink_rich_menu_id_from_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Unlink rich menus from multiple users + # @param rich_menu_bulk_unlink_request [RichMenuBulkUnlinkRequest] + # @param [Hash] opts the optional parameters + # @return [nil] + def unlink_rich_menu_id_from_users(rich_menu_bulk_unlink_request, opts = {}) + unlink_rich_menu_id_from_users_with_http_info(rich_menu_bulk_unlink_request, opts) + nil + end + + # Unlink rich menus from multiple users + # @param rich_menu_bulk_unlink_request [RichMenuBulkUnlinkRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def unlink_rich_menu_id_from_users_with_http_info(rich_menu_bulk_unlink_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.unlink_rich_menu_id_from_users ...' + end + # verify the required parameter 'rich_menu_bulk_unlink_request' is set + if @api_client.config.client_side_validation && rich_menu_bulk_unlink_request.nil? + fail ArgumentError, "Missing the required parameter 'rich_menu_bulk_unlink_request' when calling MessagingApiApi.unlink_rich_menu_id_from_users" + end + # resource path + local_var_path = '/v2/bot/richmenu/bulk/unlink' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(rich_menu_bulk_unlink_request) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.unlink_rich_menu_id_from_users", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#unlink_rich_menu_id_from_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update rich menu alias + # @param rich_menu_alias_id [String] The rich menu alias ID you want to update. + # @param update_rich_menu_alias_request [UpdateRichMenuAliasRequest] + # @param [Hash] opts the optional parameters + # @return [nil] + def update_rich_menu_alias(rich_menu_alias_id, update_rich_menu_alias_request, opts = {}) + update_rich_menu_alias_with_http_info(rich_menu_alias_id, update_rich_menu_alias_request, opts) + nil + end + + # Update rich menu alias + # @param rich_menu_alias_id [String] The rich menu alias ID you want to update. + # @param update_rich_menu_alias_request [UpdateRichMenuAliasRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def update_rich_menu_alias_with_http_info(rich_menu_alias_id, update_rich_menu_alias_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.update_rich_menu_alias ...' + end + # verify the required parameter 'rich_menu_alias_id' is set + if @api_client.config.client_side_validation && rich_menu_alias_id.nil? + fail ArgumentError, "Missing the required parameter 'rich_menu_alias_id' when calling MessagingApiApi.update_rich_menu_alias" + end + # verify the required parameter 'update_rich_menu_alias_request' is set + if @api_client.config.client_side_validation && update_rich_menu_alias_request.nil? + fail ArgumentError, "Missing the required parameter 'update_rich_menu_alias_request' when calling MessagingApiApi.update_rich_menu_alias" + end + # resource path + local_var_path = '/v2/bot/richmenu/alias/{richMenuAliasId}'.sub('{' + 'richMenuAliasId' + '}', CGI.escape(rich_menu_alias_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(update_rich_menu_alias_request) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.update_rich_menu_alias", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#update_rich_menu_alias\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Validate message objects of a broadcast message + # @param validate_message_request [ValidateMessageRequest] + # @param [Hash] opts the optional parameters + # @return [nil] + def validate_broadcast(validate_message_request, opts = {}) + validate_broadcast_with_http_info(validate_message_request, opts) + nil + end + + # Validate message objects of a broadcast message + # @param validate_message_request [ValidateMessageRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def validate_broadcast_with_http_info(validate_message_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.validate_broadcast ...' + end + # verify the required parameter 'validate_message_request' is set + if @api_client.config.client_side_validation && validate_message_request.nil? + fail ArgumentError, "Missing the required parameter 'validate_message_request' when calling MessagingApiApi.validate_broadcast" + end + # resource path + local_var_path = '/v2/bot/message/validate/broadcast' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(validate_message_request) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.validate_broadcast", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#validate_broadcast\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Validate message objects of a multicast message + # @param validate_message_request [ValidateMessageRequest] + # @param [Hash] opts the optional parameters + # @return [nil] + def validate_multicast(validate_message_request, opts = {}) + validate_multicast_with_http_info(validate_message_request, opts) + nil + end + + # Validate message objects of a multicast message + # @param validate_message_request [ValidateMessageRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def validate_multicast_with_http_info(validate_message_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.validate_multicast ...' + end + # verify the required parameter 'validate_message_request' is set + if @api_client.config.client_side_validation && validate_message_request.nil? + fail ArgumentError, "Missing the required parameter 'validate_message_request' when calling MessagingApiApi.validate_multicast" + end + # resource path + local_var_path = '/v2/bot/message/validate/multicast' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(validate_message_request) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.validate_multicast", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#validate_multicast\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Validate message objects of a narrowcast message + # @param validate_message_request [ValidateMessageRequest] + # @param [Hash] opts the optional parameters + # @return [nil] + def validate_narrowcast(validate_message_request, opts = {}) + validate_narrowcast_with_http_info(validate_message_request, opts) + nil + end + + # Validate message objects of a narrowcast message + # @param validate_message_request [ValidateMessageRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def validate_narrowcast_with_http_info(validate_message_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.validate_narrowcast ...' + end + # verify the required parameter 'validate_message_request' is set + if @api_client.config.client_side_validation && validate_message_request.nil? + fail ArgumentError, "Missing the required parameter 'validate_message_request' when calling MessagingApiApi.validate_narrowcast" + end + # resource path + local_var_path = '/v2/bot/message/validate/narrowcast' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(validate_message_request) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.validate_narrowcast", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#validate_narrowcast\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Validate message objects of a push message + # @param validate_message_request [ValidateMessageRequest] + # @param [Hash] opts the optional parameters + # @return [nil] + def validate_push(validate_message_request, opts = {}) + validate_push_with_http_info(validate_message_request, opts) + nil + end + + # Validate message objects of a push message + # @param validate_message_request [ValidateMessageRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def validate_push_with_http_info(validate_message_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.validate_push ...' + end + # verify the required parameter 'validate_message_request' is set + if @api_client.config.client_side_validation && validate_message_request.nil? + fail ArgumentError, "Missing the required parameter 'validate_message_request' when calling MessagingApiApi.validate_push" + end + # resource path + local_var_path = '/v2/bot/message/validate/push' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(validate_message_request) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.validate_push", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#validate_push\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Validate message objects of a reply message + # @param validate_message_request [ValidateMessageRequest] + # @param [Hash] opts the optional parameters + # @return [nil] + def validate_reply(validate_message_request, opts = {}) + validate_reply_with_http_info(validate_message_request, opts) + nil + end + + # Validate message objects of a reply message + # @param validate_message_request [ValidateMessageRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def validate_reply_with_http_info(validate_message_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.validate_reply ...' + end + # verify the required parameter 'validate_message_request' is set + if @api_client.config.client_side_validation && validate_message_request.nil? + fail ArgumentError, "Missing the required parameter 'validate_message_request' when calling MessagingApiApi.validate_reply" + end + # resource path + local_var_path = '/v2/bot/message/validate/reply' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(validate_message_request) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.validate_reply", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#validate_reply\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Validate a request body of the Replace or unlink the linked rich menus in batches endpoint. + # @param rich_menu_batch_request [RichMenuBatchRequest] + # @param [Hash] opts the optional parameters + # @return [nil] + def validate_rich_menu_batch_request(rich_menu_batch_request, opts = {}) + validate_rich_menu_batch_request_with_http_info(rich_menu_batch_request, opts) + nil + end + + # Validate a request body of the Replace or unlink the linked rich menus in batches endpoint. + # @param rich_menu_batch_request [RichMenuBatchRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def validate_rich_menu_batch_request_with_http_info(rich_menu_batch_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.validate_rich_menu_batch_request ...' + end + # verify the required parameter 'rich_menu_batch_request' is set + if @api_client.config.client_side_validation && rich_menu_batch_request.nil? + fail ArgumentError, "Missing the required parameter 'rich_menu_batch_request' when calling MessagingApiApi.validate_rich_menu_batch_request" + end + # resource path + local_var_path = '/v2/bot/richmenu/validate/batch' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(rich_menu_batch_request) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.validate_rich_menu_batch_request", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#validate_rich_menu_batch_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Validate rich menu object + # @param rich_menu_request [RichMenuRequest] + # @param [Hash] opts the optional parameters + # @return [nil] + def validate_rich_menu_object(rich_menu_request, opts = {}) + validate_rich_menu_object_with_http_info(rich_menu_request, opts) + nil + end + + # Validate rich menu object + # @param rich_menu_request [RichMenuRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def validate_rich_menu_object_with_http_info(rich_menu_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiApi.validate_rich_menu_object ...' + end + # verify the required parameter 'rich_menu_request' is set + if @api_client.config.client_side_validation && rich_menu_request.nil? + fail ArgumentError, "Missing the required parameter 'rich_menu_request' when calling MessagingApiApi.validate_rich_menu_object" + end + # resource path + local_var_path = '/v2/bot/richmenu/validate' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(rich_menu_request) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiApi.validate_rich_menu_object", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiApi#validate_rich_menu_object\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/api/messaging_api_blob_api.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/api/messaging_api_blob_api.rb new file mode 100644 index 00000000..94bbf278 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/api/messaging_api_blob_api.rb @@ -0,0 +1,327 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'cgi' + +module LINE::Client::MessagingApi + class MessagingApiBlobApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Download image, video, and audio data sent from users. + # @param message_id [String] Message ID of video or audio + # @param [Hash] opts the optional parameters + # @return [File] + def get_message_content(message_id, opts = {}) + data, _status_code, _headers = get_message_content_with_http_info(message_id, opts) + data + end + + # Download image, video, and audio data sent from users. + # @param message_id [String] Message ID of video or audio + # @param [Hash] opts the optional parameters + # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers + def get_message_content_with_http_info(message_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiBlobApi.get_message_content ...' + end + # verify the required parameter 'message_id' is set + if @api_client.config.client_side_validation && message_id.nil? + fail ArgumentError, "Missing the required parameter 'message_id' when calling MessagingApiBlobApi.get_message_content" + end + # resource path + local_var_path = '/v2/bot/message/{messageId}/content'.sub('{' + 'messageId' + '}', CGI.escape(message_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'File' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiBlobApi.get_message_content", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiBlobApi#get_message_content\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get a preview image of the image or video + # @param message_id [String] Message ID of image or video + # @param [Hash] opts the optional parameters + # @return [File] + def get_message_content_preview(message_id, opts = {}) + data, _status_code, _headers = get_message_content_preview_with_http_info(message_id, opts) + data + end + + # Get a preview image of the image or video + # @param message_id [String] Message ID of image or video + # @param [Hash] opts the optional parameters + # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers + def get_message_content_preview_with_http_info(message_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiBlobApi.get_message_content_preview ...' + end + # verify the required parameter 'message_id' is set + if @api_client.config.client_side_validation && message_id.nil? + fail ArgumentError, "Missing the required parameter 'message_id' when calling MessagingApiBlobApi.get_message_content_preview" + end + # resource path + local_var_path = '/v2/bot/message/{messageId}/content/preview'.sub('{' + 'messageId' + '}', CGI.escape(message_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'File' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiBlobApi.get_message_content_preview", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiBlobApi#get_message_content_preview\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Verify the preparation status of a video or audio for getting + # @param message_id [String] Message ID of video or audio + # @param [Hash] opts the optional parameters + # @return [GetMessageContentTranscodingResponse] + def get_message_content_transcoding_by_message_id(message_id, opts = {}) + data, _status_code, _headers = get_message_content_transcoding_by_message_id_with_http_info(message_id, opts) + data + end + + # Verify the preparation status of a video or audio for getting + # @param message_id [String] Message ID of video or audio + # @param [Hash] opts the optional parameters + # @return [Array<(GetMessageContentTranscodingResponse, Integer, Hash)>] GetMessageContentTranscodingResponse data, response status code and response headers + def get_message_content_transcoding_by_message_id_with_http_info(message_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiBlobApi.get_message_content_transcoding_by_message_id ...' + end + # verify the required parameter 'message_id' is set + if @api_client.config.client_side_validation && message_id.nil? + fail ArgumentError, "Missing the required parameter 'message_id' when calling MessagingApiBlobApi.get_message_content_transcoding_by_message_id" + end + # resource path + local_var_path = '/v2/bot/message/{messageId}/content/transcoding'.sub('{' + 'messageId' + '}', CGI.escape(message_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetMessageContentTranscodingResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiBlobApi.get_message_content_transcoding_by_message_id", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiBlobApi#get_message_content_transcoding_by_message_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Download rich menu image. + # @param rich_menu_id [String] ID of the rich menu with the image to be downloaded + # @param [Hash] opts the optional parameters + # @return [File] + def get_rich_menu_image(rich_menu_id, opts = {}) + data, _status_code, _headers = get_rich_menu_image_with_http_info(rich_menu_id, opts) + data + end + + # Download rich menu image. + # @param rich_menu_id [String] ID of the rich menu with the image to be downloaded + # @param [Hash] opts the optional parameters + # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers + def get_rich_menu_image_with_http_info(rich_menu_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiBlobApi.get_rich_menu_image ...' + end + # verify the required parameter 'rich_menu_id' is set + if @api_client.config.client_side_validation && rich_menu_id.nil? + fail ArgumentError, "Missing the required parameter 'rich_menu_id' when calling MessagingApiBlobApi.get_rich_menu_image" + end + # resource path + local_var_path = '/v2/bot/richmenu/{richMenuId}/content'.sub('{' + 'richMenuId' + '}', CGI.escape(rich_menu_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'File' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiBlobApi.get_rich_menu_image", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiBlobApi#get_rich_menu_image\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Upload rich menu image + # @param rich_menu_id [String] The ID of the rich menu to attach the image to + # @param [Hash] opts the optional parameters + # @option opts [File] :body + # @return [nil] + def set_rich_menu_image(rich_menu_id, opts = {}) + set_rich_menu_image_with_http_info(rich_menu_id, opts) + nil + end + + # Upload rich menu image + # @param rich_menu_id [String] The ID of the rich menu to attach the image to + # @param [Hash] opts the optional parameters + # @option opts [File] :body + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def set_rich_menu_image_with_http_info(rich_menu_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MessagingApiBlobApi.set_rich_menu_image ...' + end + # verify the required parameter 'rich_menu_id' is set + if @api_client.config.client_side_validation && rich_menu_id.nil? + fail ArgumentError, "Missing the required parameter 'rich_menu_id' when calling MessagingApiBlobApi.set_rich_menu_image" + end + # resource path + local_var_path = '/v2/bot/richmenu/{richMenuId}/content'.sub('{' + 'richMenuId' + '}', CGI.escape(rich_menu_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body']) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"MessagingApiBlobApi.set_rich_menu_image", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MessagingApiBlobApi#set_rich_menu_image\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/api_client.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/api_client.rb new file mode 100644 index 00000000..2a032e3a --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/api_client.rb @@ -0,0 +1,392 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'json' +require 'logger' +require 'tempfile' +require 'time' +require 'typhoeus' + +module LINE::Client::MessagingApi + class ApiClient + # The Configuration object holding settings to be used in the API client. + attr_accessor :config + + # Defines the headers to be used in HTTP requests of all API calls by default. + # + # @return [Hash] + attr_accessor :default_headers + + # Initializes the ApiClient + # @option config [Configuration] Configuration for initializing the object, default to Configuration.default + def initialize(config = Configuration.default) + @config = config + @user_agent = "LINE-BotSDK-Ruby/2.0.0" + @default_headers = { + 'Content-Type' => 'application/json', + 'User-Agent' => @user_agent + } + end + + def self.default + @@default ||= ApiClient.new + end + + # Call an API with given options. + # + # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: + # the data deserialized from response body (could be nil), response status code and response headers. + def call_api(http_method, path, opts = {}) + request = build_request(http_method, path, opts) + response = request.run + + if @config.debugging + @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" + end + + unless response.success? + if response.timed_out? + fail ApiError.new('Connection timed out') + elsif response.code == 0 + # Errors from libcurl will be made visible here + fail ApiError.new(:code => 0, + :message => response.return_message) + else + fail ApiError.new(:code => response.code, + :response_headers => response.headers, + :response_body => response.body), + response.status_message + end + end + + if opts[:return_type] + data = deserialize(response, opts[:return_type]) + else + data = nil + end + return data, response.code, response.headers + end + + # Builds the HTTP request + # + # @param [String] http_method HTTP method/verb (e.g. POST) + # @param [String] path URL path (e.g. /account/new) + # @option opts [Hash] :header_params Header parameters + # @option opts [Hash] :query_params Query parameters + # @option opts [Hash] :form_params Query parameters + # @option opts [Object] :body HTTP body (JSON/XML) + # @return [Typhoeus::Request] A Typhoeus Request + def build_request(http_method, path, opts = {}) + url = build_request_url(path, opts) + http_method = http_method.to_sym.downcase + + header_params = @default_headers.merge(opts[:header_params] || {}) + query_params = opts[:query_params] || {} + form_params = opts[:form_params] || {} + follow_location = opts[:follow_location] || true + + update_params_for_auth! header_params, query_params, opts[:auth_names] + + # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false) + _verify_ssl_host = @config.verify_ssl_host ? 2 : 0 + + req_opts = { + :method => http_method, + :headers => header_params, + :params => query_params, + :params_encoding => @config.params_encoding, + :timeout => @config.timeout, + :ssl_verifypeer => @config.verify_ssl, + :ssl_verifyhost => _verify_ssl_host, + :sslcert => @config.cert_file, + :sslkey => @config.key_file, + :verbose => @config.debugging, + :followlocation => follow_location + } + + # set custom cert, if provided + req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert + + if [:post, :patch, :put, :delete].include?(http_method) + req_body = build_request_body(header_params, form_params, opts[:body]) + req_opts.update :body => req_body + if @config.debugging + @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n" + end + end + + request = Typhoeus::Request.new(url, req_opts) + download_file(request) if opts[:return_type] == 'File' + request + end + + # Builds the HTTP request body + # + # @param [Hash] header_params Header parameters + # @param [Hash] form_params Query parameters + # @param [Object] body HTTP body (JSON/XML) + # @return [String] HTTP body data in the form of string + def build_request_body(header_params, form_params, body) + # http form + if header_params['Content-Type'] == 'application/x-www-form-urlencoded' || + header_params['Content-Type'] == 'multipart/form-data' + data = {} + form_params.each do |key, value| + case value + when ::File, ::Array, nil + # let typhoeus handle File, Array and nil parameters + data[key] = value + else + data[key] = value.to_s + end + end + elsif body + data = body.is_a?(String) ? body : body.to_json + else + data = nil + end + data + end + + # Save response body into a file in (the defined) temporary folder, using the filename + # from the "Content-Disposition" header if provided, otherwise a random filename. + # The response body is written to the file in chunks in order to handle files which + # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby + # process can use. + # + # @see Configuration#temp_folder_path + def download_file(request) + tempfile = nil + encoding = nil + request.on_headers do |response| + content_disposition = response.headers['Content-Disposition'] + if content_disposition && content_disposition =~ /filename=/i + filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1] + prefix = sanitize_filename(filename) + else + prefix = 'download-' + end + prefix = prefix + '-' unless prefix.end_with?('-') + encoding = response.body.encoding + tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) + @tempfile = tempfile + end + request.on_body do |chunk| + chunk.force_encoding(encoding) + tempfile.write(chunk) + end + request.on_complete do |response| + if tempfile + tempfile.close + @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ + "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ + "will be deleted automatically with GC. It's also recommended to delete the temp file "\ + "explicitly with `tempfile.delete`" + end + end + end + + # Check if the given MIME is a JSON MIME. + # JSON MIME examples: + # application/json + # application/json; charset=UTF8 + # APPLICATION/JSON + # */* + # @param [String] mime MIME + # @return [Boolean] True if the MIME is application/json + def json_mime?(mime) + (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + end + + # Deserialize the response to the given return type. + # + # @param [Response] response HTTP response + # @param [String] return_type some examples: "User", "Array", "Hash" + def deserialize(response, return_type) + body = response.body + + # handle file downloading - return the File instance processed in request callbacks + # note that response body is empty when the file is written in chunks in request on_body callback + return @tempfile if return_type == 'File' + + return nil if body.nil? || body.empty? + + # return response body directly for String return type + return body if return_type == 'String' + + # ensuring a default content type + content_type = response.headers['Content-Type'] || 'application/json' + + fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type) + + begin + data = JSON.parse("[#{body}]", :symbolize_names => true)[0] + rescue JSON::ParserError => e + if %w(String Date Time).include?(return_type) + data = body + else + raise e + end + end + + convert_to_type data, return_type + end + + # Convert data to the given return type. + # @param [Object] data Data to be converted + # @param [String] return_type Return type + # @return [Mixed] Data in a particular type + def convert_to_type(data, return_type) + return nil if data.nil? + case return_type + when 'String' + data.to_s + when 'Integer' + data.to_i + when 'Float' + data.to_f + when 'Boolean' + data == true + when 'Time' + # parse date time (expecting ISO 8601 format) + Time.parse data + when 'Date' + # parse date time (expecting ISO 8601 format) + Date.parse data + when 'Object' + # generic object (usually a Hash), return directly + data + when /\AArray<(.+)>\z/ + # e.g. Array + sub_type = $1 + data.map { |item| convert_to_type(item, sub_type) } + when /\AHash\\z/ + # e.g. Hash + sub_type = $1 + {}.tap do |hash| + data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } + end + else + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(return_type) + klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + end + end + + # Sanitize filename by removing path. + # e.g. ../../sun.gif becomes sun.gif + # + # @param [String] filename the filename to be sanitized + # @return [String] the sanitized filename + def sanitize_filename(filename) + filename.gsub(/.*[\/\\]/, '') + end + + def build_request_url(path, opts = {}) + # Add leading and trailing slashes to path + path = "/#{path}".gsub(/\/+/, '/') + @config.base_url(opts[:operation]) + path + end + + # Update header and query params based on authentication settings. + # + # @param [Hash] header_params Header parameters + # @param [Hash] query_params Query parameters + # @param [String] auth_names Authentication scheme name + def update_params_for_auth!(header_params, query_params, auth_names) + Array(auth_names).each do |auth_name| + auth_setting = @config.auth_settings[auth_name] + next unless auth_setting + case auth_setting[:in] + when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] + when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] + else fail ArgumentError, 'Authentication token must be in `query` or `header`' + end + end + end + + # Sets user agent in HTTP header + # + # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0) + def user_agent=(user_agent) + @user_agent = user_agent + @default_headers['User-Agent'] = @user_agent + end + + # Return Accept header based on an array of accepts provided. + # @param [Array] accepts array for Accept + # @return [String] the Accept header (e.g. application/json) + def select_header_accept(accepts) + return nil if accepts.nil? || accepts.empty? + # use JSON when present, otherwise use all of the provided + json_accept = accepts.find { |s| json_mime?(s) } + json_accept || accepts.join(',') + end + + # Return Content-Type header based on an array of content types provided. + # @param [Array] content_types array for Content-Type + # @return [String] the Content-Type header (e.g. application/json) + def select_header_content_type(content_types) + # return nil by default + return if content_types.nil? || content_types.empty? + # use JSON when present, otherwise use the first one + json_content_type = content_types.find { |s| json_mime?(s) } + json_content_type || content_types.first + end + + # Convert object (array, hash, object, etc) to JSON string. + # @param [Object] model object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_http_body(model) + return model if model.nil? || model.is_a?(String) + local_body = nil + if model.is_a?(Array) + local_body = model.map { |m| object_to_hash(m) } + else + local_body = object_to_hash(model) + end + local_body.to_json + end + + # Convert object(non-array) to hash. + # @param [Object] obj object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_hash(obj) + if obj.respond_to?(:to_hash) + obj.to_hash + else + obj + end + end + + # Build parameter value according to the given collection format. + # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi + def build_collection_param(param, collection_format) + case collection_format + when :csv + param.join(',') + when :ssv + param.join(' ') + when :tsv + param.join("\t") + when :pipes + param.join('|') + when :multi + # return the array directly as typhoeus will handle it as expected + param + else + fail "unknown collection format: #{collection_format.inspect}" + end + end + end +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/api_error.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/api_error.rb new file mode 100644 index 00000000..ffd77d0b --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/api_error.rb @@ -0,0 +1,58 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::MessagingApi + class ApiError < StandardError + attr_reader :code, :response_headers, :response_body + + # Usage examples: + # ApiError.new + # ApiError.new("message") + # ApiError.new(:code => 500, :response_headers => {}, :response_body => "") + # ApiError.new(:code => 404, :message => "Not Found") + def initialize(arg = nil) + if arg.is_a? Hash + if arg.key?(:message) || arg.key?('message') + super(arg[:message] || arg['message']) + else + super arg + end + + arg.each do |k, v| + instance_variable_set "@#{k}", v + end + else + super arg + @message = arg + end + end + + # Override to_s to display a friendly error message + def to_s + message + end + + def message + if @message.nil? + msg = "Error message: the server returns an error" + else + msg = @message + end + + msg += "\nHTTP status code: #{code}" if code + msg += "\nResponse headers: #{response_headers}" if response_headers + msg += "\nResponse body: #{response_body}" if response_body + + msg + end + end +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/configuration.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/configuration.rb new file mode 100644 index 00000000..9ab32be3 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/configuration.rb @@ -0,0 +1,327 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::MessagingApi + class Configuration + # Defines url scheme + attr_accessor :scheme + + # Defines url host + attr_accessor :host + + # Defines url base path + attr_accessor :base_path + + # Define server configuration index + attr_accessor :server_index + + # Define server operation configuration index + attr_accessor :server_operation_index + + # Default server variables + attr_accessor :server_variables + + # Default server operation variables + attr_accessor :server_operation_variables + + # Defines API keys used with API Key authentications. + # + # @return [Hash] key: parameter name, value: parameter value (API key) + # + # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string) + # config.api_key['api_key'] = 'xxx' + attr_accessor :api_key + + # Defines API key prefixes used with API Key authentications. + # + # @return [Hash] key: parameter name, value: API key prefix + # + # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers) + # config.api_key_prefix['api_key'] = 'Token' + attr_accessor :api_key_prefix + + # Defines the username used with HTTP basic authentication. + # + # @return [String] + attr_accessor :username + + # Defines the password used with HTTP basic authentication. + # + # @return [String] + attr_accessor :password + + # Defines the access token (Bearer) used with OAuth2. + attr_accessor :access_token + + # Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2. + # Overrides the access_token if set + # @return [Proc] + attr_accessor :access_token_getter + + # Set this to return data as binary instead of downloading a temp file. When enabled (set to true) + # HTTP responses with return type `File` will be returned as a stream of binary data. + # Default to false. + attr_accessor :return_binary_data + + # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response + # details will be logged with `logger.debug` (see the `logger` attribute). + # Default to false. + # + # @return [true, false] + attr_accessor :debugging + + # Defines the logger used for debugging. + # Default to `Rails.logger` (when in Rails) or logging to STDOUT. + # + # @return [#debug] + attr_accessor :logger + + # Defines the temporary folder to store downloaded files + # (for API endpoints that have file response). + # Default to use `Tempfile`. + # + # @return [String] + attr_accessor :temp_folder_path + + # The time limit for HTTP request in seconds. + # Default to 0 (never times out). + attr_accessor :timeout + + # Set this to false to skip client side validation in the operation. + # Default to true. + # @return [true, false] + attr_accessor :client_side_validation + + ### TLS/SSL setting + # Set this to false to skip verifying SSL certificate when calling API from https server. + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl + + ### TLS/SSL setting + # Set this to false to skip verifying SSL host name + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl_host + + ### TLS/SSL setting + # Set this to customize the certificate file to verify the peer. + # + # @return [String] the path to the certificate file + # + # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code: + # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145 + attr_accessor :ssl_ca_cert + + ### TLS/SSL setting + # Client certificate file (for client certificate) + attr_accessor :cert_file + + ### TLS/SSL setting + # Client private key file (for client certificate) + attr_accessor :key_file + + # Set this to customize parameters encoding of array parameter with multi collectionFormat. + # Default to nil. + # + # @see The params_encoding option of Ethon. Related source code: + # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 + attr_accessor :params_encoding + + + attr_accessor :inject_format + + attr_accessor :force_ending_format + + def initialize + @scheme = 'https' + @host = 'api.line.me' + @base_path = '' + @server_index = nil + @server_operation_index = {} + @server_variables = {} + @server_operation_variables = {} + @api_key = {} + @api_key_prefix = {} + @client_side_validation = true + @verify_ssl = true + @verify_ssl_host = true + @cert_file = nil + @key_file = nil + @timeout = 0 + @params_encoding = nil + @debugging = false + @inject_format = false + @force_ending_format = false + @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) + + yield(self) if block_given? + end + + # The default Configuration object. + def self.default + @@default ||= Configuration.new + end + + def configure + yield(self) if block_given? + end + + def scheme=(scheme) + # remove :// from scheme + @scheme = scheme.sub(/:\/\//, '') + end + + def host=(host) + # remove http(s):// and anything after a slash + @host = host.sub(/https?:\/\//, '').split('/').first + end + + def base_path=(base_path) + # Add leading and trailing slashes to base_path + @base_path = "/#{base_path}".gsub(/\/+/, '/') + @base_path = '' if @base_path == '/' + end + + # Returns base URL for specified operation based on server settings + def base_url(operation = nil) + if operation_server_settings.key?(operation) then + index = server_operation_index.fetch(operation, server_index) + server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) + else + server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil) + end + end + + # Gets API key (with prefix if set). + # @param [String] param_name the parameter name of API key auth + def api_key_with_prefix(param_name, param_alias = nil) + key = @api_key[param_name] + key = @api_key.fetch(param_alias, key) unless param_alias.nil? + if @api_key_prefix[param_name] + "#{@api_key_prefix[param_name]} #{key}" + else + key + end + end + + # Gets access_token using access_token_getter or uses the static access_token + def access_token_with_refresh + return access_token if access_token_getter.nil? + access_token_getter.call + end + + # Gets Basic Auth token string + def basic_auth_token + 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") + end + + # Returns Auth Settings hash for api client. + def auth_settings + { + 'Bearer' => + { + type: 'bearer', + in: 'header', + key: 'Authorization', + value: "Bearer #{access_token_with_refresh}" + }, + } + end + + # Returns an array of Server setting + def server_settings + [ + { + url: "https://api.line.me", + description: "No description provided", + } + ] + end + + def operation_server_settings + { + "MessagingApiBlobApi.get_message_content": [ + { + url: "https://api-data.line.me", + description: "No description provided", + } + ], + "MessagingApiBlobApi.get_message_content_preview": [ + { + url: "https://api-data.line.me", + description: "No description provided", + } + ], + "MessagingApiBlobApi.get_message_content_transcoding_by_message_id": [ + { + url: "https://api-data.line.me", + description: "No description provided", + } + ], + "MessagingApiBlobApi.get_rich_menu_image": [ + { + url: "https://api-data.line.me", + description: "No description provided", + } + ], + "MessagingApiBlobApi.set_rich_menu_image": [ + { + url: "https://api-data.line.me", + description: "No description provided", + } + ], + } + end + + # Returns URL based on server settings + # + # @param index array index of the server settings + # @param variables hash of variable and the corresponding value + def server_url(index, variables = {}, servers = nil) + servers = server_settings if servers == nil + + # check array index out of bound + if (index.nil? || index < 0 || index >= servers.size) + fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}" + end + + server = servers[index] + url = server[:url] + + return url unless server.key? :variables + + # go through variable and assign a value + server[:variables].each do |name, variable| + if variables.key?(name) + if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name])) + url.gsub! "{" + name.to_s + "}", variables[name] + else + fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}." + end + else + # use default value + url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] + end + end + + url + end + + end +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/action.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/action.rb new file mode 100644 index 00000000..6d29f417 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/action.rb @@ -0,0 +1,236 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + # Action + class Action + # Type of action + attr_accessor :type + + # Label for the action. + attr_accessor :label + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'label' => :'label' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'label' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # discriminator's property name in OpenAPI v3 + def self.openapi_discriminator_name + :'type' + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::Action` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::Action`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'label') + self.label = attributes[:'label'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + label == o.label + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, label].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/age_demographic.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/age_demographic.rb new file mode 100644 index 00000000..d8879db1 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/age_demographic.rb @@ -0,0 +1,46 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class AgeDemographic + N15 = "age_15".freeze + N20 = "age_20".freeze + N25 = "age_25".freeze + N30 = "age_30".freeze + N35 = "age_35".freeze + N40 = "age_40".freeze + N45 = "age_45".freeze + N50 = "age_50".freeze + + def self.all_vars + @all_vars ||= [N15, N20, N25, N30, N35, N40, N45, N50].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if AgeDemographic.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #AgeDemographic" + end + end +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/age_demographic_filter.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/age_demographic_filter.rb new file mode 100644 index 00000000..e471fd52 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/age_demographic_filter.rb @@ -0,0 +1,261 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class AgeDemographicFilter < DemographicFilter + attr_accessor :gte + + attr_accessor :lt + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'gte' => :'gte', + :'lt' => :'lt' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'gte' => :'AgeDemographic', + :'lt' => :'AgeDemographic' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'DemographicFilter' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::AgeDemographicFilter` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::AgeDemographicFilter`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'gte') + self.gte = attributes[:'gte'] + end + + if attributes.key?(:'lt') + self.lt = attributes[:'lt'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + gte == o.gte && + lt == o.lt && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [gte, lt].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/age_demographic_filter_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/age_demographic_filter_all_of.rb new file mode 100644 index 00000000..6dcfe261 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/age_demographic_filter_all_of.rb @@ -0,0 +1,250 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class AgeDemographicFilterAllOf + attr_accessor :gte + + attr_accessor :lt + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'gte' => :'gte', + :'lt' => :'lt' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'gte' => :'AgeDemographic', + :'lt' => :'AgeDemographic' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::AgeDemographicFilterAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::AgeDemographicFilterAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'gte') + self.gte = attributes[:'gte'] + end + + if attributes.key?(:'lt') + self.lt = attributes[:'lt'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + gte == o.gte && + lt == o.lt + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [gte, lt].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/alt_uri.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/alt_uri.rb new file mode 100644 index 00000000..8f821feb --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/alt_uri.rb @@ -0,0 +1,247 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class AltUri + attr_accessor :desktop + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'desktop' => :'desktop' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'desktop' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::AltUri` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::AltUri`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'desktop') + self.desktop = attributes[:'desktop'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@desktop.nil? && @desktop.to_s.length > 1000 + invalid_properties.push('invalid value for "desktop", the character length must be smaller than or equal to 1000.') + end + + if !@desktop.nil? && @desktop.to_s.length < 0 + invalid_properties.push('invalid value for "desktop", the character length must be great than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@desktop.nil? && @desktop.to_s.length > 1000 + return false if !@desktop.nil? && @desktop.to_s.length < 0 + true + end + + # Custom attribute writer method with validation + # @param [Object] desktop Value to be assigned + def desktop=(desktop) + if desktop.nil? + fail ArgumentError, 'desktop cannot be nil' + end + + if desktop.to_s.length > 1000 + fail ArgumentError, 'invalid value for "desktop", the character length must be smaller than or equal to 1000.' + end + + if desktop.to_s.length < 0 + fail ArgumentError, 'invalid value for "desktop", the character length must be great than or equal to 0.' + end + + @desktop = desktop + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + desktop == o.desktop + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [desktop].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/app_type_demographic.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/app_type_demographic.rb new file mode 100644 index 00000000..9120804d --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/app_type_demographic.rb @@ -0,0 +1,40 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class AppTypeDemographic + IOS = "ios".freeze + ANDROID = "android".freeze + + def self.all_vars + @all_vars ||= [IOS, ANDROID].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if AppTypeDemographic.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #AppTypeDemographic" + end + end +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/app_type_demographic_filter.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/app_type_demographic_filter.rb new file mode 100644 index 00000000..50486ed4 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/app_type_demographic_filter.rb @@ -0,0 +1,232 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class AppTypeDemographicFilter < DemographicFilter + attr_accessor :one_of + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'one_of' => :'oneOf' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'one_of' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'DemographicFilter' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::AppTypeDemographicFilter` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::AppTypeDemographicFilter`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'one_of') + if (value = attributes[:'one_of']).is_a?(Array) + self.one_of = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + one_of == o.one_of && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [one_of].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/app_type_demographic_filter_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/app_type_demographic_filter_all_of.rb new file mode 100644 index 00000000..50764692 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/app_type_demographic_filter_all_of.rb @@ -0,0 +1,221 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class AppTypeDemographicFilterAllOf + attr_accessor :one_of + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'one_of' => :'oneOf' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'one_of' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::AppTypeDemographicFilterAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::AppTypeDemographicFilterAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'one_of') + if (value = attributes[:'one_of']).is_a?(Array) + self.one_of = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + one_of == o.one_of + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [one_of].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/area_demographic.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/area_demographic.rb new file mode 100644 index 00000000..14bc94af --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/area_demographic.rb @@ -0,0 +1,127 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class AreaDemographic + HOKKAIDO = "jp_01".freeze + AOMORI = "jp_02".freeze + IWATE = "jp_03".freeze + MIYAGI = "jp_04".freeze + AKITA = "jp_05".freeze + YAMAGATA = "jp_06".freeze + FUKUSHIMA = "jp_07".freeze + IBARAKI = "jp_08".freeze + TOCHIGI = "jp_09".freeze + GUNMA = "jp_10".freeze + SAITAMA = "jp_11".freeze + CHIBA = "jp_12".freeze + TOKYO = "jp_13".freeze + KANAGAWA = "jp_14".freeze + NIIGATA = "jp_15".freeze + TOYAMA = "jp_16".freeze + ISHIKAWA = "jp_17".freeze + FUKUI = "jp_18".freeze + YAMANASHI = "jp_19".freeze + NAGANO = "jp_20".freeze + GIFU = "jp_21".freeze + SHIZUOKA = "jp_22".freeze + AICHI = "jp_23".freeze + MIE = "jp_24".freeze + SHIGA = "jp_25".freeze + KYOTO = "jp_26".freeze + OSAKA = "jp_27".freeze + HYOUGO = "jp_28".freeze + NARA = "jp_29".freeze + WAKAYAMA = "jp_30".freeze + TOTTORI = "jp_31".freeze + SHIMANE = "jp_32".freeze + OKAYAMA = "jp_33".freeze + HIROSHIMA = "jp_34".freeze + YAMAGUCHI = "jp_35".freeze + TOKUSHIMA = "jp_36".freeze + KAGAWA = "jp_37".freeze + EHIME = "jp_38".freeze + KOUCHI = "jp_39".freeze + FUKUOKA = "jp_40".freeze + SAGA = "jp_41".freeze + NAGASAKI = "jp_42".freeze + KUMAMOTO = "jp_43".freeze + OITA = "jp_44".freeze + MIYAZAKI = "jp_45".freeze + KAGOSHIMA = "jp_46".freeze + OKINAWA = "jp_47".freeze + TAIPEI_CITY = "tw_01".freeze + NEW_TAIPEI_CITY = "tw_02".freeze + TAOYUAN_CITY = "tw_03".freeze + TAICHUNG_CITY = "tw_04".freeze + TAINAN_CITY = "tw_05".freeze + KAOHSIUNG_CITY = "tw_06".freeze + KEELUNG_CITY = "tw_07".freeze + HSINCHU_CITY = "tw_08".freeze + CHIAYI_CITY = "tw_09".freeze + HSINCHU_COUNTY = "tw_10".freeze + MIAOLI_COUNTY = "tw_11".freeze + CHANGHUA_COUNTY = "tw_12".freeze + NANTOU_COUNTY = "tw_13".freeze + YUNLIN_COUNTY = "tw_14".freeze + CHIAYI_COUNTY = "tw_15".freeze + PINGTUNG_COUNTY = "tw_16".freeze + YILAN_COUNTY = "tw_17".freeze + HUALIEN_COUNTY = "tw_18".freeze + TAITUNG_COUNTY = "tw_19".freeze + PENGHU_COUNTY = "tw_20".freeze + KINMEN_COUNTY = "tw_21".freeze + LIENCHIANG_COUNTY = "tw_22".freeze + BANGKOK = "th_01".freeze + PATTAYA = "th_02".freeze + NORTHERN = "th_03".freeze + CENTRAL = "th_04".freeze + SOUTHERN = "th_05".freeze + EASTERN = "th_06".freeze + NORTHEASTERN = "th_07".freeze + WESTERN = "th_08".freeze + BALI = "id_01".freeze + BANDUNG = "id_02".freeze + BANJARMASIN = "id_03".freeze + JABODETABEK = "id_04".freeze + MAKASSAR = "id_05".freeze + MEDAN = "id_06".freeze + PALEMBANG = "id_07".freeze + SAMARINDA = "id_08".freeze + SEMARANG = "id_09".freeze + SURABAYA = "id_10".freeze + YOGYAKARTA = "id_11".freeze + LAINNYA = "id_12".freeze + + def self.all_vars + @all_vars ||= [HOKKAIDO, AOMORI, IWATE, MIYAGI, AKITA, YAMAGATA, FUKUSHIMA, IBARAKI, TOCHIGI, GUNMA, SAITAMA, CHIBA, TOKYO, KANAGAWA, NIIGATA, TOYAMA, ISHIKAWA, FUKUI, YAMANASHI, NAGANO, GIFU, SHIZUOKA, AICHI, MIE, SHIGA, KYOTO, OSAKA, HYOUGO, NARA, WAKAYAMA, TOTTORI, SHIMANE, OKAYAMA, HIROSHIMA, YAMAGUCHI, TOKUSHIMA, KAGAWA, EHIME, KOUCHI, FUKUOKA, SAGA, NAGASAKI, KUMAMOTO, OITA, MIYAZAKI, KAGOSHIMA, OKINAWA, TAIPEI_CITY, NEW_TAIPEI_CITY, TAOYUAN_CITY, TAICHUNG_CITY, TAINAN_CITY, KAOHSIUNG_CITY, KEELUNG_CITY, HSINCHU_CITY, CHIAYI_CITY, HSINCHU_COUNTY, MIAOLI_COUNTY, CHANGHUA_COUNTY, NANTOU_COUNTY, YUNLIN_COUNTY, CHIAYI_COUNTY, PINGTUNG_COUNTY, YILAN_COUNTY, HUALIEN_COUNTY, TAITUNG_COUNTY, PENGHU_COUNTY, KINMEN_COUNTY, LIENCHIANG_COUNTY, BANGKOK, PATTAYA, NORTHERN, CENTRAL, SOUTHERN, EASTERN, NORTHEASTERN, WESTERN, BALI, BANDUNG, BANJARMASIN, JABODETABEK, MAKASSAR, MEDAN, PALEMBANG, SAMARINDA, SEMARANG, SURABAYA, YOGYAKARTA, LAINNYA].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if AreaDemographic.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #AreaDemographic" + end + end +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/area_demographic_filter.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/area_demographic_filter.rb new file mode 100644 index 00000000..c75ae17d --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/area_demographic_filter.rb @@ -0,0 +1,232 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class AreaDemographicFilter < DemographicFilter + attr_accessor :one_of + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'one_of' => :'oneOf' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'one_of' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'DemographicFilter' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::AreaDemographicFilter` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::AreaDemographicFilter`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'one_of') + if (value = attributes[:'one_of']).is_a?(Array) + self.one_of = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + one_of == o.one_of && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [one_of].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/area_demographic_filter_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/area_demographic_filter_all_of.rb new file mode 100644 index 00000000..96248d14 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/area_demographic_filter_all_of.rb @@ -0,0 +1,221 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class AreaDemographicFilterAllOf + attr_accessor :one_of + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'one_of' => :'oneOf' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'one_of' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::AreaDemographicFilterAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::AreaDemographicFilterAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'one_of') + if (value = attributes[:'one_of']).is_a?(Array) + self.one_of = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + one_of == o.one_of + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [one_of].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/audience_match_messages_request.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/audience_match_messages_request.rb new file mode 100644 index 00000000..26e0cebe --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/audience_match_messages_request.rb @@ -0,0 +1,316 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class AudienceMatchMessagesRequest + # Destination of the message (A value obtained by hashing the telephone number, which is another value normalized to E.164 format, with SHA256). + attr_accessor :messages + + # Message to send. + attr_accessor :to + + # `true`: The user doesn’t receive a push notification when a message is sent. `false`: The user receives a push notification when the message is sent (unless they have disabled push notifications in LINE and/or their device). The default value is false. + attr_accessor :notification_disabled + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'messages' => :'messages', + :'to' => :'to', + :'notification_disabled' => :'notificationDisabled' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'messages' => :'Array', + :'to' => :'Array', + :'notification_disabled' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::AudienceMatchMessagesRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::AudienceMatchMessagesRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'messages') + if (value = attributes[:'messages']).is_a?(Array) + self.messages = value + end + else + self.messages = nil + end + + if attributes.key?(:'to') + if (value = attributes[:'to']).is_a?(Array) + self.to = value + end + else + self.to = nil + end + + if attributes.key?(:'notification_disabled') + self.notification_disabled = attributes[:'notification_disabled'] + else + self.notification_disabled = false + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @messages.nil? + invalid_properties.push('invalid value for "messages", messages cannot be nil.') + end + + if @messages.length > 5 + invalid_properties.push('invalid value for "messages", number of items must be less than or equal to 5.') + end + + if @messages.length < 1 + invalid_properties.push('invalid value for "messages", number of items must be greater than or equal to 1.') + end + + if @to.nil? + invalid_properties.push('invalid value for "to", to cannot be nil.') + end + + if @to.length > 500 + invalid_properties.push('invalid value for "to", number of items must be less than or equal to 500.') + end + + if @to.length < 1 + invalid_properties.push('invalid value for "to", number of items must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @messages.nil? + return false if @messages.length > 5 + return false if @messages.length < 1 + return false if @to.nil? + return false if @to.length > 500 + return false if @to.length < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] messages Value to be assigned + def messages=(messages) + if messages.nil? + fail ArgumentError, 'messages cannot be nil' + end + + if messages.length > 5 + fail ArgumentError, 'invalid value for "messages", number of items must be less than or equal to 5.' + end + + if messages.length < 1 + fail ArgumentError, 'invalid value for "messages", number of items must be greater than or equal to 1.' + end + + @messages = messages + end + + # Custom attribute writer method with validation + # @param [Object] to Value to be assigned + def to=(to) + if to.nil? + fail ArgumentError, 'to cannot be nil' + end + + if to.length > 500 + fail ArgumentError, 'invalid value for "to", number of items must be less than or equal to 500.' + end + + if to.length < 1 + fail ArgumentError, 'invalid value for "to", number of items must be greater than or equal to 1.' + end + + @to = to + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + messages == o.messages && + to == o.to && + notification_disabled == o.notification_disabled + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [messages, to, notification_disabled].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/audience_recipient.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/audience_recipient.rb new file mode 100644 index 00000000..5f6080d6 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/audience_recipient.rb @@ -0,0 +1,230 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class AudienceRecipient < Recipient + attr_accessor :audience_group_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'audience_group_id' => :'audienceGroupId' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'audience_group_id' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Recipient' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::AudienceRecipient` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::AudienceRecipient`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'audience_group_id') + self.audience_group_id = attributes[:'audience_group_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + audience_group_id == o.audience_group_id && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [audience_group_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/audience_recipient_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/audience_recipient_all_of.rb new file mode 100644 index 00000000..1f2ce945 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/audience_recipient_all_of.rb @@ -0,0 +1,219 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class AudienceRecipientAllOf + attr_accessor :audience_group_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'audience_group_id' => :'audienceGroupId' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'audience_group_id' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::AudienceRecipientAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::AudienceRecipientAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'audience_group_id') + self.audience_group_id = attributes[:'audience_group_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + audience_group_id == o.audience_group_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [audience_group_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/audio_message.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/audio_message.rb new file mode 100644 index 00000000..a5ec06c3 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/audio_message.rb @@ -0,0 +1,239 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class AudioMessage < Message + attr_accessor :original_content_url + + attr_accessor :duration + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'original_content_url' => :'originalContentUrl', + :'duration' => :'duration' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'original_content_url' => :'String', + :'duration' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Message' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::AudioMessage` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::AudioMessage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'original_content_url') + self.original_content_url = attributes[:'original_content_url'] + end + + if attributes.key?(:'duration') + self.duration = attributes[:'duration'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + original_content_url == o.original_content_url && + duration == o.duration && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [original_content_url, duration].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/audio_message_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/audio_message_all_of.rb new file mode 100644 index 00000000..9232412e --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/audio_message_all_of.rb @@ -0,0 +1,228 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class AudioMessageAllOf + attr_accessor :original_content_url + + attr_accessor :duration + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'original_content_url' => :'originalContentUrl', + :'duration' => :'duration' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'original_content_url' => :'String', + :'duration' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::AudioMessageAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::AudioMessageAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'original_content_url') + self.original_content_url = attributes[:'original_content_url'] + end + + if attributes.key?(:'duration') + self.duration = attributes[:'duration'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + original_content_url == o.original_content_url && + duration == o.duration + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [original_content_url, duration].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/bot_info_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/bot_info_response.rb new file mode 100644 index 00000000..af077113 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/bot_info_response.rb @@ -0,0 +1,361 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class BotInfoResponse + # Bot's user ID + attr_accessor :user_id + + # Bot's basic ID + attr_accessor :basic_id + + # Bot's premium ID. Not included in the response if the premium ID isn't set. + attr_accessor :premium_id + + # Bot's display name + attr_accessor :display_name + + # Profile image URL. `https` image URL. Not included in the response if the bot doesn't have a profile image. + attr_accessor :picture_url + + # Chat settings set in the LINE Official Account Manager. One of: `chat`: Chat is set to \"On\". `bot`: Chat is set to \"Off\". + attr_accessor :chat_mode + + # Automatic read setting for messages. If the chat is set to \"Off\", auto is returned. If the chat is set to \"On\", manual is returned. `auto`: Auto read setting is enabled. `manual`: Auto read setting is disabled. + attr_accessor :mark_as_read_mode + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'user_id' => :'userId', + :'basic_id' => :'basicId', + :'premium_id' => :'premiumId', + :'display_name' => :'displayName', + :'picture_url' => :'pictureUrl', + :'chat_mode' => :'chatMode', + :'mark_as_read_mode' => :'markAsReadMode' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'user_id' => :'String', + :'basic_id' => :'String', + :'premium_id' => :'String', + :'display_name' => :'String', + :'picture_url' => :'String', + :'chat_mode' => :'String', + :'mark_as_read_mode' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::BotInfoResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::BotInfoResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'user_id') + self.user_id = attributes[:'user_id'] + else + self.user_id = nil + end + + if attributes.key?(:'basic_id') + self.basic_id = attributes[:'basic_id'] + else + self.basic_id = nil + end + + if attributes.key?(:'premium_id') + self.premium_id = attributes[:'premium_id'] + end + + if attributes.key?(:'display_name') + self.display_name = attributes[:'display_name'] + else + self.display_name = nil + end + + if attributes.key?(:'picture_url') + self.picture_url = attributes[:'picture_url'] + end + + if attributes.key?(:'chat_mode') + self.chat_mode = attributes[:'chat_mode'] + else + self.chat_mode = nil + end + + if attributes.key?(:'mark_as_read_mode') + self.mark_as_read_mode = attributes[:'mark_as_read_mode'] + else + self.mark_as_read_mode = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @user_id.nil? + invalid_properties.push('invalid value for "user_id", user_id cannot be nil.') + end + + if @basic_id.nil? + invalid_properties.push('invalid value for "basic_id", basic_id cannot be nil.') + end + + if @display_name.nil? + invalid_properties.push('invalid value for "display_name", display_name cannot be nil.') + end + + if @chat_mode.nil? + invalid_properties.push('invalid value for "chat_mode", chat_mode cannot be nil.') + end + + if @mark_as_read_mode.nil? + invalid_properties.push('invalid value for "mark_as_read_mode", mark_as_read_mode cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @user_id.nil? + return false if @basic_id.nil? + return false if @display_name.nil? + return false if @chat_mode.nil? + chat_mode_validator = EnumAttributeValidator.new('String', ["chat", "bot"]) + return false unless chat_mode_validator.valid?(@chat_mode) + return false if @mark_as_read_mode.nil? + mark_as_read_mode_validator = EnumAttributeValidator.new('String', ["auto", "manual"]) + return false unless mark_as_read_mode_validator.valid?(@mark_as_read_mode) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] chat_mode Object to be assigned + def chat_mode=(chat_mode) + validator = EnumAttributeValidator.new('String', ["chat", "bot"]) + unless validator.valid?(chat_mode) + fail ArgumentError, "invalid value for \"chat_mode\", must be one of #{validator.allowable_values}." + end + @chat_mode = chat_mode + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] mark_as_read_mode Object to be assigned + def mark_as_read_mode=(mark_as_read_mode) + validator = EnumAttributeValidator.new('String', ["auto", "manual"]) + unless validator.valid?(mark_as_read_mode) + fail ArgumentError, "invalid value for \"mark_as_read_mode\", must be one of #{validator.allowable_values}." + end + @mark_as_read_mode = mark_as_read_mode + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + user_id == o.user_id && + basic_id == o.basic_id && + premium_id == o.premium_id && + display_name == o.display_name && + picture_url == o.picture_url && + chat_mode == o.chat_mode && + mark_as_read_mode == o.mark_as_read_mode + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [user_id, basic_id, premium_id, display_name, picture_url, chat_mode, mark_as_read_mode].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/broadcast_request.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/broadcast_request.rb new file mode 100644 index 00000000..5c82e422 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/broadcast_request.rb @@ -0,0 +1,269 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class BroadcastRequest + # List of Message objects. + attr_accessor :messages + + # `true`: The user doesn’t receive a push notification when a message is sent. `false`: The user receives a push notification when the message is sent (unless they have disabled push notifications in LINE and/or their device). The default value is false. + attr_accessor :notification_disabled + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'messages' => :'messages', + :'notification_disabled' => :'notificationDisabled' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'messages' => :'Array', + :'notification_disabled' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::BroadcastRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::BroadcastRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'messages') + if (value = attributes[:'messages']).is_a?(Array) + self.messages = value + end + else + self.messages = nil + end + + if attributes.key?(:'notification_disabled') + self.notification_disabled = attributes[:'notification_disabled'] + else + self.notification_disabled = false + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @messages.nil? + invalid_properties.push('invalid value for "messages", messages cannot be nil.') + end + + if @messages.length > 5 + invalid_properties.push('invalid value for "messages", number of items must be less than or equal to 5.') + end + + if @messages.length < 1 + invalid_properties.push('invalid value for "messages", number of items must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @messages.nil? + return false if @messages.length > 5 + return false if @messages.length < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] messages Value to be assigned + def messages=(messages) + if messages.nil? + fail ArgumentError, 'messages cannot be nil' + end + + if messages.length > 5 + fail ArgumentError, 'invalid value for "messages", number of items must be less than or equal to 5.' + end + + if messages.length < 1 + fail ArgumentError, 'invalid value for "messages", number of items must be greater than or equal to 1.' + end + + @messages = messages + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + messages == o.messages && + notification_disabled == o.notification_disabled + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [messages, notification_disabled].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/buttons_template.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/buttons_template.rb new file mode 100644 index 00000000..e68f1e46 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/buttons_template.rb @@ -0,0 +1,295 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class ButtonsTemplate < Template + attr_accessor :thumbnail_image_url + + attr_accessor :image_aspect_ratio + + attr_accessor :image_size + + attr_accessor :image_background_color + + attr_accessor :title + + attr_accessor :text + + attr_accessor :default_action + + attr_accessor :actions + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'thumbnail_image_url' => :'thumbnailImageUrl', + :'image_aspect_ratio' => :'imageAspectRatio', + :'image_size' => :'imageSize', + :'image_background_color' => :'imageBackgroundColor', + :'title' => :'title', + :'text' => :'text', + :'default_action' => :'defaultAction', + :'actions' => :'actions' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'thumbnail_image_url' => :'String', + :'image_aspect_ratio' => :'String', + :'image_size' => :'String', + :'image_background_color' => :'String', + :'title' => :'String', + :'text' => :'String', + :'default_action' => :'Action', + :'actions' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Template' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::ButtonsTemplate` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::ButtonsTemplate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'thumbnail_image_url') + self.thumbnail_image_url = attributes[:'thumbnail_image_url'] + end + + if attributes.key?(:'image_aspect_ratio') + self.image_aspect_ratio = attributes[:'image_aspect_ratio'] + end + + if attributes.key?(:'image_size') + self.image_size = attributes[:'image_size'] + end + + if attributes.key?(:'image_background_color') + self.image_background_color = attributes[:'image_background_color'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + + if attributes.key?(:'text') + self.text = attributes[:'text'] + end + + if attributes.key?(:'default_action') + self.default_action = attributes[:'default_action'] + end + + if attributes.key?(:'actions') + if (value = attributes[:'actions']).is_a?(Array) + self.actions = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + thumbnail_image_url == o.thumbnail_image_url && + image_aspect_ratio == o.image_aspect_ratio && + image_size == o.image_size && + image_background_color == o.image_background_color && + title == o.title && + text == o.text && + default_action == o.default_action && + actions == o.actions && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [thumbnail_image_url, image_aspect_ratio, image_size, image_background_color, title, text, default_action, actions].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/buttons_template_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/buttons_template_all_of.rb new file mode 100644 index 00000000..ca8e60b5 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/buttons_template_all_of.rb @@ -0,0 +1,284 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class ButtonsTemplateAllOf + attr_accessor :thumbnail_image_url + + attr_accessor :image_aspect_ratio + + attr_accessor :image_size + + attr_accessor :image_background_color + + attr_accessor :title + + attr_accessor :text + + attr_accessor :default_action + + attr_accessor :actions + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'thumbnail_image_url' => :'thumbnailImageUrl', + :'image_aspect_ratio' => :'imageAspectRatio', + :'image_size' => :'imageSize', + :'image_background_color' => :'imageBackgroundColor', + :'title' => :'title', + :'text' => :'text', + :'default_action' => :'defaultAction', + :'actions' => :'actions' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'thumbnail_image_url' => :'String', + :'image_aspect_ratio' => :'String', + :'image_size' => :'String', + :'image_background_color' => :'String', + :'title' => :'String', + :'text' => :'String', + :'default_action' => :'Action', + :'actions' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::ButtonsTemplateAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::ButtonsTemplateAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'thumbnail_image_url') + self.thumbnail_image_url = attributes[:'thumbnail_image_url'] + end + + if attributes.key?(:'image_aspect_ratio') + self.image_aspect_ratio = attributes[:'image_aspect_ratio'] + end + + if attributes.key?(:'image_size') + self.image_size = attributes[:'image_size'] + end + + if attributes.key?(:'image_background_color') + self.image_background_color = attributes[:'image_background_color'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + + if attributes.key?(:'text') + self.text = attributes[:'text'] + end + + if attributes.key?(:'default_action') + self.default_action = attributes[:'default_action'] + end + + if attributes.key?(:'actions') + if (value = attributes[:'actions']).is_a?(Array) + self.actions = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + thumbnail_image_url == o.thumbnail_image_url && + image_aspect_ratio == o.image_aspect_ratio && + image_size == o.image_size && + image_background_color == o.image_background_color && + title == o.title && + text == o.text && + default_action == o.default_action && + actions == o.actions + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [thumbnail_image_url, image_aspect_ratio, image_size, image_background_color, title, text, default_action, actions].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/camera_action.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/camera_action.rb new file mode 100644 index 00000000..17377ae0 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/camera_action.rb @@ -0,0 +1,221 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class CameraAction < Action + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Action' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::CameraAction` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::CameraAction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/camera_roll_action.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/camera_roll_action.rb new file mode 100644 index 00000000..63b802cb --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/camera_roll_action.rb @@ -0,0 +1,221 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class CameraRollAction < Action + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Action' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::CameraRollAction` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::CameraRollAction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/carousel_column.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/carousel_column.rb new file mode 100644 index 00000000..14b84c2d --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/carousel_column.rb @@ -0,0 +1,267 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + # Column object for carousel template. + class CarouselColumn + attr_accessor :thumbnail_image_url + + attr_accessor :image_background_color + + attr_accessor :title + + attr_accessor :text + + attr_accessor :default_action + + attr_accessor :actions + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'thumbnail_image_url' => :'thumbnailImageUrl', + :'image_background_color' => :'imageBackgroundColor', + :'title' => :'title', + :'text' => :'text', + :'default_action' => :'defaultAction', + :'actions' => :'actions' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'thumbnail_image_url' => :'String', + :'image_background_color' => :'String', + :'title' => :'String', + :'text' => :'String', + :'default_action' => :'Action', + :'actions' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::CarouselColumn` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::CarouselColumn`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'thumbnail_image_url') + self.thumbnail_image_url = attributes[:'thumbnail_image_url'] + end + + if attributes.key?(:'image_background_color') + self.image_background_color = attributes[:'image_background_color'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + + if attributes.key?(:'text') + self.text = attributes[:'text'] + end + + if attributes.key?(:'default_action') + self.default_action = attributes[:'default_action'] + end + + if attributes.key?(:'actions') + if (value = attributes[:'actions']).is_a?(Array) + self.actions = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + thumbnail_image_url == o.thumbnail_image_url && + image_background_color == o.image_background_color && + title == o.title && + text == o.text && + default_action == o.default_action && + actions == o.actions + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [thumbnail_image_url, image_background_color, title, text, default_action, actions].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/carousel_template.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/carousel_template.rb new file mode 100644 index 00000000..cf5fad19 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/carousel_template.rb @@ -0,0 +1,250 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class CarouselTemplate < Template + attr_accessor :columns + + attr_accessor :image_aspect_ratio + + attr_accessor :image_size + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'columns' => :'columns', + :'image_aspect_ratio' => :'imageAspectRatio', + :'image_size' => :'imageSize' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'columns' => :'Array', + :'image_aspect_ratio' => :'String', + :'image_size' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Template' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::CarouselTemplate` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::CarouselTemplate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'columns') + if (value = attributes[:'columns']).is_a?(Array) + self.columns = value + end + end + + if attributes.key?(:'image_aspect_ratio') + self.image_aspect_ratio = attributes[:'image_aspect_ratio'] + end + + if attributes.key?(:'image_size') + self.image_size = attributes[:'image_size'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + columns == o.columns && + image_aspect_ratio == o.image_aspect_ratio && + image_size == o.image_size && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [columns, image_aspect_ratio, image_size].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/carousel_template_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/carousel_template_all_of.rb new file mode 100644 index 00000000..d8db457d --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/carousel_template_all_of.rb @@ -0,0 +1,239 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class CarouselTemplateAllOf + attr_accessor :columns + + attr_accessor :image_aspect_ratio + + attr_accessor :image_size + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'columns' => :'columns', + :'image_aspect_ratio' => :'imageAspectRatio', + :'image_size' => :'imageSize' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'columns' => :'Array', + :'image_aspect_ratio' => :'String', + :'image_size' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::CarouselTemplateAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::CarouselTemplateAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'columns') + if (value = attributes[:'columns']).is_a?(Array) + self.columns = value + end + end + + if attributes.key?(:'image_aspect_ratio') + self.image_aspect_ratio = attributes[:'image_aspect_ratio'] + end + + if attributes.key?(:'image_size') + self.image_size = attributes[:'image_size'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + columns == o.columns && + image_aspect_ratio == o.image_aspect_ratio && + image_size == o.image_size + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [columns, image_aspect_ratio, image_size].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/chat_reference.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/chat_reference.rb new file mode 100644 index 00000000..f8dbd1d5 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/chat_reference.rb @@ -0,0 +1,228 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + # Chat reference + class ChatReference + # The target user ID + attr_accessor :user_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'user_id' => :'userId' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'user_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::ChatReference` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::ChatReference`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'user_id') + self.user_id = attributes[:'user_id'] + else + self.user_id = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @user_id.nil? + invalid_properties.push('invalid value for "user_id", user_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @user_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + user_id == o.user_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [user_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/confirm_template.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/confirm_template.rb new file mode 100644 index 00000000..f5875fed --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/confirm_template.rb @@ -0,0 +1,241 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class ConfirmTemplate < Template + attr_accessor :text + + attr_accessor :actions + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'text' => :'text', + :'actions' => :'actions' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'text' => :'String', + :'actions' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Template' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::ConfirmTemplate` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::ConfirmTemplate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'text') + self.text = attributes[:'text'] + end + + if attributes.key?(:'actions') + if (value = attributes[:'actions']).is_a?(Array) + self.actions = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + text == o.text && + actions == o.actions && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [text, actions].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/confirm_template_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/confirm_template_all_of.rb new file mode 100644 index 00000000..d90218c7 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/confirm_template_all_of.rb @@ -0,0 +1,230 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class ConfirmTemplateAllOf + attr_accessor :text + + attr_accessor :actions + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'text' => :'text', + :'actions' => :'actions' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'text' => :'String', + :'actions' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::ConfirmTemplateAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::ConfirmTemplateAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'text') + self.text = attributes[:'text'] + end + + if attributes.key?(:'actions') + if (value = attributes[:'actions']).is_a?(Array) + self.actions = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + text == o.text && + actions == o.actions + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [text, actions].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/create_rich_menu_alias_request.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/create_rich_menu_alias_request.rb new file mode 100644 index 00000000..d8a40119 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/create_rich_menu_alias_request.rb @@ -0,0 +1,283 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class CreateRichMenuAliasRequest + # Rich menu alias ID, which can be any ID, unique for each channel. + attr_accessor :rich_menu_alias_id + + # The rich menu ID to be associated with the rich menu alias. + attr_accessor :rich_menu_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'rich_menu_alias_id' => :'richMenuAliasId', + :'rich_menu_id' => :'richMenuId' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'rich_menu_alias_id' => :'String', + :'rich_menu_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::CreateRichMenuAliasRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::CreateRichMenuAliasRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'rich_menu_alias_id') + self.rich_menu_alias_id = attributes[:'rich_menu_alias_id'] + else + self.rich_menu_alias_id = nil + end + + if attributes.key?(:'rich_menu_id') + self.rich_menu_id = attributes[:'rich_menu_id'] + else + self.rich_menu_id = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @rich_menu_alias_id.nil? + invalid_properties.push('invalid value for "rich_menu_alias_id", rich_menu_alias_id cannot be nil.') + end + + if @rich_menu_alias_id.to_s.length > 32 + invalid_properties.push('invalid value for "rich_menu_alias_id", the character length must be smaller than or equal to 32.') + end + + if @rich_menu_alias_id.to_s.length < 1 + invalid_properties.push('invalid value for "rich_menu_alias_id", the character length must be great than or equal to 1.') + end + + pattern = Regexp.new(/^[a-z0-9_-]{1,32}$/) + if @rich_menu_alias_id !~ pattern + invalid_properties.push("invalid value for \"rich_menu_alias_id\", must conform to the pattern #{pattern}.") + end + + if @rich_menu_id.nil? + invalid_properties.push('invalid value for "rich_menu_id", rich_menu_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @rich_menu_alias_id.nil? + return false if @rich_menu_alias_id.to_s.length > 32 + return false if @rich_menu_alias_id.to_s.length < 1 + return false if @rich_menu_alias_id !~ Regexp.new(/^[a-z0-9_-]{1,32}$/) + return false if @rich_menu_id.nil? + true + end + + # Custom attribute writer method with validation + # @param [Object] rich_menu_alias_id Value to be assigned + def rich_menu_alias_id=(rich_menu_alias_id) + if rich_menu_alias_id.nil? + fail ArgumentError, 'rich_menu_alias_id cannot be nil' + end + + if rich_menu_alias_id.to_s.length > 32 + fail ArgumentError, 'invalid value for "rich_menu_alias_id", the character length must be smaller than or equal to 32.' + end + + if rich_menu_alias_id.to_s.length < 1 + fail ArgumentError, 'invalid value for "rich_menu_alias_id", the character length must be great than or equal to 1.' + end + + pattern = Regexp.new(/^[a-z0-9_-]{1,32}$/) + if rich_menu_alias_id !~ pattern + fail ArgumentError, "invalid value for \"rich_menu_alias_id\", must conform to the pattern #{pattern}." + end + + @rich_menu_alias_id = rich_menu_alias_id + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + rich_menu_alias_id == o.rich_menu_alias_id && + rich_menu_id == o.rich_menu_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [rich_menu_alias_id, rich_menu_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/datetime_picker_action.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/datetime_picker_action.rb new file mode 100644 index 00000000..db55c516 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/datetime_picker_action.rb @@ -0,0 +1,328 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class DatetimePickerAction < Action + attr_accessor :data + + attr_accessor :mode + + attr_accessor :initial + + attr_accessor :max + + attr_accessor :min + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data', + :'mode' => :'mode', + :'initial' => :'initial', + :'max' => :'max', + :'min' => :'min' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'String', + :'mode' => :'String', + :'initial' => :'String', + :'max' => :'String', + :'min' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Action' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::DatetimePickerAction` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::DatetimePickerAction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'mode') + self.mode = attributes[:'mode'] + end + + if attributes.key?(:'initial') + self.initial = attributes[:'initial'] + end + + if attributes.key?(:'max') + self.max = attributes[:'max'] + end + + if attributes.key?(:'min') + self.min = attributes[:'min'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if !@data.nil? && @data.to_s.length > 300 + invalid_properties.push('invalid value for "data", the character length must be smaller than or equal to 300.') + end + + if !@data.nil? && @data.to_s.length < 0 + invalid_properties.push('invalid value for "data", the character length must be great than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@data.nil? && @data.to_s.length > 300 + return false if !@data.nil? && @data.to_s.length < 0 + mode_validator = EnumAttributeValidator.new('String', ["date", "time", "datetime"]) + return false unless mode_validator.valid?(@mode) + true && super + end + + # Custom attribute writer method with validation + # @param [Object] data Value to be assigned + def data=(data) + if data.nil? + fail ArgumentError, 'data cannot be nil' + end + + if data.to_s.length > 300 + fail ArgumentError, 'invalid value for "data", the character length must be smaller than or equal to 300.' + end + + if data.to_s.length < 0 + fail ArgumentError, 'invalid value for "data", the character length must be great than or equal to 0.' + end + + @data = data + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] mode Object to be assigned + def mode=(mode) + validator = EnumAttributeValidator.new('String', ["date", "time", "datetime"]) + unless validator.valid?(mode) + fail ArgumentError, "invalid value for \"mode\", must be one of #{validator.allowable_values}." + end + @mode = mode + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + mode == o.mode && + initial == o.initial && + max == o.max && + min == o.min && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data, mode, initial, max, min].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/datetime_picker_action_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/datetime_picker_action_all_of.rb new file mode 100644 index 00000000..87f8346f --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/datetime_picker_action_all_of.rb @@ -0,0 +1,313 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class DatetimePickerActionAllOf + attr_accessor :data + + attr_accessor :mode + + attr_accessor :initial + + attr_accessor :max + + attr_accessor :min + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data', + :'mode' => :'mode', + :'initial' => :'initial', + :'max' => :'max', + :'min' => :'min' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'String', + :'mode' => :'String', + :'initial' => :'String', + :'max' => :'String', + :'min' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::DatetimePickerActionAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::DatetimePickerActionAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'mode') + self.mode = attributes[:'mode'] + end + + if attributes.key?(:'initial') + self.initial = attributes[:'initial'] + end + + if attributes.key?(:'max') + self.max = attributes[:'max'] + end + + if attributes.key?(:'min') + self.min = attributes[:'min'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@data.nil? && @data.to_s.length > 300 + invalid_properties.push('invalid value for "data", the character length must be smaller than or equal to 300.') + end + + if !@data.nil? && @data.to_s.length < 0 + invalid_properties.push('invalid value for "data", the character length must be great than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@data.nil? && @data.to_s.length > 300 + return false if !@data.nil? && @data.to_s.length < 0 + mode_validator = EnumAttributeValidator.new('String', ["date", "time", "datetime"]) + return false unless mode_validator.valid?(@mode) + true + end + + # Custom attribute writer method with validation + # @param [Object] data Value to be assigned + def data=(data) + if !data.nil? && data.to_s.length > 300 + fail ArgumentError, 'invalid value for "data", the character length must be smaller than or equal to 300.' + end + + if !data.nil? && data.to_s.length < 0 + fail ArgumentError, 'invalid value for "data", the character length must be great than or equal to 0.' + end + + @data = data + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] mode Object to be assigned + def mode=(mode) + validator = EnumAttributeValidator.new('String', ["date", "time", "datetime"]) + unless validator.valid?(mode) + fail ArgumentError, "invalid value for \"mode\", must be one of #{validator.allowable_values}." + end + @mode = mode + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + mode == o.mode && + initial == o.initial && + max == o.max && + min == o.min + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data, mode, initial, max, min].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/demographic_filter.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/demographic_filter.rb new file mode 100644 index 00000000..27e6d951 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/demographic_filter.rb @@ -0,0 +1,226 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + # Demographic filter + class DemographicFilter + # Type of demographic filter + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # discriminator's property name in OpenAPI v3 + def self.openapi_discriminator_name + :'type' + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::DemographicFilter` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::DemographicFilter`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/emoji.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/emoji.rb new file mode 100644 index 00000000..ecb1c37e --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/emoji.rb @@ -0,0 +1,237 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class Emoji + attr_accessor :index + + attr_accessor :product_id + + attr_accessor :emoji_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'index' => :'index', + :'product_id' => :'productId', + :'emoji_id' => :'emojiId' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'index' => :'Integer', + :'product_id' => :'String', + :'emoji_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::Emoji` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::Emoji`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'index') + self.index = attributes[:'index'] + end + + if attributes.key?(:'product_id') + self.product_id = attributes[:'product_id'] + end + + if attributes.key?(:'emoji_id') + self.emoji_id = attributes[:'emoji_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + index == o.index && + product_id == o.product_id && + emoji_id == o.emoji_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [index, product_id, emoji_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/error_detail.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/error_detail.rb new file mode 100644 index 00000000..e77ff3e1 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/error_detail.rb @@ -0,0 +1,230 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class ErrorDetail + # Details of the error. Not included in the response under certain situations. + attr_accessor :message + + # Location of where the error occurred. Returns the JSON field name or query parameter name of the request. Not included in the response under certain situations. + attr_accessor :property + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'message' => :'message', + :'property' => :'property' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'message' => :'String', + :'property' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::ErrorDetail` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::ErrorDetail`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + + if attributes.key?(:'property') + self.property = attributes[:'property'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + message == o.message && + property == o.property + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [message, property].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/error_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/error_response.rb new file mode 100644 index 00000000..42735b0e --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/error_response.rb @@ -0,0 +1,279 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class ErrorResponse + # Message containing information about the error. + attr_accessor :message + + # An array of error details. If the array is empty, this property will not be included in the response. + attr_accessor :details + + # Array of sent messages. + attr_accessor :sent_messages + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'message' => :'message', + :'details' => :'details', + :'sent_messages' => :'sentMessages' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'message' => :'String', + :'details' => :'Array', + :'sent_messages' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::ErrorResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::ErrorResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'message') + self.message = attributes[:'message'] + else + self.message = nil + end + + if attributes.key?(:'details') + if (value = attributes[:'details']).is_a?(Array) + self.details = value + end + end + + if attributes.key?(:'sent_messages') + if (value = attributes[:'sent_messages']).is_a?(Array) + self.sent_messages = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @message.nil? + invalid_properties.push('invalid value for "message", message cannot be nil.') + end + + if !@sent_messages.nil? && @sent_messages.length > 5 + invalid_properties.push('invalid value for "sent_messages", number of items must be less than or equal to 5.') + end + + if !@sent_messages.nil? && @sent_messages.length < 1 + invalid_properties.push('invalid value for "sent_messages", number of items must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @message.nil? + return false if !@sent_messages.nil? && @sent_messages.length > 5 + return false if !@sent_messages.nil? && @sent_messages.length < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] sent_messages Value to be assigned + def sent_messages=(sent_messages) + if sent_messages.nil? + fail ArgumentError, 'sent_messages cannot be nil' + end + + if sent_messages.length > 5 + fail ArgumentError, 'invalid value for "sent_messages", number of items must be less than or equal to 5.' + end + + if sent_messages.length < 1 + fail ArgumentError, 'invalid value for "sent_messages", number of items must be greater than or equal to 1.' + end + + @sent_messages = sent_messages + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + message == o.message && + details == o.details && + sent_messages == o.sent_messages + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [message, details, sent_messages].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/filter.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/filter.rb new file mode 100644 index 00000000..88238936 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/filter.rb @@ -0,0 +1,220 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + # Filter for narrowcast + class Filter + attr_accessor :demographic + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'demographic' => :'demographic' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'demographic' => :'DemographicFilter' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::Filter` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::Filter`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'demographic') + self.demographic = attributes[:'demographic'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + demographic == o.demographic + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [demographic].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_block_style.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_block_style.rb new file mode 100644 index 00000000..656d6c50 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_block_style.rb @@ -0,0 +1,237 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexBlockStyle + attr_accessor :background_color + + attr_accessor :separator + + attr_accessor :separator_color + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'background_color' => :'backgroundColor', + :'separator' => :'separator', + :'separator_color' => :'separatorColor' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'background_color' => :'String', + :'separator' => :'Boolean', + :'separator_color' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexBlockStyle` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexBlockStyle`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'background_color') + self.background_color = attributes[:'background_color'] + end + + if attributes.key?(:'separator') + self.separator = attributes[:'separator'] + end + + if attributes.key?(:'separator_color') + self.separator_color = attributes[:'separator_color'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + background_color == o.background_color && + separator == o.separator && + separator_color == o.separator_color + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [background_color, separator, separator_color].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_box.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_box.rb new file mode 100644 index 00000000..96c2ef93 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_box.rb @@ -0,0 +1,536 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexBox < FlexComponent + attr_accessor :layout + + attr_accessor :flex + + attr_accessor :contents + + attr_accessor :spacing + + attr_accessor :margin + + attr_accessor :position + + attr_accessor :offset_top + + attr_accessor :offset_bottom + + attr_accessor :offset_start + + attr_accessor :offset_end + + attr_accessor :background_color + + attr_accessor :border_color + + attr_accessor :border_width + + attr_accessor :corner_radius + + attr_accessor :width + + attr_accessor :max_width + + attr_accessor :height + + attr_accessor :max_height + + attr_accessor :padding_all + + attr_accessor :padding_top + + attr_accessor :padding_bottom + + attr_accessor :padding_start + + attr_accessor :padding_end + + attr_accessor :action + + attr_accessor :justify_content + + attr_accessor :align_items + + attr_accessor :background + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'layout' => :'layout', + :'flex' => :'flex', + :'contents' => :'contents', + :'spacing' => :'spacing', + :'margin' => :'margin', + :'position' => :'position', + :'offset_top' => :'offsetTop', + :'offset_bottom' => :'offsetBottom', + :'offset_start' => :'offsetStart', + :'offset_end' => :'offsetEnd', + :'background_color' => :'backgroundColor', + :'border_color' => :'borderColor', + :'border_width' => :'borderWidth', + :'corner_radius' => :'cornerRadius', + :'width' => :'width', + :'max_width' => :'maxWidth', + :'height' => :'height', + :'max_height' => :'maxHeight', + :'padding_all' => :'paddingAll', + :'padding_top' => :'paddingTop', + :'padding_bottom' => :'paddingBottom', + :'padding_start' => :'paddingStart', + :'padding_end' => :'paddingEnd', + :'action' => :'action', + :'justify_content' => :'justifyContent', + :'align_items' => :'alignItems', + :'background' => :'background' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'layout' => :'String', + :'flex' => :'Integer', + :'contents' => :'Array', + :'spacing' => :'String', + :'margin' => :'String', + :'position' => :'String', + :'offset_top' => :'String', + :'offset_bottom' => :'String', + :'offset_start' => :'String', + :'offset_end' => :'String', + :'background_color' => :'String', + :'border_color' => :'String', + :'border_width' => :'String', + :'corner_radius' => :'String', + :'width' => :'String', + :'max_width' => :'String', + :'height' => :'String', + :'max_height' => :'String', + :'padding_all' => :'String', + :'padding_top' => :'String', + :'padding_bottom' => :'String', + :'padding_start' => :'String', + :'padding_end' => :'String', + :'action' => :'Action', + :'justify_content' => :'String', + :'align_items' => :'String', + :'background' => :'FlexBoxBackground' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'FlexComponent' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexBox` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexBox`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'layout') + self.layout = attributes[:'layout'] + end + + if attributes.key?(:'flex') + self.flex = attributes[:'flex'] + end + + if attributes.key?(:'contents') + if (value = attributes[:'contents']).is_a?(Array) + self.contents = value + end + end + + if attributes.key?(:'spacing') + self.spacing = attributes[:'spacing'] + end + + if attributes.key?(:'margin') + self.margin = attributes[:'margin'] + end + + if attributes.key?(:'position') + self.position = attributes[:'position'] + end + + if attributes.key?(:'offset_top') + self.offset_top = attributes[:'offset_top'] + end + + if attributes.key?(:'offset_bottom') + self.offset_bottom = attributes[:'offset_bottom'] + end + + if attributes.key?(:'offset_start') + self.offset_start = attributes[:'offset_start'] + end + + if attributes.key?(:'offset_end') + self.offset_end = attributes[:'offset_end'] + end + + if attributes.key?(:'background_color') + self.background_color = attributes[:'background_color'] + end + + if attributes.key?(:'border_color') + self.border_color = attributes[:'border_color'] + end + + if attributes.key?(:'border_width') + self.border_width = attributes[:'border_width'] + end + + if attributes.key?(:'corner_radius') + self.corner_radius = attributes[:'corner_radius'] + end + + if attributes.key?(:'width') + self.width = attributes[:'width'] + end + + if attributes.key?(:'max_width') + self.max_width = attributes[:'max_width'] + end + + if attributes.key?(:'height') + self.height = attributes[:'height'] + end + + if attributes.key?(:'max_height') + self.max_height = attributes[:'max_height'] + end + + if attributes.key?(:'padding_all') + self.padding_all = attributes[:'padding_all'] + end + + if attributes.key?(:'padding_top') + self.padding_top = attributes[:'padding_top'] + end + + if attributes.key?(:'padding_bottom') + self.padding_bottom = attributes[:'padding_bottom'] + end + + if attributes.key?(:'padding_start') + self.padding_start = attributes[:'padding_start'] + end + + if attributes.key?(:'padding_end') + self.padding_end = attributes[:'padding_end'] + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + + if attributes.key?(:'justify_content') + self.justify_content = attributes[:'justify_content'] + end + + if attributes.key?(:'align_items') + self.align_items = attributes[:'align_items'] + end + + if attributes.key?(:'background') + self.background = attributes[:'background'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + layout_validator = EnumAttributeValidator.new('String', ["horizontal", "vertical", "baseline"]) + return false unless layout_validator.valid?(@layout) + position_validator = EnumAttributeValidator.new('String', ["relative", "absolute"]) + return false unless position_validator.valid?(@position) + justify_content_validator = EnumAttributeValidator.new('String', ["center", "flex-start", "flex-end", "space-between", "space-around", "space-evenly"]) + return false unless justify_content_validator.valid?(@justify_content) + align_items_validator = EnumAttributeValidator.new('String', ["center", "flex-start", "flex-end"]) + return false unless align_items_validator.valid?(@align_items) + true && super + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] layout Object to be assigned + def layout=(layout) + validator = EnumAttributeValidator.new('String', ["horizontal", "vertical", "baseline"]) + unless validator.valid?(layout) + fail ArgumentError, "invalid value for \"layout\", must be one of #{validator.allowable_values}." + end + @layout = layout + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] position Object to be assigned + def position=(position) + validator = EnumAttributeValidator.new('String', ["relative", "absolute"]) + unless validator.valid?(position) + fail ArgumentError, "invalid value for \"position\", must be one of #{validator.allowable_values}." + end + @position = position + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] justify_content Object to be assigned + def justify_content=(justify_content) + validator = EnumAttributeValidator.new('String', ["center", "flex-start", "flex-end", "space-between", "space-around", "space-evenly"]) + unless validator.valid?(justify_content) + fail ArgumentError, "invalid value for \"justify_content\", must be one of #{validator.allowable_values}." + end + @justify_content = justify_content + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] align_items Object to be assigned + def align_items=(align_items) + validator = EnumAttributeValidator.new('String', ["center", "flex-start", "flex-end"]) + unless validator.valid?(align_items) + fail ArgumentError, "invalid value for \"align_items\", must be one of #{validator.allowable_values}." + end + @align_items = align_items + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + layout == o.layout && + flex == o.flex && + contents == o.contents && + spacing == o.spacing && + margin == o.margin && + position == o.position && + offset_top == o.offset_top && + offset_bottom == o.offset_bottom && + offset_start == o.offset_start && + offset_end == o.offset_end && + background_color == o.background_color && + border_color == o.border_color && + border_width == o.border_width && + corner_radius == o.corner_radius && + width == o.width && + max_width == o.max_width && + height == o.height && + max_height == o.max_height && + padding_all == o.padding_all && + padding_top == o.padding_top && + padding_bottom == o.padding_bottom && + padding_start == o.padding_start && + padding_end == o.padding_end && + action == o.action && + justify_content == o.justify_content && + align_items == o.align_items && + background == o.background && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [layout, flex, contents, spacing, margin, position, offset_top, offset_bottom, offset_start, offset_end, background_color, border_color, border_width, corner_radius, width, max_width, height, max_height, padding_all, padding_top, padding_bottom, padding_start, padding_end, action, justify_content, align_items, background].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_box_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_box_all_of.rb new file mode 100644 index 00000000..47eaa632 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_box_all_of.rb @@ -0,0 +1,525 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexBoxAllOf + attr_accessor :layout + + attr_accessor :flex + + attr_accessor :contents + + attr_accessor :spacing + + attr_accessor :margin + + attr_accessor :position + + attr_accessor :offset_top + + attr_accessor :offset_bottom + + attr_accessor :offset_start + + attr_accessor :offset_end + + attr_accessor :background_color + + attr_accessor :border_color + + attr_accessor :border_width + + attr_accessor :corner_radius + + attr_accessor :width + + attr_accessor :max_width + + attr_accessor :height + + attr_accessor :max_height + + attr_accessor :padding_all + + attr_accessor :padding_top + + attr_accessor :padding_bottom + + attr_accessor :padding_start + + attr_accessor :padding_end + + attr_accessor :action + + attr_accessor :justify_content + + attr_accessor :align_items + + attr_accessor :background + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'layout' => :'layout', + :'flex' => :'flex', + :'contents' => :'contents', + :'spacing' => :'spacing', + :'margin' => :'margin', + :'position' => :'position', + :'offset_top' => :'offsetTop', + :'offset_bottom' => :'offsetBottom', + :'offset_start' => :'offsetStart', + :'offset_end' => :'offsetEnd', + :'background_color' => :'backgroundColor', + :'border_color' => :'borderColor', + :'border_width' => :'borderWidth', + :'corner_radius' => :'cornerRadius', + :'width' => :'width', + :'max_width' => :'maxWidth', + :'height' => :'height', + :'max_height' => :'maxHeight', + :'padding_all' => :'paddingAll', + :'padding_top' => :'paddingTop', + :'padding_bottom' => :'paddingBottom', + :'padding_start' => :'paddingStart', + :'padding_end' => :'paddingEnd', + :'action' => :'action', + :'justify_content' => :'justifyContent', + :'align_items' => :'alignItems', + :'background' => :'background' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'layout' => :'String', + :'flex' => :'Integer', + :'contents' => :'Array', + :'spacing' => :'String', + :'margin' => :'String', + :'position' => :'String', + :'offset_top' => :'String', + :'offset_bottom' => :'String', + :'offset_start' => :'String', + :'offset_end' => :'String', + :'background_color' => :'String', + :'border_color' => :'String', + :'border_width' => :'String', + :'corner_radius' => :'String', + :'width' => :'String', + :'max_width' => :'String', + :'height' => :'String', + :'max_height' => :'String', + :'padding_all' => :'String', + :'padding_top' => :'String', + :'padding_bottom' => :'String', + :'padding_start' => :'String', + :'padding_end' => :'String', + :'action' => :'Action', + :'justify_content' => :'String', + :'align_items' => :'String', + :'background' => :'FlexBoxBackground' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexBoxAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexBoxAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'layout') + self.layout = attributes[:'layout'] + end + + if attributes.key?(:'flex') + self.flex = attributes[:'flex'] + end + + if attributes.key?(:'contents') + if (value = attributes[:'contents']).is_a?(Array) + self.contents = value + end + end + + if attributes.key?(:'spacing') + self.spacing = attributes[:'spacing'] + end + + if attributes.key?(:'margin') + self.margin = attributes[:'margin'] + end + + if attributes.key?(:'position') + self.position = attributes[:'position'] + end + + if attributes.key?(:'offset_top') + self.offset_top = attributes[:'offset_top'] + end + + if attributes.key?(:'offset_bottom') + self.offset_bottom = attributes[:'offset_bottom'] + end + + if attributes.key?(:'offset_start') + self.offset_start = attributes[:'offset_start'] + end + + if attributes.key?(:'offset_end') + self.offset_end = attributes[:'offset_end'] + end + + if attributes.key?(:'background_color') + self.background_color = attributes[:'background_color'] + end + + if attributes.key?(:'border_color') + self.border_color = attributes[:'border_color'] + end + + if attributes.key?(:'border_width') + self.border_width = attributes[:'border_width'] + end + + if attributes.key?(:'corner_radius') + self.corner_radius = attributes[:'corner_radius'] + end + + if attributes.key?(:'width') + self.width = attributes[:'width'] + end + + if attributes.key?(:'max_width') + self.max_width = attributes[:'max_width'] + end + + if attributes.key?(:'height') + self.height = attributes[:'height'] + end + + if attributes.key?(:'max_height') + self.max_height = attributes[:'max_height'] + end + + if attributes.key?(:'padding_all') + self.padding_all = attributes[:'padding_all'] + end + + if attributes.key?(:'padding_top') + self.padding_top = attributes[:'padding_top'] + end + + if attributes.key?(:'padding_bottom') + self.padding_bottom = attributes[:'padding_bottom'] + end + + if attributes.key?(:'padding_start') + self.padding_start = attributes[:'padding_start'] + end + + if attributes.key?(:'padding_end') + self.padding_end = attributes[:'padding_end'] + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + + if attributes.key?(:'justify_content') + self.justify_content = attributes[:'justify_content'] + end + + if attributes.key?(:'align_items') + self.align_items = attributes[:'align_items'] + end + + if attributes.key?(:'background') + self.background = attributes[:'background'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + layout_validator = EnumAttributeValidator.new('String', ["horizontal", "vertical", "baseline"]) + return false unless layout_validator.valid?(@layout) + position_validator = EnumAttributeValidator.new('String', ["relative", "absolute"]) + return false unless position_validator.valid?(@position) + justify_content_validator = EnumAttributeValidator.new('String', ["center", "flex-start", "flex-end", "space-between", "space-around", "space-evenly"]) + return false unless justify_content_validator.valid?(@justify_content) + align_items_validator = EnumAttributeValidator.new('String', ["center", "flex-start", "flex-end"]) + return false unless align_items_validator.valid?(@align_items) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] layout Object to be assigned + def layout=(layout) + validator = EnumAttributeValidator.new('String', ["horizontal", "vertical", "baseline"]) + unless validator.valid?(layout) + fail ArgumentError, "invalid value for \"layout\", must be one of #{validator.allowable_values}." + end + @layout = layout + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] position Object to be assigned + def position=(position) + validator = EnumAttributeValidator.new('String', ["relative", "absolute"]) + unless validator.valid?(position) + fail ArgumentError, "invalid value for \"position\", must be one of #{validator.allowable_values}." + end + @position = position + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] justify_content Object to be assigned + def justify_content=(justify_content) + validator = EnumAttributeValidator.new('String', ["center", "flex-start", "flex-end", "space-between", "space-around", "space-evenly"]) + unless validator.valid?(justify_content) + fail ArgumentError, "invalid value for \"justify_content\", must be one of #{validator.allowable_values}." + end + @justify_content = justify_content + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] align_items Object to be assigned + def align_items=(align_items) + validator = EnumAttributeValidator.new('String', ["center", "flex-start", "flex-end"]) + unless validator.valid?(align_items) + fail ArgumentError, "invalid value for \"align_items\", must be one of #{validator.allowable_values}." + end + @align_items = align_items + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + layout == o.layout && + flex == o.flex && + contents == o.contents && + spacing == o.spacing && + margin == o.margin && + position == o.position && + offset_top == o.offset_top && + offset_bottom == o.offset_bottom && + offset_start == o.offset_start && + offset_end == o.offset_end && + background_color == o.background_color && + border_color == o.border_color && + border_width == o.border_width && + corner_radius == o.corner_radius && + width == o.width && + max_width == o.max_width && + height == o.height && + max_height == o.max_height && + padding_all == o.padding_all && + padding_top == o.padding_top && + padding_bottom == o.padding_bottom && + padding_start == o.padding_start && + padding_end == o.padding_end && + action == o.action && + justify_content == o.justify_content && + align_items == o.align_items && + background == o.background + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [layout, flex, contents, spacing, margin, position, offset_top, offset_bottom, offset_start, offset_end, background_color, border_color, border_width, corner_radius, width, max_width, height, max_height, padding_all, padding_top, padding_bottom, padding_start, padding_end, action, justify_content, align_items, background].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_box_background.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_box_background.rb new file mode 100644 index 00000000..f074df3c --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_box_background.rb @@ -0,0 +1,231 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexBoxBackground + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # discriminator's property name in OpenAPI v3 + def self.openapi_discriminator_name + :'type' + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexBoxBackground` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexBoxBackground`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @type.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_box_linear_gradient.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_box_linear_gradient.rb new file mode 100644 index 00000000..dd9354a5 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_box_linear_gradient.rb @@ -0,0 +1,266 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexBoxLinearGradient < FlexBoxBackground + attr_accessor :angle + + attr_accessor :start_color + + attr_accessor :end_color + + attr_accessor :center_color + + attr_accessor :center_position + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'angle' => :'angle', + :'start_color' => :'startColor', + :'end_color' => :'endColor', + :'center_color' => :'centerColor', + :'center_position' => :'centerPosition' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'angle' => :'String', + :'start_color' => :'String', + :'end_color' => :'String', + :'center_color' => :'String', + :'center_position' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'FlexBoxBackground' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexBoxLinearGradient` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexBoxLinearGradient`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'angle') + self.angle = attributes[:'angle'] + end + + if attributes.key?(:'start_color') + self.start_color = attributes[:'start_color'] + end + + if attributes.key?(:'end_color') + self.end_color = attributes[:'end_color'] + end + + if attributes.key?(:'center_color') + self.center_color = attributes[:'center_color'] + end + + if attributes.key?(:'center_position') + self.center_position = attributes[:'center_position'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + angle == o.angle && + start_color == o.start_color && + end_color == o.end_color && + center_color == o.center_color && + center_position == o.center_position && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [angle, start_color, end_color, center_color, center_position].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_box_linear_gradient_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_box_linear_gradient_all_of.rb new file mode 100644 index 00000000..1ee1ccfe --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_box_linear_gradient_all_of.rb @@ -0,0 +1,255 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexBoxLinearGradientAllOf + attr_accessor :angle + + attr_accessor :start_color + + attr_accessor :end_color + + attr_accessor :center_color + + attr_accessor :center_position + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'angle' => :'angle', + :'start_color' => :'startColor', + :'end_color' => :'endColor', + :'center_color' => :'centerColor', + :'center_position' => :'centerPosition' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'angle' => :'String', + :'start_color' => :'String', + :'end_color' => :'String', + :'center_color' => :'String', + :'center_position' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexBoxLinearGradientAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexBoxLinearGradientAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'angle') + self.angle = attributes[:'angle'] + end + + if attributes.key?(:'start_color') + self.start_color = attributes[:'start_color'] + end + + if attributes.key?(:'end_color') + self.end_color = attributes[:'end_color'] + end + + if attributes.key?(:'center_color') + self.center_color = attributes[:'center_color'] + end + + if attributes.key?(:'center_position') + self.center_position = attributes[:'center_position'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + angle == o.angle && + start_color == o.start_color && + end_color == o.end_color && + center_color == o.center_color && + center_position == o.center_position + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [angle, start_color, end_color, center_color, center_position].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_bubble.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_bubble.rb new file mode 100644 index 00000000..184bd7d9 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_bubble.rb @@ -0,0 +1,339 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexBubble < FlexContainer + attr_accessor :direction + + attr_accessor :styles + + attr_accessor :header + + attr_accessor :hero + + attr_accessor :body + + attr_accessor :footer + + attr_accessor :size + + attr_accessor :action + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'direction' => :'direction', + :'styles' => :'styles', + :'header' => :'header', + :'hero' => :'hero', + :'body' => :'body', + :'footer' => :'footer', + :'size' => :'size', + :'action' => :'action' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'direction' => :'String', + :'styles' => :'FlexBubbleStyles', + :'header' => :'FlexBox', + :'hero' => :'FlexComponent', + :'body' => :'FlexBox', + :'footer' => :'FlexBox', + :'size' => :'String', + :'action' => :'Action' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'FlexContainer' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexBubble` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexBubble`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'direction') + self.direction = attributes[:'direction'] + end + + if attributes.key?(:'styles') + self.styles = attributes[:'styles'] + end + + if attributes.key?(:'header') + self.header = attributes[:'header'] + end + + if attributes.key?(:'hero') + self.hero = attributes[:'hero'] + end + + if attributes.key?(:'body') + self.body = attributes[:'body'] + end + + if attributes.key?(:'footer') + self.footer = attributes[:'footer'] + end + + if attributes.key?(:'size') + self.size = attributes[:'size'] + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + direction_validator = EnumAttributeValidator.new('String', ["ltr", "rtl"]) + return false unless direction_validator.valid?(@direction) + size_validator = EnumAttributeValidator.new('String', ["nano", "micro", "deca", "hecto", "kilo", "mega", "giga"]) + return false unless size_validator.valid?(@size) + true && super + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] direction Object to be assigned + def direction=(direction) + validator = EnumAttributeValidator.new('String', ["ltr", "rtl"]) + unless validator.valid?(direction) + fail ArgumentError, "invalid value for \"direction\", must be one of #{validator.allowable_values}." + end + @direction = direction + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] size Object to be assigned + def size=(size) + validator = EnumAttributeValidator.new('String', ["nano", "micro", "deca", "hecto", "kilo", "mega", "giga"]) + unless validator.valid?(size) + fail ArgumentError, "invalid value for \"size\", must be one of #{validator.allowable_values}." + end + @size = size + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + direction == o.direction && + styles == o.styles && + header == o.header && + hero == o.hero && + body == o.body && + footer == o.footer && + size == o.size && + action == o.action && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [direction, styles, header, hero, body, footer, size, action].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_bubble_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_bubble_all_of.rb new file mode 100644 index 00000000..a46644ca --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_bubble_all_of.rb @@ -0,0 +1,328 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexBubbleAllOf + attr_accessor :direction + + attr_accessor :styles + + attr_accessor :header + + attr_accessor :hero + + attr_accessor :body + + attr_accessor :footer + + attr_accessor :size + + attr_accessor :action + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'direction' => :'direction', + :'styles' => :'styles', + :'header' => :'header', + :'hero' => :'hero', + :'body' => :'body', + :'footer' => :'footer', + :'size' => :'size', + :'action' => :'action' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'direction' => :'String', + :'styles' => :'FlexBubbleStyles', + :'header' => :'FlexBox', + :'hero' => :'FlexComponent', + :'body' => :'FlexBox', + :'footer' => :'FlexBox', + :'size' => :'String', + :'action' => :'Action' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexBubbleAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexBubbleAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'direction') + self.direction = attributes[:'direction'] + end + + if attributes.key?(:'styles') + self.styles = attributes[:'styles'] + end + + if attributes.key?(:'header') + self.header = attributes[:'header'] + end + + if attributes.key?(:'hero') + self.hero = attributes[:'hero'] + end + + if attributes.key?(:'body') + self.body = attributes[:'body'] + end + + if attributes.key?(:'footer') + self.footer = attributes[:'footer'] + end + + if attributes.key?(:'size') + self.size = attributes[:'size'] + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + direction_validator = EnumAttributeValidator.new('String', ["ltr", "rtl"]) + return false unless direction_validator.valid?(@direction) + size_validator = EnumAttributeValidator.new('String', ["nano", "micro", "deca", "hecto", "kilo", "mega", "giga"]) + return false unless size_validator.valid?(@size) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] direction Object to be assigned + def direction=(direction) + validator = EnumAttributeValidator.new('String', ["ltr", "rtl"]) + unless validator.valid?(direction) + fail ArgumentError, "invalid value for \"direction\", must be one of #{validator.allowable_values}." + end + @direction = direction + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] size Object to be assigned + def size=(size) + validator = EnumAttributeValidator.new('String', ["nano", "micro", "deca", "hecto", "kilo", "mega", "giga"]) + unless validator.valid?(size) + fail ArgumentError, "invalid value for \"size\", must be one of #{validator.allowable_values}." + end + @size = size + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + direction == o.direction && + styles == o.styles && + header == o.header && + hero == o.hero && + body == o.body && + footer == o.footer && + size == o.size && + action == o.action + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [direction, styles, header, hero, body, footer, size, action].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_bubble_styles.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_bubble_styles.rb new file mode 100644 index 00000000..7ba3862a --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_bubble_styles.rb @@ -0,0 +1,246 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexBubbleStyles + attr_accessor :header + + attr_accessor :hero + + attr_accessor :body + + attr_accessor :footer + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'header' => :'header', + :'hero' => :'hero', + :'body' => :'body', + :'footer' => :'footer' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'header' => :'FlexBlockStyle', + :'hero' => :'FlexBlockStyle', + :'body' => :'FlexBlockStyle', + :'footer' => :'FlexBlockStyle' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexBubbleStyles` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexBubbleStyles`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'header') + self.header = attributes[:'header'] + end + + if attributes.key?(:'hero') + self.hero = attributes[:'hero'] + end + + if attributes.key?(:'body') + self.body = attributes[:'body'] + end + + if attributes.key?(:'footer') + self.footer = attributes[:'footer'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + header == o.header && + hero == o.hero && + body == o.body && + footer == o.footer + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [header, hero, body, footer].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_button.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_button.rb new file mode 100644 index 00000000..1477cd38 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_button.rb @@ -0,0 +1,429 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexButton < FlexComponent + attr_accessor :flex + + attr_accessor :color + + attr_accessor :style + + attr_accessor :action + + attr_accessor :gravity + + attr_accessor :margin + + attr_accessor :position + + attr_accessor :offset_top + + attr_accessor :offset_bottom + + attr_accessor :offset_start + + attr_accessor :offset_end + + attr_accessor :height + + attr_accessor :adjust_mode + + attr_accessor :scaling + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'flex' => :'flex', + :'color' => :'color', + :'style' => :'style', + :'action' => :'action', + :'gravity' => :'gravity', + :'margin' => :'margin', + :'position' => :'position', + :'offset_top' => :'offsetTop', + :'offset_bottom' => :'offsetBottom', + :'offset_start' => :'offsetStart', + :'offset_end' => :'offsetEnd', + :'height' => :'height', + :'adjust_mode' => :'adjustMode', + :'scaling' => :'scaling' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'flex' => :'Integer', + :'color' => :'String', + :'style' => :'String', + :'action' => :'Action', + :'gravity' => :'String', + :'margin' => :'String', + :'position' => :'String', + :'offset_top' => :'String', + :'offset_bottom' => :'String', + :'offset_start' => :'String', + :'offset_end' => :'String', + :'height' => :'String', + :'adjust_mode' => :'String', + :'scaling' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'FlexComponent' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexButton` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexButton`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'flex') + self.flex = attributes[:'flex'] + end + + if attributes.key?(:'color') + self.color = attributes[:'color'] + end + + if attributes.key?(:'style') + self.style = attributes[:'style'] + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + + if attributes.key?(:'gravity') + self.gravity = attributes[:'gravity'] + end + + if attributes.key?(:'margin') + self.margin = attributes[:'margin'] + end + + if attributes.key?(:'position') + self.position = attributes[:'position'] + end + + if attributes.key?(:'offset_top') + self.offset_top = attributes[:'offset_top'] + end + + if attributes.key?(:'offset_bottom') + self.offset_bottom = attributes[:'offset_bottom'] + end + + if attributes.key?(:'offset_start') + self.offset_start = attributes[:'offset_start'] + end + + if attributes.key?(:'offset_end') + self.offset_end = attributes[:'offset_end'] + end + + if attributes.key?(:'height') + self.height = attributes[:'height'] + end + + if attributes.key?(:'adjust_mode') + self.adjust_mode = attributes[:'adjust_mode'] + end + + if attributes.key?(:'scaling') + self.scaling = attributes[:'scaling'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + style_validator = EnumAttributeValidator.new('String', ["primary", "secondary", "link"]) + return false unless style_validator.valid?(@style) + gravity_validator = EnumAttributeValidator.new('String', ["top", "bottom", "center"]) + return false unless gravity_validator.valid?(@gravity) + position_validator = EnumAttributeValidator.new('String', ["relative", "absolute"]) + return false unless position_validator.valid?(@position) + height_validator = EnumAttributeValidator.new('String', ["md", "sm"]) + return false unless height_validator.valid?(@height) + adjust_mode_validator = EnumAttributeValidator.new('String', ["shrink-to-fit"]) + return false unless adjust_mode_validator.valid?(@adjust_mode) + true && super + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] style Object to be assigned + def style=(style) + validator = EnumAttributeValidator.new('String', ["primary", "secondary", "link"]) + unless validator.valid?(style) + fail ArgumentError, "invalid value for \"style\", must be one of #{validator.allowable_values}." + end + @style = style + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] gravity Object to be assigned + def gravity=(gravity) + validator = EnumAttributeValidator.new('String', ["top", "bottom", "center"]) + unless validator.valid?(gravity) + fail ArgumentError, "invalid value for \"gravity\", must be one of #{validator.allowable_values}." + end + @gravity = gravity + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] position Object to be assigned + def position=(position) + validator = EnumAttributeValidator.new('String', ["relative", "absolute"]) + unless validator.valid?(position) + fail ArgumentError, "invalid value for \"position\", must be one of #{validator.allowable_values}." + end + @position = position + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] height Object to be assigned + def height=(height) + validator = EnumAttributeValidator.new('String', ["md", "sm"]) + unless validator.valid?(height) + fail ArgumentError, "invalid value for \"height\", must be one of #{validator.allowable_values}." + end + @height = height + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] adjust_mode Object to be assigned + def adjust_mode=(adjust_mode) + validator = EnumAttributeValidator.new('String', ["shrink-to-fit"]) + unless validator.valid?(adjust_mode) + fail ArgumentError, "invalid value for \"adjust_mode\", must be one of #{validator.allowable_values}." + end + @adjust_mode = adjust_mode + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + flex == o.flex && + color == o.color && + style == o.style && + action == o.action && + gravity == o.gravity && + margin == o.margin && + position == o.position && + offset_top == o.offset_top && + offset_bottom == o.offset_bottom && + offset_start == o.offset_start && + offset_end == o.offset_end && + height == o.height && + adjust_mode == o.adjust_mode && + scaling == o.scaling && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [flex, color, style, action, gravity, margin, position, offset_top, offset_bottom, offset_start, offset_end, height, adjust_mode, scaling].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_button_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_button_all_of.rb new file mode 100644 index 00000000..be408496 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_button_all_of.rb @@ -0,0 +1,418 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexButtonAllOf + attr_accessor :flex + + attr_accessor :color + + attr_accessor :style + + attr_accessor :action + + attr_accessor :gravity + + attr_accessor :margin + + attr_accessor :position + + attr_accessor :offset_top + + attr_accessor :offset_bottom + + attr_accessor :offset_start + + attr_accessor :offset_end + + attr_accessor :height + + attr_accessor :adjust_mode + + attr_accessor :scaling + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'flex' => :'flex', + :'color' => :'color', + :'style' => :'style', + :'action' => :'action', + :'gravity' => :'gravity', + :'margin' => :'margin', + :'position' => :'position', + :'offset_top' => :'offsetTop', + :'offset_bottom' => :'offsetBottom', + :'offset_start' => :'offsetStart', + :'offset_end' => :'offsetEnd', + :'height' => :'height', + :'adjust_mode' => :'adjustMode', + :'scaling' => :'scaling' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'flex' => :'Integer', + :'color' => :'String', + :'style' => :'String', + :'action' => :'Action', + :'gravity' => :'String', + :'margin' => :'String', + :'position' => :'String', + :'offset_top' => :'String', + :'offset_bottom' => :'String', + :'offset_start' => :'String', + :'offset_end' => :'String', + :'height' => :'String', + :'adjust_mode' => :'String', + :'scaling' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexButtonAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexButtonAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'flex') + self.flex = attributes[:'flex'] + end + + if attributes.key?(:'color') + self.color = attributes[:'color'] + end + + if attributes.key?(:'style') + self.style = attributes[:'style'] + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + + if attributes.key?(:'gravity') + self.gravity = attributes[:'gravity'] + end + + if attributes.key?(:'margin') + self.margin = attributes[:'margin'] + end + + if attributes.key?(:'position') + self.position = attributes[:'position'] + end + + if attributes.key?(:'offset_top') + self.offset_top = attributes[:'offset_top'] + end + + if attributes.key?(:'offset_bottom') + self.offset_bottom = attributes[:'offset_bottom'] + end + + if attributes.key?(:'offset_start') + self.offset_start = attributes[:'offset_start'] + end + + if attributes.key?(:'offset_end') + self.offset_end = attributes[:'offset_end'] + end + + if attributes.key?(:'height') + self.height = attributes[:'height'] + end + + if attributes.key?(:'adjust_mode') + self.adjust_mode = attributes[:'adjust_mode'] + end + + if attributes.key?(:'scaling') + self.scaling = attributes[:'scaling'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + style_validator = EnumAttributeValidator.new('String', ["primary", "secondary", "link"]) + return false unless style_validator.valid?(@style) + gravity_validator = EnumAttributeValidator.new('String', ["top", "bottom", "center"]) + return false unless gravity_validator.valid?(@gravity) + position_validator = EnumAttributeValidator.new('String', ["relative", "absolute"]) + return false unless position_validator.valid?(@position) + height_validator = EnumAttributeValidator.new('String', ["md", "sm"]) + return false unless height_validator.valid?(@height) + adjust_mode_validator = EnumAttributeValidator.new('String', ["shrink-to-fit"]) + return false unless adjust_mode_validator.valid?(@adjust_mode) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] style Object to be assigned + def style=(style) + validator = EnumAttributeValidator.new('String', ["primary", "secondary", "link"]) + unless validator.valid?(style) + fail ArgumentError, "invalid value for \"style\", must be one of #{validator.allowable_values}." + end + @style = style + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] gravity Object to be assigned + def gravity=(gravity) + validator = EnumAttributeValidator.new('String', ["top", "bottom", "center"]) + unless validator.valid?(gravity) + fail ArgumentError, "invalid value for \"gravity\", must be one of #{validator.allowable_values}." + end + @gravity = gravity + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] position Object to be assigned + def position=(position) + validator = EnumAttributeValidator.new('String', ["relative", "absolute"]) + unless validator.valid?(position) + fail ArgumentError, "invalid value for \"position\", must be one of #{validator.allowable_values}." + end + @position = position + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] height Object to be assigned + def height=(height) + validator = EnumAttributeValidator.new('String', ["md", "sm"]) + unless validator.valid?(height) + fail ArgumentError, "invalid value for \"height\", must be one of #{validator.allowable_values}." + end + @height = height + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] adjust_mode Object to be assigned + def adjust_mode=(adjust_mode) + validator = EnumAttributeValidator.new('String', ["shrink-to-fit"]) + unless validator.valid?(adjust_mode) + fail ArgumentError, "invalid value for \"adjust_mode\", must be one of #{validator.allowable_values}." + end + @adjust_mode = adjust_mode + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + flex == o.flex && + color == o.color && + style == o.style && + action == o.action && + gravity == o.gravity && + margin == o.margin && + position == o.position && + offset_top == o.offset_top && + offset_bottom == o.offset_bottom && + offset_start == o.offset_start && + offset_end == o.offset_end && + height == o.height && + adjust_mode == o.adjust_mode && + scaling == o.scaling + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [flex, color, style, action, gravity, margin, position, offset_top, offset_bottom, offset_start, offset_end, height, adjust_mode, scaling].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_carousel.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_carousel.rb new file mode 100644 index 00000000..838455a5 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_carousel.rb @@ -0,0 +1,232 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexCarousel < FlexContainer + attr_accessor :contents + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'contents' => :'contents' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'contents' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'FlexContainer' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexCarousel` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexCarousel`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'contents') + if (value = attributes[:'contents']).is_a?(Array) + self.contents = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + contents == o.contents && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [contents].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_carousel_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_carousel_all_of.rb new file mode 100644 index 00000000..cb6973a7 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_carousel_all_of.rb @@ -0,0 +1,221 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexCarouselAllOf + attr_accessor :contents + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'contents' => :'contents' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'contents' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexCarouselAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexCarouselAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'contents') + if (value = attributes[:'contents']).is_a?(Array) + self.contents = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + contents == o.contents + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [contents].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_component.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_component.rb new file mode 100644 index 00000000..bb9f3432 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_component.rb @@ -0,0 +1,231 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexComponent + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # discriminator's property name in OpenAPI v3 + def self.openapi_discriminator_name + :'type' + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexComponent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexComponent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @type.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_container.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_container.rb new file mode 100644 index 00000000..df5be238 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_container.rb @@ -0,0 +1,231 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexContainer + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # discriminator's property name in OpenAPI v3 + def self.openapi_discriminator_name + :'type' + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexContainer` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexContainer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @type.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_filler.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_filler.rb new file mode 100644 index 00000000..47936369 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_filler.rb @@ -0,0 +1,230 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexFiller < FlexComponent + attr_accessor :flex + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'flex' => :'flex' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'flex' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'FlexComponent' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexFiller` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexFiller`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'flex') + self.flex = attributes[:'flex'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + flex == o.flex && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [flex].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_filler_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_filler_all_of.rb new file mode 100644 index 00000000..c58b1a13 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_filler_all_of.rb @@ -0,0 +1,219 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexFillerAllOf + attr_accessor :flex + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'flex' => :'flex' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'flex' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexFillerAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexFillerAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'flex') + self.flex = attributes[:'flex'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + flex == o.flex + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [flex].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_icon.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_icon.rb new file mode 100644 index 00000000..0de9541d --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_icon.rb @@ -0,0 +1,345 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexIcon < FlexComponent + attr_accessor :url + + attr_accessor :size + + attr_accessor :aspect_ratio + + attr_accessor :margin + + attr_accessor :position + + attr_accessor :offset_top + + attr_accessor :offset_bottom + + attr_accessor :offset_start + + attr_accessor :offset_end + + attr_accessor :scaling + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'url' => :'url', + :'size' => :'size', + :'aspect_ratio' => :'aspectRatio', + :'margin' => :'margin', + :'position' => :'position', + :'offset_top' => :'offsetTop', + :'offset_bottom' => :'offsetBottom', + :'offset_start' => :'offsetStart', + :'offset_end' => :'offsetEnd', + :'scaling' => :'scaling' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'url' => :'String', + :'size' => :'String', + :'aspect_ratio' => :'String', + :'margin' => :'String', + :'position' => :'String', + :'offset_top' => :'String', + :'offset_bottom' => :'String', + :'offset_start' => :'String', + :'offset_end' => :'String', + :'scaling' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'FlexComponent' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexIcon` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexIcon`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + + if attributes.key?(:'size') + self.size = attributes[:'size'] + end + + if attributes.key?(:'aspect_ratio') + self.aspect_ratio = attributes[:'aspect_ratio'] + end + + if attributes.key?(:'margin') + self.margin = attributes[:'margin'] + end + + if attributes.key?(:'position') + self.position = attributes[:'position'] + end + + if attributes.key?(:'offset_top') + self.offset_top = attributes[:'offset_top'] + end + + if attributes.key?(:'offset_bottom') + self.offset_bottom = attributes[:'offset_bottom'] + end + + if attributes.key?(:'offset_start') + self.offset_start = attributes[:'offset_start'] + end + + if attributes.key?(:'offset_end') + self.offset_end = attributes[:'offset_end'] + end + + if attributes.key?(:'scaling') + self.scaling = attributes[:'scaling'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + position_validator = EnumAttributeValidator.new('String', ["relative", "absolute"]) + return false unless position_validator.valid?(@position) + true && super + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] position Object to be assigned + def position=(position) + validator = EnumAttributeValidator.new('String', ["relative", "absolute"]) + unless validator.valid?(position) + fail ArgumentError, "invalid value for \"position\", must be one of #{validator.allowable_values}." + end + @position = position + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + url == o.url && + size == o.size && + aspect_ratio == o.aspect_ratio && + margin == o.margin && + position == o.position && + offset_top == o.offset_top && + offset_bottom == o.offset_bottom && + offset_start == o.offset_start && + offset_end == o.offset_end && + scaling == o.scaling && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [url, size, aspect_ratio, margin, position, offset_top, offset_bottom, offset_start, offset_end, scaling].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_icon_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_icon_all_of.rb new file mode 100644 index 00000000..6120e05c --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_icon_all_of.rb @@ -0,0 +1,334 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexIconAllOf + attr_accessor :url + + attr_accessor :size + + attr_accessor :aspect_ratio + + attr_accessor :margin + + attr_accessor :position + + attr_accessor :offset_top + + attr_accessor :offset_bottom + + attr_accessor :offset_start + + attr_accessor :offset_end + + attr_accessor :scaling + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'url' => :'url', + :'size' => :'size', + :'aspect_ratio' => :'aspectRatio', + :'margin' => :'margin', + :'position' => :'position', + :'offset_top' => :'offsetTop', + :'offset_bottom' => :'offsetBottom', + :'offset_start' => :'offsetStart', + :'offset_end' => :'offsetEnd', + :'scaling' => :'scaling' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'url' => :'String', + :'size' => :'String', + :'aspect_ratio' => :'String', + :'margin' => :'String', + :'position' => :'String', + :'offset_top' => :'String', + :'offset_bottom' => :'String', + :'offset_start' => :'String', + :'offset_end' => :'String', + :'scaling' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexIconAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexIconAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + + if attributes.key?(:'size') + self.size = attributes[:'size'] + end + + if attributes.key?(:'aspect_ratio') + self.aspect_ratio = attributes[:'aspect_ratio'] + end + + if attributes.key?(:'margin') + self.margin = attributes[:'margin'] + end + + if attributes.key?(:'position') + self.position = attributes[:'position'] + end + + if attributes.key?(:'offset_top') + self.offset_top = attributes[:'offset_top'] + end + + if attributes.key?(:'offset_bottom') + self.offset_bottom = attributes[:'offset_bottom'] + end + + if attributes.key?(:'offset_start') + self.offset_start = attributes[:'offset_start'] + end + + if attributes.key?(:'offset_end') + self.offset_end = attributes[:'offset_end'] + end + + if attributes.key?(:'scaling') + self.scaling = attributes[:'scaling'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + position_validator = EnumAttributeValidator.new('String', ["relative", "absolute"]) + return false unless position_validator.valid?(@position) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] position Object to be assigned + def position=(position) + validator = EnumAttributeValidator.new('String', ["relative", "absolute"]) + unless validator.valid?(position) + fail ArgumentError, "invalid value for \"position\", must be one of #{validator.allowable_values}." + end + @position = position + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + url == o.url && + size == o.size && + aspect_ratio == o.aspect_ratio && + margin == o.margin && + position == o.position && + offset_top == o.offset_top && + offset_bottom == o.offset_bottom && + offset_start == o.offset_start && + offset_end == o.offset_end && + scaling == o.scaling + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [url, size, aspect_ratio, margin, position, offset_top, offset_bottom, offset_start, offset_end, scaling].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_image.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_image.rb new file mode 100644 index 00000000..dbee4155 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_image.rb @@ -0,0 +1,461 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexImage < FlexComponent + # Image URL (Max character limit: 2000) Protocol: HTTPS (TLS 1.2 or later) Image format: JPEG or PNG Maximum image size: 1024×1024 pixels Maximum file size: 10 MB (300 KB when the animated property is true) + attr_accessor :url + + # The ratio of the width or height of this component within the parent box. + attr_accessor :flex + + # The minimum amount of space to include before this component in its parent container. + attr_accessor :margin + + # Reference for offsetTop, offsetBottom, offsetStart, and offsetEnd. Specify one of the following values: `relative`: Use the previous box as reference. `absolute`: Use the top left of parent element as reference. The default value is relative. + attr_accessor :position + + # Offset. + attr_accessor :offset_top + + # Offset. + attr_accessor :offset_bottom + + # Offset. + attr_accessor :offset_start + + # Offset. + attr_accessor :offset_end + + # Alignment style in horizontal direction. + attr_accessor :align + + # Alignment style in vertical direction. + attr_accessor :gravity + + # The maximum image width. This is md by default. + attr_accessor :size + + # Aspect ratio of the image. `{width}:{height}` format. Specify the value of `{width}` and `{height}` in the range from `1` to `100000`. However, you cannot set `{height}` to a value that is more than three times the value of `{width}`. The default value is `1:1`. + attr_accessor :aspect_ratio + + # The display style of the image if the aspect ratio of the image and that specified by the aspectRatio property do not match. + attr_accessor :aspect_mode + + # Background color of the image. Use a hexadecimal color code. + attr_accessor :background_color + + attr_accessor :action + + # When this is `true`, an animated image (APNG) plays. You can specify a value of true up to 10 images in a single message. You can't send messages that exceed this limit. This is `false` by default. Animated images larger than 300 KB aren't played back. + attr_accessor :animated + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'url' => :'url', + :'flex' => :'flex', + :'margin' => :'margin', + :'position' => :'position', + :'offset_top' => :'offsetTop', + :'offset_bottom' => :'offsetBottom', + :'offset_start' => :'offsetStart', + :'offset_end' => :'offsetEnd', + :'align' => :'align', + :'gravity' => :'gravity', + :'size' => :'size', + :'aspect_ratio' => :'aspectRatio', + :'aspect_mode' => :'aspectMode', + :'background_color' => :'backgroundColor', + :'action' => :'action', + :'animated' => :'animated' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'url' => :'String', + :'flex' => :'Integer', + :'margin' => :'String', + :'position' => :'String', + :'offset_top' => :'String', + :'offset_bottom' => :'String', + :'offset_start' => :'String', + :'offset_end' => :'String', + :'align' => :'String', + :'gravity' => :'String', + :'size' => :'String', + :'aspect_ratio' => :'String', + :'aspect_mode' => :'String', + :'background_color' => :'String', + :'action' => :'Action', + :'animated' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'FlexComponent' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexImage` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexImage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'url') + self.url = attributes[:'url'] + else + self.url = nil + end + + if attributes.key?(:'flex') + self.flex = attributes[:'flex'] + end + + if attributes.key?(:'margin') + self.margin = attributes[:'margin'] + end + + if attributes.key?(:'position') + self.position = attributes[:'position'] + end + + if attributes.key?(:'offset_top') + self.offset_top = attributes[:'offset_top'] + end + + if attributes.key?(:'offset_bottom') + self.offset_bottom = attributes[:'offset_bottom'] + end + + if attributes.key?(:'offset_start') + self.offset_start = attributes[:'offset_start'] + end + + if attributes.key?(:'offset_end') + self.offset_end = attributes[:'offset_end'] + end + + if attributes.key?(:'align') + self.align = attributes[:'align'] + end + + if attributes.key?(:'gravity') + self.gravity = attributes[:'gravity'] + end + + if attributes.key?(:'size') + self.size = attributes[:'size'] + else + self.size = 'md' + end + + if attributes.key?(:'aspect_ratio') + self.aspect_ratio = attributes[:'aspect_ratio'] + end + + if attributes.key?(:'aspect_mode') + self.aspect_mode = attributes[:'aspect_mode'] + end + + if attributes.key?(:'background_color') + self.background_color = attributes[:'background_color'] + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + + if attributes.key?(:'animated') + self.animated = attributes[:'animated'] + else + self.animated = false + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @url.nil? + invalid_properties.push('invalid value for "url", url cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @url.nil? + position_validator = EnumAttributeValidator.new('String', ["relative", "absolute"]) + return false unless position_validator.valid?(@position) + align_validator = EnumAttributeValidator.new('String', ["start", "end", "center"]) + return false unless align_validator.valid?(@align) + gravity_validator = EnumAttributeValidator.new('String', ["top", "bottom", "center"]) + return false unless gravity_validator.valid?(@gravity) + aspect_mode_validator = EnumAttributeValidator.new('String', ["fit", "cover"]) + return false unless aspect_mode_validator.valid?(@aspect_mode) + true && super + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] position Object to be assigned + def position=(position) + validator = EnumAttributeValidator.new('String', ["relative", "absolute"]) + unless validator.valid?(position) + fail ArgumentError, "invalid value for \"position\", must be one of #{validator.allowable_values}." + end + @position = position + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] align Object to be assigned + def align=(align) + validator = EnumAttributeValidator.new('String', ["start", "end", "center"]) + unless validator.valid?(align) + fail ArgumentError, "invalid value for \"align\", must be one of #{validator.allowable_values}." + end + @align = align + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] gravity Object to be assigned + def gravity=(gravity) + validator = EnumAttributeValidator.new('String', ["top", "bottom", "center"]) + unless validator.valid?(gravity) + fail ArgumentError, "invalid value for \"gravity\", must be one of #{validator.allowable_values}." + end + @gravity = gravity + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] aspect_mode Object to be assigned + def aspect_mode=(aspect_mode) + validator = EnumAttributeValidator.new('String', ["fit", "cover"]) + unless validator.valid?(aspect_mode) + fail ArgumentError, "invalid value for \"aspect_mode\", must be one of #{validator.allowable_values}." + end + @aspect_mode = aspect_mode + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + url == o.url && + flex == o.flex && + margin == o.margin && + position == o.position && + offset_top == o.offset_top && + offset_bottom == o.offset_bottom && + offset_start == o.offset_start && + offset_end == o.offset_end && + align == o.align && + gravity == o.gravity && + size == o.size && + aspect_ratio == o.aspect_ratio && + aspect_mode == o.aspect_mode && + background_color == o.background_color && + action == o.action && + animated == o.animated && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [url, flex, margin, position, offset_top, offset_bottom, offset_start, offset_end, align, gravity, size, aspect_ratio, aspect_mode, background_color, action, animated].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_image_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_image_all_of.rb new file mode 100644 index 00000000..53a502c7 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_image_all_of.rb @@ -0,0 +1,443 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexImageAllOf + # Image URL (Max character limit: 2000) Protocol: HTTPS (TLS 1.2 or later) Image format: JPEG or PNG Maximum image size: 1024×1024 pixels Maximum file size: 10 MB (300 KB when the animated property is true) + attr_accessor :url + + # The ratio of the width or height of this component within the parent box. + attr_accessor :flex + + # The minimum amount of space to include before this component in its parent container. + attr_accessor :margin + + # Reference for offsetTop, offsetBottom, offsetStart, and offsetEnd. Specify one of the following values: `relative`: Use the previous box as reference. `absolute`: Use the top left of parent element as reference. The default value is relative. + attr_accessor :position + + # Offset. + attr_accessor :offset_top + + # Offset. + attr_accessor :offset_bottom + + # Offset. + attr_accessor :offset_start + + # Offset. + attr_accessor :offset_end + + # Alignment style in horizontal direction. + attr_accessor :align + + # Alignment style in vertical direction. + attr_accessor :gravity + + # The maximum image width. This is md by default. + attr_accessor :size + + # Aspect ratio of the image. `{width}:{height}` format. Specify the value of `{width}` and `{height}` in the range from `1` to `100000`. However, you cannot set `{height}` to a value that is more than three times the value of `{width}`. The default value is `1:1`. + attr_accessor :aspect_ratio + + # The display style of the image if the aspect ratio of the image and that specified by the aspectRatio property do not match. + attr_accessor :aspect_mode + + # Background color of the image. Use a hexadecimal color code. + attr_accessor :background_color + + attr_accessor :action + + # When this is `true`, an animated image (APNG) plays. You can specify a value of true up to 10 images in a single message. You can't send messages that exceed this limit. This is `false` by default. Animated images larger than 300 KB aren't played back. + attr_accessor :animated + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'url' => :'url', + :'flex' => :'flex', + :'margin' => :'margin', + :'position' => :'position', + :'offset_top' => :'offsetTop', + :'offset_bottom' => :'offsetBottom', + :'offset_start' => :'offsetStart', + :'offset_end' => :'offsetEnd', + :'align' => :'align', + :'gravity' => :'gravity', + :'size' => :'size', + :'aspect_ratio' => :'aspectRatio', + :'aspect_mode' => :'aspectMode', + :'background_color' => :'backgroundColor', + :'action' => :'action', + :'animated' => :'animated' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'url' => :'String', + :'flex' => :'Integer', + :'margin' => :'String', + :'position' => :'String', + :'offset_top' => :'String', + :'offset_bottom' => :'String', + :'offset_start' => :'String', + :'offset_end' => :'String', + :'align' => :'String', + :'gravity' => :'String', + :'size' => :'String', + :'aspect_ratio' => :'String', + :'aspect_mode' => :'String', + :'background_color' => :'String', + :'action' => :'Action', + :'animated' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexImageAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexImageAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + + if attributes.key?(:'flex') + self.flex = attributes[:'flex'] + end + + if attributes.key?(:'margin') + self.margin = attributes[:'margin'] + end + + if attributes.key?(:'position') + self.position = attributes[:'position'] + end + + if attributes.key?(:'offset_top') + self.offset_top = attributes[:'offset_top'] + end + + if attributes.key?(:'offset_bottom') + self.offset_bottom = attributes[:'offset_bottom'] + end + + if attributes.key?(:'offset_start') + self.offset_start = attributes[:'offset_start'] + end + + if attributes.key?(:'offset_end') + self.offset_end = attributes[:'offset_end'] + end + + if attributes.key?(:'align') + self.align = attributes[:'align'] + end + + if attributes.key?(:'gravity') + self.gravity = attributes[:'gravity'] + end + + if attributes.key?(:'size') + self.size = attributes[:'size'] + else + self.size = 'md' + end + + if attributes.key?(:'aspect_ratio') + self.aspect_ratio = attributes[:'aspect_ratio'] + end + + if attributes.key?(:'aspect_mode') + self.aspect_mode = attributes[:'aspect_mode'] + end + + if attributes.key?(:'background_color') + self.background_color = attributes[:'background_color'] + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + + if attributes.key?(:'animated') + self.animated = attributes[:'animated'] + else + self.animated = false + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + position_validator = EnumAttributeValidator.new('String', ["relative", "absolute"]) + return false unless position_validator.valid?(@position) + align_validator = EnumAttributeValidator.new('String', ["start", "end", "center"]) + return false unless align_validator.valid?(@align) + gravity_validator = EnumAttributeValidator.new('String', ["top", "bottom", "center"]) + return false unless gravity_validator.valid?(@gravity) + aspect_mode_validator = EnumAttributeValidator.new('String', ["fit", "cover"]) + return false unless aspect_mode_validator.valid?(@aspect_mode) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] position Object to be assigned + def position=(position) + validator = EnumAttributeValidator.new('String', ["relative", "absolute"]) + unless validator.valid?(position) + fail ArgumentError, "invalid value for \"position\", must be one of #{validator.allowable_values}." + end + @position = position + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] align Object to be assigned + def align=(align) + validator = EnumAttributeValidator.new('String', ["start", "end", "center"]) + unless validator.valid?(align) + fail ArgumentError, "invalid value for \"align\", must be one of #{validator.allowable_values}." + end + @align = align + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] gravity Object to be assigned + def gravity=(gravity) + validator = EnumAttributeValidator.new('String', ["top", "bottom", "center"]) + unless validator.valid?(gravity) + fail ArgumentError, "invalid value for \"gravity\", must be one of #{validator.allowable_values}." + end + @gravity = gravity + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] aspect_mode Object to be assigned + def aspect_mode=(aspect_mode) + validator = EnumAttributeValidator.new('String', ["fit", "cover"]) + unless validator.valid?(aspect_mode) + fail ArgumentError, "invalid value for \"aspect_mode\", must be one of #{validator.allowable_values}." + end + @aspect_mode = aspect_mode + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + url == o.url && + flex == o.flex && + margin == o.margin && + position == o.position && + offset_top == o.offset_top && + offset_bottom == o.offset_bottom && + offset_start == o.offset_start && + offset_end == o.offset_end && + align == o.align && + gravity == o.gravity && + size == o.size && + aspect_ratio == o.aspect_ratio && + aspect_mode == o.aspect_mode && + background_color == o.background_color && + action == o.action && + animated == o.animated + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [url, flex, margin, position, offset_top, offset_bottom, offset_start, offset_end, align, gravity, size, aspect_ratio, aspect_mode, background_color, action, animated].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_message.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_message.rb new file mode 100644 index 00000000..002994bc --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_message.rb @@ -0,0 +1,239 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexMessage < Message + attr_accessor :alt_text + + attr_accessor :contents + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'alt_text' => :'altText', + :'contents' => :'contents' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'alt_text' => :'String', + :'contents' => :'FlexContainer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Message' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexMessage` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexMessage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'alt_text') + self.alt_text = attributes[:'alt_text'] + end + + if attributes.key?(:'contents') + self.contents = attributes[:'contents'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + alt_text == o.alt_text && + contents == o.contents && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [alt_text, contents].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_message_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_message_all_of.rb new file mode 100644 index 00000000..4dde3879 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_message_all_of.rb @@ -0,0 +1,228 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexMessageAllOf + attr_accessor :alt_text + + attr_accessor :contents + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'alt_text' => :'altText', + :'contents' => :'contents' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'alt_text' => :'String', + :'contents' => :'FlexContainer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexMessageAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexMessageAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'alt_text') + self.alt_text = attributes[:'alt_text'] + end + + if attributes.key?(:'contents') + self.contents = attributes[:'contents'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + alt_text == o.alt_text && + contents == o.contents + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [alt_text, contents].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_separator.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_separator.rb new file mode 100644 index 00000000..0584ba21 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_separator.rb @@ -0,0 +1,239 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexSeparator < FlexComponent + attr_accessor :margin + + attr_accessor :color + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'margin' => :'margin', + :'color' => :'color' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'margin' => :'String', + :'color' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'FlexComponent' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexSeparator` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexSeparator`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'margin') + self.margin = attributes[:'margin'] + end + + if attributes.key?(:'color') + self.color = attributes[:'color'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + margin == o.margin && + color == o.color && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [margin, color].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_separator_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_separator_all_of.rb new file mode 100644 index 00000000..6258c388 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_separator_all_of.rb @@ -0,0 +1,228 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexSeparatorAllOf + attr_accessor :margin + + attr_accessor :color + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'margin' => :'margin', + :'color' => :'color' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'margin' => :'String', + :'color' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexSeparatorAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexSeparatorAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'margin') + self.margin = attributes[:'margin'] + end + + if attributes.key?(:'color') + self.color = attributes[:'color'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + margin == o.margin && + color == o.color + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [margin, color].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_span.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_span.rb new file mode 100644 index 00000000..34d0cc15 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_span.rb @@ -0,0 +1,333 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexSpan < FlexComponent + attr_accessor :text + + attr_accessor :size + + attr_accessor :color + + attr_accessor :weight + + attr_accessor :style + + attr_accessor :decoration + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'text' => :'text', + :'size' => :'size', + :'color' => :'color', + :'weight' => :'weight', + :'style' => :'style', + :'decoration' => :'decoration' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'text' => :'String', + :'size' => :'String', + :'color' => :'String', + :'weight' => :'String', + :'style' => :'String', + :'decoration' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'FlexComponent' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexSpan` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexSpan`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'text') + self.text = attributes[:'text'] + end + + if attributes.key?(:'size') + self.size = attributes[:'size'] + end + + if attributes.key?(:'color') + self.color = attributes[:'color'] + end + + if attributes.key?(:'weight') + self.weight = attributes[:'weight'] + end + + if attributes.key?(:'style') + self.style = attributes[:'style'] + end + + if attributes.key?(:'decoration') + self.decoration = attributes[:'decoration'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + weight_validator = EnumAttributeValidator.new('String', ["regular", "bold"]) + return false unless weight_validator.valid?(@weight) + style_validator = EnumAttributeValidator.new('String', ["normal", "italic"]) + return false unless style_validator.valid?(@style) + decoration_validator = EnumAttributeValidator.new('String', ["none", "underline", "line-through"]) + return false unless decoration_validator.valid?(@decoration) + true && super + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] weight Object to be assigned + def weight=(weight) + validator = EnumAttributeValidator.new('String', ["regular", "bold"]) + unless validator.valid?(weight) + fail ArgumentError, "invalid value for \"weight\", must be one of #{validator.allowable_values}." + end + @weight = weight + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] style Object to be assigned + def style=(style) + validator = EnumAttributeValidator.new('String', ["normal", "italic"]) + unless validator.valid?(style) + fail ArgumentError, "invalid value for \"style\", must be one of #{validator.allowable_values}." + end + @style = style + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] decoration Object to be assigned + def decoration=(decoration) + validator = EnumAttributeValidator.new('String', ["none", "underline", "line-through"]) + unless validator.valid?(decoration) + fail ArgumentError, "invalid value for \"decoration\", must be one of #{validator.allowable_values}." + end + @decoration = decoration + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + text == o.text && + size == o.size && + color == o.color && + weight == o.weight && + style == o.style && + decoration == o.decoration && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [text, size, color, weight, style, decoration].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_span_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_span_all_of.rb new file mode 100644 index 00000000..3822c0ef --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_span_all_of.rb @@ -0,0 +1,322 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexSpanAllOf + attr_accessor :text + + attr_accessor :size + + attr_accessor :color + + attr_accessor :weight + + attr_accessor :style + + attr_accessor :decoration + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'text' => :'text', + :'size' => :'size', + :'color' => :'color', + :'weight' => :'weight', + :'style' => :'style', + :'decoration' => :'decoration' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'text' => :'String', + :'size' => :'String', + :'color' => :'String', + :'weight' => :'String', + :'style' => :'String', + :'decoration' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexSpanAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexSpanAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'text') + self.text = attributes[:'text'] + end + + if attributes.key?(:'size') + self.size = attributes[:'size'] + end + + if attributes.key?(:'color') + self.color = attributes[:'color'] + end + + if attributes.key?(:'weight') + self.weight = attributes[:'weight'] + end + + if attributes.key?(:'style') + self.style = attributes[:'style'] + end + + if attributes.key?(:'decoration') + self.decoration = attributes[:'decoration'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + weight_validator = EnumAttributeValidator.new('String', ["regular", "bold"]) + return false unless weight_validator.valid?(@weight) + style_validator = EnumAttributeValidator.new('String', ["normal", "italic"]) + return false unless style_validator.valid?(@style) + decoration_validator = EnumAttributeValidator.new('String', ["none", "underline", "line-through"]) + return false unless decoration_validator.valid?(@decoration) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] weight Object to be assigned + def weight=(weight) + validator = EnumAttributeValidator.new('String', ["regular", "bold"]) + unless validator.valid?(weight) + fail ArgumentError, "invalid value for \"weight\", must be one of #{validator.allowable_values}." + end + @weight = weight + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] style Object to be assigned + def style=(style) + validator = EnumAttributeValidator.new('String', ["normal", "italic"]) + unless validator.valid?(style) + fail ArgumentError, "invalid value for \"style\", must be one of #{validator.allowable_values}." + end + @style = style + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] decoration Object to be assigned + def decoration=(decoration) + validator = EnumAttributeValidator.new('String', ["none", "underline", "line-through"]) + unless validator.valid?(decoration) + fail ArgumentError, "invalid value for \"decoration\", must be one of #{validator.allowable_values}." + end + @decoration = decoration + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + text == o.text && + size == o.size && + color == o.color && + weight == o.weight && + style == o.style && + decoration == o.decoration + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [text, size, color, weight, style, decoration].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_text.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_text.rb new file mode 100644 index 00000000..78378748 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_text.rb @@ -0,0 +1,527 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexText < FlexComponent + attr_accessor :flex + + attr_accessor :text + + attr_accessor :size + + attr_accessor :align + + attr_accessor :gravity + + attr_accessor :color + + attr_accessor :weight + + attr_accessor :style + + attr_accessor :decoration + + attr_accessor :wrap + + attr_accessor :line_spacing + + attr_accessor :margin + + attr_accessor :position + + attr_accessor :offset_top + + attr_accessor :offset_bottom + + attr_accessor :offset_start + + attr_accessor :offset_end + + attr_accessor :action + + attr_accessor :max_lines + + attr_accessor :contents + + attr_accessor :adjust_mode + + attr_accessor :scaling + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'flex' => :'flex', + :'text' => :'text', + :'size' => :'size', + :'align' => :'align', + :'gravity' => :'gravity', + :'color' => :'color', + :'weight' => :'weight', + :'style' => :'style', + :'decoration' => :'decoration', + :'wrap' => :'wrap', + :'line_spacing' => :'lineSpacing', + :'margin' => :'margin', + :'position' => :'position', + :'offset_top' => :'offsetTop', + :'offset_bottom' => :'offsetBottom', + :'offset_start' => :'offsetStart', + :'offset_end' => :'offsetEnd', + :'action' => :'action', + :'max_lines' => :'maxLines', + :'contents' => :'contents', + :'adjust_mode' => :'adjustMode', + :'scaling' => :'scaling' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'flex' => :'Integer', + :'text' => :'String', + :'size' => :'String', + :'align' => :'String', + :'gravity' => :'String', + :'color' => :'String', + :'weight' => :'String', + :'style' => :'String', + :'decoration' => :'String', + :'wrap' => :'Boolean', + :'line_spacing' => :'String', + :'margin' => :'String', + :'position' => :'String', + :'offset_top' => :'String', + :'offset_bottom' => :'String', + :'offset_start' => :'String', + :'offset_end' => :'String', + :'action' => :'Action', + :'max_lines' => :'Integer', + :'contents' => :'Array', + :'adjust_mode' => :'String', + :'scaling' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'FlexComponent' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexText` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexText`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'flex') + self.flex = attributes[:'flex'] + end + + if attributes.key?(:'text') + self.text = attributes[:'text'] + end + + if attributes.key?(:'size') + self.size = attributes[:'size'] + end + + if attributes.key?(:'align') + self.align = attributes[:'align'] + end + + if attributes.key?(:'gravity') + self.gravity = attributes[:'gravity'] + end + + if attributes.key?(:'color') + self.color = attributes[:'color'] + end + + if attributes.key?(:'weight') + self.weight = attributes[:'weight'] + end + + if attributes.key?(:'style') + self.style = attributes[:'style'] + end + + if attributes.key?(:'decoration') + self.decoration = attributes[:'decoration'] + end + + if attributes.key?(:'wrap') + self.wrap = attributes[:'wrap'] + end + + if attributes.key?(:'line_spacing') + self.line_spacing = attributes[:'line_spacing'] + end + + if attributes.key?(:'margin') + self.margin = attributes[:'margin'] + end + + if attributes.key?(:'position') + self.position = attributes[:'position'] + end + + if attributes.key?(:'offset_top') + self.offset_top = attributes[:'offset_top'] + end + + if attributes.key?(:'offset_bottom') + self.offset_bottom = attributes[:'offset_bottom'] + end + + if attributes.key?(:'offset_start') + self.offset_start = attributes[:'offset_start'] + end + + if attributes.key?(:'offset_end') + self.offset_end = attributes[:'offset_end'] + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + + if attributes.key?(:'max_lines') + self.max_lines = attributes[:'max_lines'] + end + + if attributes.key?(:'contents') + if (value = attributes[:'contents']).is_a?(Array) + self.contents = value + end + end + + if attributes.key?(:'adjust_mode') + self.adjust_mode = attributes[:'adjust_mode'] + end + + if attributes.key?(:'scaling') + self.scaling = attributes[:'scaling'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + align_validator = EnumAttributeValidator.new('String', ["start", "end", "center"]) + return false unless align_validator.valid?(@align) + gravity_validator = EnumAttributeValidator.new('String', ["top", "bottom", "center"]) + return false unless gravity_validator.valid?(@gravity) + weight_validator = EnumAttributeValidator.new('String', ["regular", "bold"]) + return false unless weight_validator.valid?(@weight) + style_validator = EnumAttributeValidator.new('String', ["normal", "italic"]) + return false unless style_validator.valid?(@style) + decoration_validator = EnumAttributeValidator.new('String', ["none", "underline", "line-through"]) + return false unless decoration_validator.valid?(@decoration) + position_validator = EnumAttributeValidator.new('String', ["relative", "absolute"]) + return false unless position_validator.valid?(@position) + adjust_mode_validator = EnumAttributeValidator.new('String', ["shrink-to-fit"]) + return false unless adjust_mode_validator.valid?(@adjust_mode) + true && super + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] align Object to be assigned + def align=(align) + validator = EnumAttributeValidator.new('String', ["start", "end", "center"]) + unless validator.valid?(align) + fail ArgumentError, "invalid value for \"align\", must be one of #{validator.allowable_values}." + end + @align = align + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] gravity Object to be assigned + def gravity=(gravity) + validator = EnumAttributeValidator.new('String', ["top", "bottom", "center"]) + unless validator.valid?(gravity) + fail ArgumentError, "invalid value for \"gravity\", must be one of #{validator.allowable_values}." + end + @gravity = gravity + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] weight Object to be assigned + def weight=(weight) + validator = EnumAttributeValidator.new('String', ["regular", "bold"]) + unless validator.valid?(weight) + fail ArgumentError, "invalid value for \"weight\", must be one of #{validator.allowable_values}." + end + @weight = weight + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] style Object to be assigned + def style=(style) + validator = EnumAttributeValidator.new('String', ["normal", "italic"]) + unless validator.valid?(style) + fail ArgumentError, "invalid value for \"style\", must be one of #{validator.allowable_values}." + end + @style = style + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] decoration Object to be assigned + def decoration=(decoration) + validator = EnumAttributeValidator.new('String', ["none", "underline", "line-through"]) + unless validator.valid?(decoration) + fail ArgumentError, "invalid value for \"decoration\", must be one of #{validator.allowable_values}." + end + @decoration = decoration + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] position Object to be assigned + def position=(position) + validator = EnumAttributeValidator.new('String', ["relative", "absolute"]) + unless validator.valid?(position) + fail ArgumentError, "invalid value for \"position\", must be one of #{validator.allowable_values}." + end + @position = position + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] adjust_mode Object to be assigned + def adjust_mode=(adjust_mode) + validator = EnumAttributeValidator.new('String', ["shrink-to-fit"]) + unless validator.valid?(adjust_mode) + fail ArgumentError, "invalid value for \"adjust_mode\", must be one of #{validator.allowable_values}." + end + @adjust_mode = adjust_mode + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + flex == o.flex && + text == o.text && + size == o.size && + align == o.align && + gravity == o.gravity && + color == o.color && + weight == o.weight && + style == o.style && + decoration == o.decoration && + wrap == o.wrap && + line_spacing == o.line_spacing && + margin == o.margin && + position == o.position && + offset_top == o.offset_top && + offset_bottom == o.offset_bottom && + offset_start == o.offset_start && + offset_end == o.offset_end && + action == o.action && + max_lines == o.max_lines && + contents == o.contents && + adjust_mode == o.adjust_mode && + scaling == o.scaling && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [flex, text, size, align, gravity, color, weight, style, decoration, wrap, line_spacing, margin, position, offset_top, offset_bottom, offset_start, offset_end, action, max_lines, contents, adjust_mode, scaling].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_text_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_text_all_of.rb new file mode 100644 index 00000000..28cac66d --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_text_all_of.rb @@ -0,0 +1,516 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexTextAllOf + attr_accessor :flex + + attr_accessor :text + + attr_accessor :size + + attr_accessor :align + + attr_accessor :gravity + + attr_accessor :color + + attr_accessor :weight + + attr_accessor :style + + attr_accessor :decoration + + attr_accessor :wrap + + attr_accessor :line_spacing + + attr_accessor :margin + + attr_accessor :position + + attr_accessor :offset_top + + attr_accessor :offset_bottom + + attr_accessor :offset_start + + attr_accessor :offset_end + + attr_accessor :action + + attr_accessor :max_lines + + attr_accessor :contents + + attr_accessor :adjust_mode + + attr_accessor :scaling + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'flex' => :'flex', + :'text' => :'text', + :'size' => :'size', + :'align' => :'align', + :'gravity' => :'gravity', + :'color' => :'color', + :'weight' => :'weight', + :'style' => :'style', + :'decoration' => :'decoration', + :'wrap' => :'wrap', + :'line_spacing' => :'lineSpacing', + :'margin' => :'margin', + :'position' => :'position', + :'offset_top' => :'offsetTop', + :'offset_bottom' => :'offsetBottom', + :'offset_start' => :'offsetStart', + :'offset_end' => :'offsetEnd', + :'action' => :'action', + :'max_lines' => :'maxLines', + :'contents' => :'contents', + :'adjust_mode' => :'adjustMode', + :'scaling' => :'scaling' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'flex' => :'Integer', + :'text' => :'String', + :'size' => :'String', + :'align' => :'String', + :'gravity' => :'String', + :'color' => :'String', + :'weight' => :'String', + :'style' => :'String', + :'decoration' => :'String', + :'wrap' => :'Boolean', + :'line_spacing' => :'String', + :'margin' => :'String', + :'position' => :'String', + :'offset_top' => :'String', + :'offset_bottom' => :'String', + :'offset_start' => :'String', + :'offset_end' => :'String', + :'action' => :'Action', + :'max_lines' => :'Integer', + :'contents' => :'Array', + :'adjust_mode' => :'String', + :'scaling' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexTextAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexTextAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'flex') + self.flex = attributes[:'flex'] + end + + if attributes.key?(:'text') + self.text = attributes[:'text'] + end + + if attributes.key?(:'size') + self.size = attributes[:'size'] + end + + if attributes.key?(:'align') + self.align = attributes[:'align'] + end + + if attributes.key?(:'gravity') + self.gravity = attributes[:'gravity'] + end + + if attributes.key?(:'color') + self.color = attributes[:'color'] + end + + if attributes.key?(:'weight') + self.weight = attributes[:'weight'] + end + + if attributes.key?(:'style') + self.style = attributes[:'style'] + end + + if attributes.key?(:'decoration') + self.decoration = attributes[:'decoration'] + end + + if attributes.key?(:'wrap') + self.wrap = attributes[:'wrap'] + end + + if attributes.key?(:'line_spacing') + self.line_spacing = attributes[:'line_spacing'] + end + + if attributes.key?(:'margin') + self.margin = attributes[:'margin'] + end + + if attributes.key?(:'position') + self.position = attributes[:'position'] + end + + if attributes.key?(:'offset_top') + self.offset_top = attributes[:'offset_top'] + end + + if attributes.key?(:'offset_bottom') + self.offset_bottom = attributes[:'offset_bottom'] + end + + if attributes.key?(:'offset_start') + self.offset_start = attributes[:'offset_start'] + end + + if attributes.key?(:'offset_end') + self.offset_end = attributes[:'offset_end'] + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + + if attributes.key?(:'max_lines') + self.max_lines = attributes[:'max_lines'] + end + + if attributes.key?(:'contents') + if (value = attributes[:'contents']).is_a?(Array) + self.contents = value + end + end + + if attributes.key?(:'adjust_mode') + self.adjust_mode = attributes[:'adjust_mode'] + end + + if attributes.key?(:'scaling') + self.scaling = attributes[:'scaling'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + align_validator = EnumAttributeValidator.new('String', ["start", "end", "center"]) + return false unless align_validator.valid?(@align) + gravity_validator = EnumAttributeValidator.new('String', ["top", "bottom", "center"]) + return false unless gravity_validator.valid?(@gravity) + weight_validator = EnumAttributeValidator.new('String', ["regular", "bold"]) + return false unless weight_validator.valid?(@weight) + style_validator = EnumAttributeValidator.new('String', ["normal", "italic"]) + return false unless style_validator.valid?(@style) + decoration_validator = EnumAttributeValidator.new('String', ["none", "underline", "line-through"]) + return false unless decoration_validator.valid?(@decoration) + position_validator = EnumAttributeValidator.new('String', ["relative", "absolute"]) + return false unless position_validator.valid?(@position) + adjust_mode_validator = EnumAttributeValidator.new('String', ["shrink-to-fit"]) + return false unless adjust_mode_validator.valid?(@adjust_mode) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] align Object to be assigned + def align=(align) + validator = EnumAttributeValidator.new('String', ["start", "end", "center"]) + unless validator.valid?(align) + fail ArgumentError, "invalid value for \"align\", must be one of #{validator.allowable_values}." + end + @align = align + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] gravity Object to be assigned + def gravity=(gravity) + validator = EnumAttributeValidator.new('String', ["top", "bottom", "center"]) + unless validator.valid?(gravity) + fail ArgumentError, "invalid value for \"gravity\", must be one of #{validator.allowable_values}." + end + @gravity = gravity + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] weight Object to be assigned + def weight=(weight) + validator = EnumAttributeValidator.new('String', ["regular", "bold"]) + unless validator.valid?(weight) + fail ArgumentError, "invalid value for \"weight\", must be one of #{validator.allowable_values}." + end + @weight = weight + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] style Object to be assigned + def style=(style) + validator = EnumAttributeValidator.new('String', ["normal", "italic"]) + unless validator.valid?(style) + fail ArgumentError, "invalid value for \"style\", must be one of #{validator.allowable_values}." + end + @style = style + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] decoration Object to be assigned + def decoration=(decoration) + validator = EnumAttributeValidator.new('String', ["none", "underline", "line-through"]) + unless validator.valid?(decoration) + fail ArgumentError, "invalid value for \"decoration\", must be one of #{validator.allowable_values}." + end + @decoration = decoration + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] position Object to be assigned + def position=(position) + validator = EnumAttributeValidator.new('String', ["relative", "absolute"]) + unless validator.valid?(position) + fail ArgumentError, "invalid value for \"position\", must be one of #{validator.allowable_values}." + end + @position = position + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] adjust_mode Object to be assigned + def adjust_mode=(adjust_mode) + validator = EnumAttributeValidator.new('String', ["shrink-to-fit"]) + unless validator.valid?(adjust_mode) + fail ArgumentError, "invalid value for \"adjust_mode\", must be one of #{validator.allowable_values}." + end + @adjust_mode = adjust_mode + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + flex == o.flex && + text == o.text && + size == o.size && + align == o.align && + gravity == o.gravity && + color == o.color && + weight == o.weight && + style == o.style && + decoration == o.decoration && + wrap == o.wrap && + line_spacing == o.line_spacing && + margin == o.margin && + position == o.position && + offset_top == o.offset_top && + offset_bottom == o.offset_bottom && + offset_start == o.offset_start && + offset_end == o.offset_end && + action == o.action && + max_lines == o.max_lines && + contents == o.contents && + adjust_mode == o.adjust_mode && + scaling == o.scaling + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [flex, text, size, align, gravity, color, weight, style, decoration, wrap, line_spacing, margin, position, offset_top, offset_bottom, offset_start, offset_end, action, max_lines, contents, adjust_mode, scaling].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_video.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_video.rb new file mode 100644 index 00000000..1a209f39 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_video.rb @@ -0,0 +1,266 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexVideo < FlexComponent + attr_accessor :url + + attr_accessor :preview_url + + attr_accessor :alt_content + + attr_accessor :aspect_ratio + + attr_accessor :action + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'url' => :'url', + :'preview_url' => :'previewUrl', + :'alt_content' => :'altContent', + :'aspect_ratio' => :'aspectRatio', + :'action' => :'action' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'url' => :'String', + :'preview_url' => :'String', + :'alt_content' => :'FlexComponent', + :'aspect_ratio' => :'String', + :'action' => :'Action' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'FlexComponent' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexVideo` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexVideo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + + if attributes.key?(:'preview_url') + self.preview_url = attributes[:'preview_url'] + end + + if attributes.key?(:'alt_content') + self.alt_content = attributes[:'alt_content'] + end + + if attributes.key?(:'aspect_ratio') + self.aspect_ratio = attributes[:'aspect_ratio'] + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + url == o.url && + preview_url == o.preview_url && + alt_content == o.alt_content && + aspect_ratio == o.aspect_ratio && + action == o.action && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [url, preview_url, alt_content, aspect_ratio, action].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_video_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_video_all_of.rb new file mode 100644 index 00000000..3dd5f887 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/flex_video_all_of.rb @@ -0,0 +1,255 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class FlexVideoAllOf + attr_accessor :url + + attr_accessor :preview_url + + attr_accessor :alt_content + + attr_accessor :aspect_ratio + + attr_accessor :action + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'url' => :'url', + :'preview_url' => :'previewUrl', + :'alt_content' => :'altContent', + :'aspect_ratio' => :'aspectRatio', + :'action' => :'action' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'url' => :'String', + :'preview_url' => :'String', + :'alt_content' => :'FlexComponent', + :'aspect_ratio' => :'String', + :'action' => :'Action' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::FlexVideoAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::FlexVideoAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + + if attributes.key?(:'preview_url') + self.preview_url = attributes[:'preview_url'] + end + + if attributes.key?(:'alt_content') + self.alt_content = attributes[:'alt_content'] + end + + if attributes.key?(:'aspect_ratio') + self.aspect_ratio = attributes[:'aspect_ratio'] + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + url == o.url && + preview_url == o.preview_url && + alt_content == o.alt_content && + aspect_ratio == o.aspect_ratio && + action == o.action + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [url, preview_url, alt_content, aspect_ratio, action].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/gender_demographic.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/gender_demographic.rb new file mode 100644 index 00000000..c3065f10 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/gender_demographic.rb @@ -0,0 +1,40 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class GenderDemographic + MALE = "male".freeze + FEMALE = "female".freeze + + def self.all_vars + @all_vars ||= [MALE, FEMALE].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if GenderDemographic.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #GenderDemographic" + end + end +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/gender_demographic_filter.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/gender_demographic_filter.rb new file mode 100644 index 00000000..395d0aec --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/gender_demographic_filter.rb @@ -0,0 +1,232 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class GenderDemographicFilter < DemographicFilter + attr_accessor :one_of + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'one_of' => :'oneOf' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'one_of' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'DemographicFilter' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::GenderDemographicFilter` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::GenderDemographicFilter`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'one_of') + if (value = attributes[:'one_of']).is_a?(Array) + self.one_of = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + one_of == o.one_of && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [one_of].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/gender_demographic_filter_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/gender_demographic_filter_all_of.rb new file mode 100644 index 00000000..9d1a44b8 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/gender_demographic_filter_all_of.rb @@ -0,0 +1,221 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class GenderDemographicFilterAllOf + attr_accessor :one_of + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'one_of' => :'oneOf' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'one_of' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::GenderDemographicFilterAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::GenderDemographicFilterAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'one_of') + if (value = attributes[:'one_of']).is_a?(Array) + self.one_of = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + one_of == o.one_of + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [one_of].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/get_aggregation_unit_name_list_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/get_aggregation_unit_name_list_response.rb new file mode 100644 index 00000000..17e6e38e --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/get_aggregation_unit_name_list_response.rb @@ -0,0 +1,239 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class GetAggregationUnitNameListResponse + # An array of strings indicating the names of aggregation units used this month. + attr_accessor :custom_aggregation_units + + # A continuation token to get the next array of unit names. Returned only when there are remaining aggregation units that weren't returned in customAggregationUnits in the original request. + attr_accessor :_next + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'custom_aggregation_units' => :'customAggregationUnits', + :'_next' => :'next' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'custom_aggregation_units' => :'Array', + :'_next' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::GetAggregationUnitNameListResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::GetAggregationUnitNameListResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'custom_aggregation_units') + if (value = attributes[:'custom_aggregation_units']).is_a?(Array) + self.custom_aggregation_units = value + end + else + self.custom_aggregation_units = nil + end + + if attributes.key?(:'_next') + self._next = attributes[:'_next'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @custom_aggregation_units.nil? + invalid_properties.push('invalid value for "custom_aggregation_units", custom_aggregation_units cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @custom_aggregation_units.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + custom_aggregation_units == o.custom_aggregation_units && + _next == o._next + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [custom_aggregation_units, _next].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/get_aggregation_unit_usage_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/get_aggregation_unit_usage_response.rb new file mode 100644 index 00000000..8b070fdc --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/get_aggregation_unit_usage_response.rb @@ -0,0 +1,227 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class GetAggregationUnitUsageResponse + # Number of aggregation units used this month. + attr_accessor :num_of_custom_aggregation_units + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'num_of_custom_aggregation_units' => :'numOfCustomAggregationUnits' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'num_of_custom_aggregation_units' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::GetAggregationUnitUsageResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::GetAggregationUnitUsageResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'num_of_custom_aggregation_units') + self.num_of_custom_aggregation_units = attributes[:'num_of_custom_aggregation_units'] + else + self.num_of_custom_aggregation_units = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @num_of_custom_aggregation_units.nil? + invalid_properties.push('invalid value for "num_of_custom_aggregation_units", num_of_custom_aggregation_units cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @num_of_custom_aggregation_units.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + num_of_custom_aggregation_units == o.num_of_custom_aggregation_units + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [num_of_custom_aggregation_units].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/get_followers_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/get_followers_response.rb new file mode 100644 index 00000000..b39b33a0 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/get_followers_response.rb @@ -0,0 +1,258 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class GetFollowersResponse + # An array of strings indicating user IDs of users that have added the LINE Official Account as a friend. Only users of LINE for iOS and LINE for Android are included in `userIds`. + attr_accessor :user_ids + + # A continuation token to get the next array of user IDs. Returned only when there are remaining user IDs that weren't returned in `userIds` in the original request. The number of user IDs in the `userIds` element doesn't have to reach the maximum number specified by `limit` for the `next` property to be included in the response. + attr_accessor :_next + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'user_ids' => :'userIds', + :'_next' => :'next' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'user_ids' => :'Array', + :'_next' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::GetFollowersResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::GetFollowersResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'user_ids') + if (value = attributes[:'user_ids']).is_a?(Array) + self.user_ids = value + end + else + self.user_ids = nil + end + + if attributes.key?(:'_next') + self._next = attributes[:'_next'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @user_ids.nil? + invalid_properties.push('invalid value for "user_ids", user_ids cannot be nil.') + end + + if @user_ids.length > 1000 + invalid_properties.push('invalid value for "user_ids", number of items must be less than or equal to 1000.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @user_ids.nil? + return false if @user_ids.length > 1000 + true + end + + # Custom attribute writer method with validation + # @param [Object] user_ids Value to be assigned + def user_ids=(user_ids) + if user_ids.nil? + fail ArgumentError, 'user_ids cannot be nil' + end + + if user_ids.length > 1000 + fail ArgumentError, 'invalid value for "user_ids", number of items must be less than or equal to 1000.' + end + + @user_ids = user_ids + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + user_ids == o.user_ids && + _next == o._next + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [user_ids, _next].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/get_message_content_transcoding_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/get_message_content_transcoding_response.rb new file mode 100644 index 00000000..d02d728b --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/get_message_content_transcoding_response.rb @@ -0,0 +1,262 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + # Transcoding response + class GetMessageContentTranscodingResponse + # The preparation status. One of: `processing`: Preparing to get content. `succeeded`: Ready to get the content. You can get the content sent by users. `failed`: Failed to prepare to get the content. + attr_accessor :status + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'status' => :'status' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'status' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::GetMessageContentTranscodingResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::GetMessageContentTranscodingResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @status.nil? + invalid_properties.push('invalid value for "status", status cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @status.nil? + status_validator = EnumAttributeValidator.new('String', ["processing", "succeeded", "failed"]) + return false unless status_validator.valid?(@status) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] status Object to be assigned + def status=(status) + validator = EnumAttributeValidator.new('String', ["processing", "succeeded", "failed"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + status == o.status + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [status].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/get_webhook_endpoint_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/get_webhook_endpoint_response.rb new file mode 100644 index 00000000..10538584 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/get_webhook_endpoint_response.rb @@ -0,0 +1,244 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class GetWebhookEndpointResponse + # Webhook URL + attr_accessor :endpoint + + # Webhook usage status. Send a webhook event from the LINE Platform to the webhook URL only if enabled. `true`: Webhook usage is enabled. `false`: Webhook usage is disabled. + attr_accessor :active + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'endpoint' => :'endpoint', + :'active' => :'active' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'endpoint' => :'String', + :'active' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::GetWebhookEndpointResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::GetWebhookEndpointResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'endpoint') + self.endpoint = attributes[:'endpoint'] + else + self.endpoint = nil + end + + if attributes.key?(:'active') + self.active = attributes[:'active'] + else + self.active = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @endpoint.nil? + invalid_properties.push('invalid value for "endpoint", endpoint cannot be nil.') + end + + if @active.nil? + invalid_properties.push('invalid value for "active", active cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @endpoint.nil? + return false if @active.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + endpoint == o.endpoint && + active == o.active + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [endpoint, active].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/group_member_count_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/group_member_count_response.rb new file mode 100644 index 00000000..cfcabcae --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/group_member_count_response.rb @@ -0,0 +1,227 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class GroupMemberCountResponse + # The count of members in the group chat. The number returned excludes the LINE Official Account. + attr_accessor :count + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'count' => :'count' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'count' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::GroupMemberCountResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::GroupMemberCountResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'count') + self.count = attributes[:'count'] + else + self.count = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @count.nil? + invalid_properties.push('invalid value for "count", count cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @count.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + count == o.count + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [count].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/group_summary_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/group_summary_response.rb new file mode 100644 index 00000000..bb671c5b --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/group_summary_response.rb @@ -0,0 +1,254 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class GroupSummaryResponse + # Group ID + attr_accessor :group_id + + # Group name + attr_accessor :group_name + + # Group icon URL. Not included in the response if the user doesn't set a group profile icon. + attr_accessor :picture_url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'group_id' => :'groupId', + :'group_name' => :'groupName', + :'picture_url' => :'pictureUrl' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'group_id' => :'String', + :'group_name' => :'String', + :'picture_url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::GroupSummaryResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::GroupSummaryResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'group_id') + self.group_id = attributes[:'group_id'] + else + self.group_id = nil + end + + if attributes.key?(:'group_name') + self.group_name = attributes[:'group_name'] + else + self.group_name = nil + end + + if attributes.key?(:'picture_url') + self.picture_url = attributes[:'picture_url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @group_id.nil? + invalid_properties.push('invalid value for "group_id", group_id cannot be nil.') + end + + if @group_name.nil? + invalid_properties.push('invalid value for "group_name", group_name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @group_id.nil? + return false if @group_name.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + group_id == o.group_id && + group_name == o.group_name && + picture_url == o.picture_url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [group_id, group_name, picture_url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/group_user_profile_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/group_user_profile_response.rb new file mode 100644 index 00000000..1678d027 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/group_user_profile_response.rb @@ -0,0 +1,254 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class GroupUserProfileResponse + # User's display name + attr_accessor :display_name + + # User ID + attr_accessor :user_id + + # Profile image URL. `https` image URL. Not included in the response if the user doesn't have a profile image. + attr_accessor :picture_url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'display_name' => :'displayName', + :'user_id' => :'userId', + :'picture_url' => :'pictureUrl' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'display_name' => :'String', + :'user_id' => :'String', + :'picture_url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::GroupUserProfileResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::GroupUserProfileResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'display_name') + self.display_name = attributes[:'display_name'] + else + self.display_name = nil + end + + if attributes.key?(:'user_id') + self.user_id = attributes[:'user_id'] + else + self.user_id = nil + end + + if attributes.key?(:'picture_url') + self.picture_url = attributes[:'picture_url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @display_name.nil? + invalid_properties.push('invalid value for "display_name", display_name cannot be nil.') + end + + if @user_id.nil? + invalid_properties.push('invalid value for "user_id", user_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @display_name.nil? + return false if @user_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + display_name == o.display_name && + user_id == o.user_id && + picture_url == o.picture_url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [display_name, user_id, picture_url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/image_carousel_column.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/image_carousel_column.rb new file mode 100644 index 00000000..006737d5 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/image_carousel_column.rb @@ -0,0 +1,228 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class ImageCarouselColumn + attr_accessor :image_url + + attr_accessor :action + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'image_url' => :'imageUrl', + :'action' => :'action' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'image_url' => :'String', + :'action' => :'Action' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::ImageCarouselColumn` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::ImageCarouselColumn`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'image_url') + self.image_url = attributes[:'image_url'] + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + image_url == o.image_url && + action == o.action + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [image_url, action].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/image_carousel_template.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/image_carousel_template.rb new file mode 100644 index 00000000..667a06d3 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/image_carousel_template.rb @@ -0,0 +1,232 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class ImageCarouselTemplate < Template + attr_accessor :columns + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'columns' => :'columns' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'columns' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Template' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::ImageCarouselTemplate` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::ImageCarouselTemplate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'columns') + if (value = attributes[:'columns']).is_a?(Array) + self.columns = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + columns == o.columns && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [columns].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/image_carousel_template_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/image_carousel_template_all_of.rb new file mode 100644 index 00000000..9a1e860a --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/image_carousel_template_all_of.rb @@ -0,0 +1,221 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class ImageCarouselTemplateAllOf + attr_accessor :columns + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'columns' => :'columns' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'columns' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::ImageCarouselTemplateAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::ImageCarouselTemplateAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'columns') + if (value = attributes[:'columns']).is_a?(Array) + self.columns = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + columns == o.columns + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [columns].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/image_message.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/image_message.rb new file mode 100644 index 00000000..faa0d8dc --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/image_message.rb @@ -0,0 +1,239 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class ImageMessage < Message + attr_accessor :original_content_url + + attr_accessor :preview_image_url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'original_content_url' => :'originalContentUrl', + :'preview_image_url' => :'previewImageUrl' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'original_content_url' => :'String', + :'preview_image_url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Message' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::ImageMessage` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::ImageMessage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'original_content_url') + self.original_content_url = attributes[:'original_content_url'] + end + + if attributes.key?(:'preview_image_url') + self.preview_image_url = attributes[:'preview_image_url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + original_content_url == o.original_content_url && + preview_image_url == o.preview_image_url && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [original_content_url, preview_image_url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/image_message_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/image_message_all_of.rb new file mode 100644 index 00000000..dc20dfe8 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/image_message_all_of.rb @@ -0,0 +1,228 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class ImageMessageAllOf + attr_accessor :original_content_url + + attr_accessor :preview_image_url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'original_content_url' => :'originalContentUrl', + :'preview_image_url' => :'previewImageUrl' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'original_content_url' => :'String', + :'preview_image_url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::ImageMessageAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::ImageMessageAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'original_content_url') + self.original_content_url = attributes[:'original_content_url'] + end + + if attributes.key?(:'preview_image_url') + self.preview_image_url = attributes[:'preview_image_url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + original_content_url == o.original_content_url && + preview_image_url == o.preview_image_url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [original_content_url, preview_image_url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/imagemap_action.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/imagemap_action.rb new file mode 100644 index 00000000..e5a6ed67 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/imagemap_action.rb @@ -0,0 +1,240 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class ImagemapAction + attr_accessor :type + + attr_accessor :area + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'area' => :'area' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'area' => :'ImagemapArea' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # discriminator's property name in OpenAPI v3 + def self.openapi_discriminator_name + :'type' + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::ImagemapAction` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::ImagemapAction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = nil + end + + if attributes.key?(:'area') + self.area = attributes[:'area'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @type.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + area == o.area + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, area].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/imagemap_area.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/imagemap_area.rb new file mode 100644 index 00000000..88efa887 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/imagemap_area.rb @@ -0,0 +1,246 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class ImagemapArea + attr_accessor :x + + attr_accessor :y + + attr_accessor :width + + attr_accessor :height + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'x' => :'x', + :'y' => :'y', + :'width' => :'width', + :'height' => :'height' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'x' => :'Integer', + :'y' => :'Integer', + :'width' => :'Integer', + :'height' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::ImagemapArea` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::ImagemapArea`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'x') + self.x = attributes[:'x'] + end + + if attributes.key?(:'y') + self.y = attributes[:'y'] + end + + if attributes.key?(:'width') + self.width = attributes[:'width'] + end + + if attributes.key?(:'height') + self.height = attributes[:'height'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + x == o.x && + y == o.y && + width == o.width && + height == o.height + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [x, y, width, height].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/imagemap_base_size.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/imagemap_base_size.rb new file mode 100644 index 00000000..55ca46eb --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/imagemap_base_size.rb @@ -0,0 +1,228 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class ImagemapBaseSize + attr_accessor :height + + attr_accessor :width + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'height' => :'height', + :'width' => :'width' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'height' => :'Integer', + :'width' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::ImagemapBaseSize` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::ImagemapBaseSize`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'height') + self.height = attributes[:'height'] + end + + if attributes.key?(:'width') + self.width = attributes[:'width'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + height == o.height && + width == o.width + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [height, width].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/imagemap_external_link.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/imagemap_external_link.rb new file mode 100644 index 00000000..e1cf841c --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/imagemap_external_link.rb @@ -0,0 +1,228 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class ImagemapExternalLink + attr_accessor :link_uri + + attr_accessor :label + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'link_uri' => :'linkUri', + :'label' => :'label' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'link_uri' => :'String', + :'label' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::ImagemapExternalLink` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::ImagemapExternalLink`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'link_uri') + self.link_uri = attributes[:'link_uri'] + end + + if attributes.key?(:'label') + self.label = attributes[:'label'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + link_uri == o.link_uri && + label == o.label + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [link_uri, label].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/imagemap_message.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/imagemap_message.rb new file mode 100644 index 00000000..2fc05086 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/imagemap_message.rb @@ -0,0 +1,268 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class ImagemapMessage < Message + attr_accessor :base_url + + attr_accessor :alt_text + + attr_accessor :base_size + + attr_accessor :actions + + attr_accessor :video + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'base_url' => :'baseUrl', + :'alt_text' => :'altText', + :'base_size' => :'baseSize', + :'actions' => :'actions', + :'video' => :'video' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'base_url' => :'String', + :'alt_text' => :'String', + :'base_size' => :'ImagemapBaseSize', + :'actions' => :'Array', + :'video' => :'ImagemapVideo' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Message' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::ImagemapMessage` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::ImagemapMessage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'base_url') + self.base_url = attributes[:'base_url'] + end + + if attributes.key?(:'alt_text') + self.alt_text = attributes[:'alt_text'] + end + + if attributes.key?(:'base_size') + self.base_size = attributes[:'base_size'] + end + + if attributes.key?(:'actions') + if (value = attributes[:'actions']).is_a?(Array) + self.actions = value + end + end + + if attributes.key?(:'video') + self.video = attributes[:'video'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + base_url == o.base_url && + alt_text == o.alt_text && + base_size == o.base_size && + actions == o.actions && + video == o.video && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [base_url, alt_text, base_size, actions, video].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/imagemap_message_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/imagemap_message_all_of.rb new file mode 100644 index 00000000..406ddbab --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/imagemap_message_all_of.rb @@ -0,0 +1,257 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class ImagemapMessageAllOf + attr_accessor :base_url + + attr_accessor :alt_text + + attr_accessor :base_size + + attr_accessor :actions + + attr_accessor :video + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'base_url' => :'baseUrl', + :'alt_text' => :'altText', + :'base_size' => :'baseSize', + :'actions' => :'actions', + :'video' => :'video' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'base_url' => :'String', + :'alt_text' => :'String', + :'base_size' => :'ImagemapBaseSize', + :'actions' => :'Array', + :'video' => :'ImagemapVideo' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::ImagemapMessageAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::ImagemapMessageAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'base_url') + self.base_url = attributes[:'base_url'] + end + + if attributes.key?(:'alt_text') + self.alt_text = attributes[:'alt_text'] + end + + if attributes.key?(:'base_size') + self.base_size = attributes[:'base_size'] + end + + if attributes.key?(:'actions') + if (value = attributes[:'actions']).is_a?(Array) + self.actions = value + end + end + + if attributes.key?(:'video') + self.video = attributes[:'video'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + base_url == o.base_url && + alt_text == o.alt_text && + base_size == o.base_size && + actions == o.actions && + video == o.video + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [base_url, alt_text, base_size, actions, video].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/imagemap_video.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/imagemap_video.rb new file mode 100644 index 00000000..05bd0251 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/imagemap_video.rb @@ -0,0 +1,246 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class ImagemapVideo + attr_accessor :original_content_url + + attr_accessor :preview_image_url + + attr_accessor :area + + attr_accessor :external_link + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'original_content_url' => :'originalContentUrl', + :'preview_image_url' => :'previewImageUrl', + :'area' => :'area', + :'external_link' => :'externalLink' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'original_content_url' => :'String', + :'preview_image_url' => :'String', + :'area' => :'ImagemapArea', + :'external_link' => :'ImagemapExternalLink' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::ImagemapVideo` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::ImagemapVideo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'original_content_url') + self.original_content_url = attributes[:'original_content_url'] + end + + if attributes.key?(:'preview_image_url') + self.preview_image_url = attributes[:'preview_image_url'] + end + + if attributes.key?(:'area') + self.area = attributes[:'area'] + end + + if attributes.key?(:'external_link') + self.external_link = attributes[:'external_link'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + original_content_url == o.original_content_url && + preview_image_url == o.preview_image_url && + area == o.area && + external_link == o.external_link + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [original_content_url, preview_image_url, area, external_link].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/issue_link_token_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/issue_link_token_response.rb new file mode 100644 index 00000000..3f47e6a3 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/issue_link_token_response.rb @@ -0,0 +1,227 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class IssueLinkTokenResponse + # Link token. Link tokens are valid for 10 minutes and can only be used once. + attr_accessor :link_token + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'link_token' => :'linkToken' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'link_token' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::IssueLinkTokenResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::IssueLinkTokenResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'link_token') + self.link_token = attributes[:'link_token'] + else + self.link_token = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @link_token.nil? + invalid_properties.push('invalid value for "link_token", link_token cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @link_token.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + link_token == o.link_token + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [link_token].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/limit.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/limit.rb new file mode 100644 index 00000000..a322090f --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/limit.rb @@ -0,0 +1,252 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + # Limit of the Narrowcast + class Limit + # The maximum number of narrowcast messages to send. Use this parameter to limit the number of narrowcast messages sent. The recipients will be chosen at random. + attr_accessor :max + + # If true, the message will be sent within the maximum number of deliverable messages. The default value is `false`. Targets will be selected at random. + attr_accessor :up_to_remaining_quota + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'max' => :'max', + :'up_to_remaining_quota' => :'upToRemainingQuota' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'max' => :'Integer', + :'up_to_remaining_quota' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::Limit` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::Limit`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'max') + self.max = attributes[:'max'] + end + + if attributes.key?(:'up_to_remaining_quota') + self.up_to_remaining_quota = attributes[:'up_to_remaining_quota'] + else + self.up_to_remaining_quota = false + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@max.nil? && @max < 1 + invalid_properties.push('invalid value for "max", must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@max.nil? && @max < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] max Value to be assigned + def max=(max) + if max.nil? + fail ArgumentError, 'max cannot be nil' + end + + if max < 1 + fail ArgumentError, 'invalid value for "max", must be greater than or equal to 1.' + end + + @max = max + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + max == o.max && + up_to_remaining_quota == o.up_to_remaining_quota + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [max, up_to_remaining_quota].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/location_action.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/location_action.rb new file mode 100644 index 00000000..46971782 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/location_action.rb @@ -0,0 +1,221 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class LocationAction < Action + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Action' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::LocationAction` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::LocationAction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/location_message.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/location_message.rb new file mode 100644 index 00000000..bdbb681c --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/location_message.rb @@ -0,0 +1,257 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class LocationMessage < Message + attr_accessor :title + + attr_accessor :address + + attr_accessor :latitude + + attr_accessor :longitude + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'title' => :'title', + :'address' => :'address', + :'latitude' => :'latitude', + :'longitude' => :'longitude' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'title' => :'String', + :'address' => :'String', + :'latitude' => :'Float', + :'longitude' => :'Float' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Message' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::LocationMessage` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::LocationMessage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'latitude') + self.latitude = attributes[:'latitude'] + end + + if attributes.key?(:'longitude') + self.longitude = attributes[:'longitude'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + title == o.title && + address == o.address && + latitude == o.latitude && + longitude == o.longitude && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [title, address, latitude, longitude].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/location_message_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/location_message_all_of.rb new file mode 100644 index 00000000..d0aff8dd --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/location_message_all_of.rb @@ -0,0 +1,246 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class LocationMessageAllOf + attr_accessor :title + + attr_accessor :address + + attr_accessor :latitude + + attr_accessor :longitude + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'title' => :'title', + :'address' => :'address', + :'latitude' => :'latitude', + :'longitude' => :'longitude' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'title' => :'String', + :'address' => :'String', + :'latitude' => :'Float', + :'longitude' => :'Float' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::LocationMessageAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::LocationMessageAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'latitude') + self.latitude = attributes[:'latitude'] + end + + if attributes.key?(:'longitude') + self.longitude = attributes[:'longitude'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + title == o.title && + address == o.address && + latitude == o.latitude && + longitude == o.longitude + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [title, address, latitude, longitude].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/mark_messages_as_read_request.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/mark_messages_as_read_request.rb new file mode 100644 index 00000000..d1e15a49 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/mark_messages_as_read_request.rb @@ -0,0 +1,226 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class MarkMessagesAsReadRequest + attr_accessor :chat + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'chat' => :'chat' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'chat' => :'ChatReference' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::MarkMessagesAsReadRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::MarkMessagesAsReadRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'chat') + self.chat = attributes[:'chat'] + else + self.chat = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @chat.nil? + invalid_properties.push('invalid value for "chat", chat cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @chat.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + chat == o.chat + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [chat].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/members_ids_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/members_ids_response.rb new file mode 100644 index 00000000..4cde702b --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/members_ids_response.rb @@ -0,0 +1,258 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class MembersIdsResponse + # List of user IDs of members in the group chat. Only users of LINE for iOS and LINE for Android are included in `memberIds`. + attr_accessor :member_ids + + # A continuation token to get the next array of user IDs of the members in the group chat. Returned only when there are remaining user IDs that were not returned in `memberIds` in the original request. + attr_accessor :_next + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'member_ids' => :'memberIds', + :'_next' => :'next' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'member_ids' => :'Array', + :'_next' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::MembersIdsResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::MembersIdsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'member_ids') + if (value = attributes[:'member_ids']).is_a?(Array) + self.member_ids = value + end + else + self.member_ids = nil + end + + if attributes.key?(:'_next') + self._next = attributes[:'_next'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @member_ids.nil? + invalid_properties.push('invalid value for "member_ids", member_ids cannot be nil.') + end + + if @member_ids.length > 100 + invalid_properties.push('invalid value for "member_ids", number of items must be less than or equal to 100.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @member_ids.nil? + return false if @member_ids.length > 100 + true + end + + # Custom attribute writer method with validation + # @param [Object] member_ids Value to be assigned + def member_ids=(member_ids) + if member_ids.nil? + fail ArgumentError, 'member_ids cannot be nil' + end + + if member_ids.length > 100 + fail ArgumentError, 'invalid value for "member_ids", number of items must be less than or equal to 100.' + end + + @member_ids = member_ids + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + member_ids == o.member_ids && + _next == o._next + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [member_ids, _next].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/message.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/message.rb new file mode 100644 index 00000000..7193b0ae --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/message.rb @@ -0,0 +1,250 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class Message + # Type of message + attr_accessor :type + + attr_accessor :quick_reply + + attr_accessor :sender + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'quick_reply' => :'quickReply', + :'sender' => :'sender' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'quick_reply' => :'QuickReply', + :'sender' => :'Sender' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # discriminator's property name in OpenAPI v3 + def self.openapi_discriminator_name + :'type' + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::Message` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::Message`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = nil + end + + if attributes.key?(:'quick_reply') + self.quick_reply = attributes[:'quick_reply'] + end + + if attributes.key?(:'sender') + self.sender = attributes[:'sender'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @type.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + quick_reply == o.quick_reply && + sender == o.sender + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, quick_reply, sender].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/message_action.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/message_action.rb new file mode 100644 index 00000000..d2fcba83 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/message_action.rb @@ -0,0 +1,230 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class MessageAction < Action + attr_accessor :text + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'text' => :'text' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'text' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Action' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::MessageAction` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::MessageAction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'text') + self.text = attributes[:'text'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + text == o.text && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [text].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/message_action_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/message_action_all_of.rb new file mode 100644 index 00000000..266d4bfc --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/message_action_all_of.rb @@ -0,0 +1,219 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class MessageActionAllOf + attr_accessor :text + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'text' => :'text' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'text' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::MessageActionAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::MessageActionAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'text') + self.text = attributes[:'text'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + text == o.text + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [text].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/message_imagemap_action.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/message_imagemap_action.rb new file mode 100644 index 00000000..32a13103 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/message_imagemap_action.rb @@ -0,0 +1,239 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class MessageImagemapAction < ImagemapAction + attr_accessor :text + + attr_accessor :label + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'text' => :'text', + :'label' => :'label' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'text' => :'String', + :'label' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ImagemapAction' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::MessageImagemapAction` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::MessageImagemapAction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'text') + self.text = attributes[:'text'] + end + + if attributes.key?(:'label') + self.label = attributes[:'label'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + text == o.text && + label == o.label && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [text, label].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/message_imagemap_action_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/message_imagemap_action_all_of.rb new file mode 100644 index 00000000..f69fff0c --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/message_imagemap_action_all_of.rb @@ -0,0 +1,228 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class MessageImagemapActionAllOf + attr_accessor :text + + attr_accessor :label + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'text' => :'text', + :'label' => :'label' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'text' => :'String', + :'label' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::MessageImagemapActionAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::MessageImagemapActionAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'text') + self.text = attributes[:'text'] + end + + if attributes.key?(:'label') + self.label = attributes[:'label'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + text == o.text && + label == o.label + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [text, label].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/message_quota_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/message_quota_response.rb new file mode 100644 index 00000000..3c77b70d --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/message_quota_response.rb @@ -0,0 +1,258 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class MessageQuotaResponse + attr_accessor :type + + # The target limit for sending messages in the current month. This property is returned when the `type` property has a value of `limited`. + attr_accessor :value + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'value' => :'value' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'QuotaType', + :'value' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::MessageQuotaResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::MessageQuotaResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = nil + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @type.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + value == o.value + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, value].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/multicast_request.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/multicast_request.rb new file mode 100644 index 00000000..45480343 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/multicast_request.rb @@ -0,0 +1,347 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class MulticastRequest + # Messages to send + attr_accessor :messages + + # Array of user IDs. Use userId values which are returned in webhook event objects. Do not use LINE IDs found on LINE. + attr_accessor :to + + # `true`: The user doesn’t receive a push notification when a message is sent. `false`: The user receives a push notification when the message is sent (unless they have disabled push notifications in LINE and/or their device). The default value is false. + attr_accessor :notification_disabled + + # Name of aggregation unit. Case-sensitive. + attr_accessor :custom_aggregation_units + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'messages' => :'messages', + :'to' => :'to', + :'notification_disabled' => :'notificationDisabled', + :'custom_aggregation_units' => :'customAggregationUnits' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'messages' => :'Array', + :'to' => :'Array', + :'notification_disabled' => :'Boolean', + :'custom_aggregation_units' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::MulticastRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::MulticastRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'messages') + if (value = attributes[:'messages']).is_a?(Array) + self.messages = value + end + else + self.messages = nil + end + + if attributes.key?(:'to') + if (value = attributes[:'to']).is_a?(Array) + self.to = value + end + else + self.to = nil + end + + if attributes.key?(:'notification_disabled') + self.notification_disabled = attributes[:'notification_disabled'] + else + self.notification_disabled = false + end + + if attributes.key?(:'custom_aggregation_units') + if (value = attributes[:'custom_aggregation_units']).is_a?(Array) + self.custom_aggregation_units = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @messages.nil? + invalid_properties.push('invalid value for "messages", messages cannot be nil.') + end + + if @messages.length > 5 + invalid_properties.push('invalid value for "messages", number of items must be less than or equal to 5.') + end + + if @messages.length < 1 + invalid_properties.push('invalid value for "messages", number of items must be greater than or equal to 1.') + end + + if @to.nil? + invalid_properties.push('invalid value for "to", to cannot be nil.') + end + + if @to.length > 500 + invalid_properties.push('invalid value for "to", number of items must be less than or equal to 500.') + end + + if @to.length < 1 + invalid_properties.push('invalid value for "to", number of items must be greater than or equal to 1.') + end + + if !@custom_aggregation_units.nil? && @custom_aggregation_units.length > 1 + invalid_properties.push('invalid value for "custom_aggregation_units", number of items must be less than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @messages.nil? + return false if @messages.length > 5 + return false if @messages.length < 1 + return false if @to.nil? + return false if @to.length > 500 + return false if @to.length < 1 + return false if !@custom_aggregation_units.nil? && @custom_aggregation_units.length > 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] messages Value to be assigned + def messages=(messages) + if messages.nil? + fail ArgumentError, 'messages cannot be nil' + end + + if messages.length > 5 + fail ArgumentError, 'invalid value for "messages", number of items must be less than or equal to 5.' + end + + if messages.length < 1 + fail ArgumentError, 'invalid value for "messages", number of items must be greater than or equal to 1.' + end + + @messages = messages + end + + # Custom attribute writer method with validation + # @param [Object] to Value to be assigned + def to=(to) + if to.nil? + fail ArgumentError, 'to cannot be nil' + end + + if to.length > 500 + fail ArgumentError, 'invalid value for "to", number of items must be less than or equal to 500.' + end + + if to.length < 1 + fail ArgumentError, 'invalid value for "to", number of items must be greater than or equal to 1.' + end + + @to = to + end + + # Custom attribute writer method with validation + # @param [Object] custom_aggregation_units Value to be assigned + def custom_aggregation_units=(custom_aggregation_units) + if custom_aggregation_units.nil? + fail ArgumentError, 'custom_aggregation_units cannot be nil' + end + + if custom_aggregation_units.length > 1 + fail ArgumentError, 'invalid value for "custom_aggregation_units", number of items must be less than or equal to 1.' + end + + @custom_aggregation_units = custom_aggregation_units + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + messages == o.messages && + to == o.to && + notification_disabled == o.notification_disabled && + custom_aggregation_units == o.custom_aggregation_units + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [messages, to, notification_disabled, custom_aggregation_units].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/narrowcast_progress_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/narrowcast_progress_response.rb new file mode 100644 index 00000000..4f61dd99 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/narrowcast_progress_response.rb @@ -0,0 +1,338 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class NarrowcastProgressResponse + # The current status. One of: `waiting`: Messages are not yet ready to be sent. They are currently being filtered or processed in some way. `sending`: Messages are currently being sent. `succeeded`: Messages were sent successfully. This may not mean the messages were successfully received. `failed`: Messages failed to be sent. Use the failedDescription property to find the cause of the failure. + attr_accessor :phase + + # The number of users who successfully received the message. + attr_accessor :success_count + + # The number of users who failed to send the message. + attr_accessor :failure_count + + # The number of intended recipients of the message. + attr_accessor :target_count + + # The reason the message failed to be sent. This is only included with a `phase` property value of `failed`. + attr_accessor :failed_description + + # Error summary. This is only included with a phase property value of failed. One of: `1`: An internal error occurred. `2`: An error occurred because there weren't enough recipients. `3`: A conflict error of requests occurs because a request that has already been accepted is retried. + attr_accessor :error_code + + # Narrowcast message request accepted time in milliseconds. Format: ISO 8601 (e.g. 2020-12-03T10:15:30.121Z) Timezone: UTC + attr_accessor :accepted_time + + # Processing of narrowcast message request completion time in milliseconds. Returned when the phase property is succeeded or failed. Format: ISO 8601 (e.g. 2020-12-03T10:15:30.121Z) Timezone: UTC + attr_accessor :completed_time + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'phase' => :'phase', + :'success_count' => :'successCount', + :'failure_count' => :'failureCount', + :'target_count' => :'targetCount', + :'failed_description' => :'failedDescription', + :'error_code' => :'errorCode', + :'accepted_time' => :'acceptedTime', + :'completed_time' => :'completedTime' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'phase' => :'String', + :'success_count' => :'Integer', + :'failure_count' => :'Integer', + :'target_count' => :'Integer', + :'failed_description' => :'String', + :'error_code' => :'Integer', + :'accepted_time' => :'Time', + :'completed_time' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::NarrowcastProgressResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::NarrowcastProgressResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'phase') + self.phase = attributes[:'phase'] + else + self.phase = nil + end + + if attributes.key?(:'success_count') + self.success_count = attributes[:'success_count'] + end + + if attributes.key?(:'failure_count') + self.failure_count = attributes[:'failure_count'] + end + + if attributes.key?(:'target_count') + self.target_count = attributes[:'target_count'] + end + + if attributes.key?(:'failed_description') + self.failed_description = attributes[:'failed_description'] + end + + if attributes.key?(:'error_code') + self.error_code = attributes[:'error_code'] + end + + if attributes.key?(:'accepted_time') + self.accepted_time = attributes[:'accepted_time'] + else + self.accepted_time = nil + end + + if attributes.key?(:'completed_time') + self.completed_time = attributes[:'completed_time'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @phase.nil? + invalid_properties.push('invalid value for "phase", phase cannot be nil.') + end + + if @accepted_time.nil? + invalid_properties.push('invalid value for "accepted_time", accepted_time cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @phase.nil? + phase_validator = EnumAttributeValidator.new('String', ["waiting", "sending", "succeeded", "failed"]) + return false unless phase_validator.valid?(@phase) + return false if @accepted_time.nil? + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] phase Object to be assigned + def phase=(phase) + validator = EnumAttributeValidator.new('String', ["waiting", "sending", "succeeded", "failed"]) + unless validator.valid?(phase) + fail ArgumentError, "invalid value for \"phase\", must be one of #{validator.allowable_values}." + end + @phase = phase + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + phase == o.phase && + success_count == o.success_count && + failure_count == o.failure_count && + target_count == o.target_count && + failed_description == o.failed_description && + error_code == o.error_code && + accepted_time == o.accepted_time && + completed_time == o.completed_time + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [phase, success_count, failure_count, target_count, failed_description, error_code, accepted_time, completed_time].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/narrowcast_request.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/narrowcast_request.rb new file mode 100644 index 00000000..51d85cfb --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/narrowcast_request.rb @@ -0,0 +1,296 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class NarrowcastRequest + # List of Message objects. + attr_accessor :messages + + attr_accessor :recipient + + attr_accessor :filter + + attr_accessor :limit + + # `true`: The user doesn’t receive a push notification when a message is sent. `false`: The user receives a push notification when the message is sent (unless they have disabled push notifications in LINE and/or their device). The default value is false. + attr_accessor :notification_disabled + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'messages' => :'messages', + :'recipient' => :'recipient', + :'filter' => :'filter', + :'limit' => :'limit', + :'notification_disabled' => :'notificationDisabled' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'messages' => :'Array', + :'recipient' => :'Recipient', + :'filter' => :'Filter', + :'limit' => :'Limit', + :'notification_disabled' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::NarrowcastRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::NarrowcastRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'messages') + if (value = attributes[:'messages']).is_a?(Array) + self.messages = value + end + else + self.messages = nil + end + + if attributes.key?(:'recipient') + self.recipient = attributes[:'recipient'] + end + + if attributes.key?(:'filter') + self.filter = attributes[:'filter'] + end + + if attributes.key?(:'limit') + self.limit = attributes[:'limit'] + end + + if attributes.key?(:'notification_disabled') + self.notification_disabled = attributes[:'notification_disabled'] + else + self.notification_disabled = false + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @messages.nil? + invalid_properties.push('invalid value for "messages", messages cannot be nil.') + end + + if @messages.length > 5 + invalid_properties.push('invalid value for "messages", number of items must be less than or equal to 5.') + end + + if @messages.length < 1 + invalid_properties.push('invalid value for "messages", number of items must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @messages.nil? + return false if @messages.length > 5 + return false if @messages.length < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] messages Value to be assigned + def messages=(messages) + if messages.nil? + fail ArgumentError, 'messages cannot be nil' + end + + if messages.length > 5 + fail ArgumentError, 'invalid value for "messages", number of items must be less than or equal to 5.' + end + + if messages.length < 1 + fail ArgumentError, 'invalid value for "messages", number of items must be greater than or equal to 1.' + end + + @messages = messages + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + messages == o.messages && + recipient == o.recipient && + filter == o.filter && + limit == o.limit && + notification_disabled == o.notification_disabled + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [messages, recipient, filter, limit, notification_disabled].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/number_of_messages_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/number_of_messages_response.rb new file mode 100644 index 00000000..3242ea22 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/number_of_messages_response.rb @@ -0,0 +1,271 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class NumberOfMessagesResponse + # Aggregation process status. One of: `ready`: The number of messages can be obtained. `unready`: We haven't finished calculating the number of sent messages for the specified in date. For example, this property is returned when the delivery date or a future date is specified. Calculation usually takes about a day. `unavailable_for_privacy`: The total number of messages on the specified day is less than 20. `out_of_service`: The specified date is earlier than the date on which we first started calculating sent messages (March 31, 2018). + attr_accessor :status + + # The number of messages delivered using the phone number on the date specified in `date`. The response has this property only when the value of `status` is `ready`. + attr_accessor :success + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'status' => :'status', + :'success' => :'success' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'status' => :'String', + :'success' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::NumberOfMessagesResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::NumberOfMessagesResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = nil + end + + if attributes.key?(:'success') + self.success = attributes[:'success'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @status.nil? + invalid_properties.push('invalid value for "status", status cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @status.nil? + status_validator = EnumAttributeValidator.new('String', ["ready", "unready", "unavailable_for_privacy", "out_of_service"]) + return false unless status_validator.valid?(@status) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] status Object to be assigned + def status=(status) + validator = EnumAttributeValidator.new('String', ["ready", "unready", "unavailable_for_privacy", "out_of_service"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + status == o.status && + success == o.success + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [status, success].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/operator_demographic_filter.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/operator_demographic_filter.rb new file mode 100644 index 00000000..536839db --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/operator_demographic_filter.rb @@ -0,0 +1,252 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class OperatorDemographicFilter < DemographicFilter + attr_accessor :_and + + attr_accessor :_or + + attr_accessor :_not + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'_and' => :'and', + :'_or' => :'or', + :'_not' => :'not' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'_and' => :'Array', + :'_or' => :'Array', + :'_not' => :'DemographicFilter' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'DemographicFilter' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::OperatorDemographicFilter` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::OperatorDemographicFilter`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'_and') + if (value = attributes[:'_and']).is_a?(Array) + self._and = value + end + end + + if attributes.key?(:'_or') + if (value = attributes[:'_or']).is_a?(Array) + self._or = value + end + end + + if attributes.key?(:'_not') + self._not = attributes[:'_not'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + _and == o._and && + _or == o._or && + _not == o._not && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [_and, _or, _not].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/operator_demographic_filter_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/operator_demographic_filter_all_of.rb new file mode 100644 index 00000000..b4def463 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/operator_demographic_filter_all_of.rb @@ -0,0 +1,241 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class OperatorDemographicFilterAllOf + attr_accessor :_and + + attr_accessor :_or + + attr_accessor :_not + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'_and' => :'and', + :'_or' => :'or', + :'_not' => :'not' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'_and' => :'Array', + :'_or' => :'Array', + :'_not' => :'DemographicFilter' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::OperatorDemographicFilterAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::OperatorDemographicFilterAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'_and') + if (value = attributes[:'_and']).is_a?(Array) + self._and = value + end + end + + if attributes.key?(:'_or') + if (value = attributes[:'_or']).is_a?(Array) + self._or = value + end + end + + if attributes.key?(:'_not') + self._not = attributes[:'_not'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + _and == o._and && + _or == o._or && + _not == o._not + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [_and, _or, _not].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/operator_recipient.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/operator_recipient.rb new file mode 100644 index 00000000..e48a4c6c --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/operator_recipient.rb @@ -0,0 +1,254 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class OperatorRecipient < Recipient + # Create a new recipient object by taking the logical conjunction (AND) of the specified array of recipient objects. + attr_accessor :_and + + # Create a new recipient object by taking the logical disjunction (OR) of the specified array of recipient objects. + attr_accessor :_or + + attr_accessor :_not + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'_and' => :'and', + :'_or' => :'or', + :'_not' => :'not' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'_and' => :'Array', + :'_or' => :'Array', + :'_not' => :'Recipient' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Recipient' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::OperatorRecipient` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::OperatorRecipient`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'_and') + if (value = attributes[:'_and']).is_a?(Array) + self._and = value + end + end + + if attributes.key?(:'_or') + if (value = attributes[:'_or']).is_a?(Array) + self._or = value + end + end + + if attributes.key?(:'_not') + self._not = attributes[:'_not'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + _and == o._and && + _or == o._or && + _not == o._not && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [_and, _or, _not].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/operator_recipient_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/operator_recipient_all_of.rb new file mode 100644 index 00000000..505e12b7 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/operator_recipient_all_of.rb @@ -0,0 +1,243 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class OperatorRecipientAllOf + # Create a new recipient object by taking the logical conjunction (AND) of the specified array of recipient objects. + attr_accessor :_and + + # Create a new recipient object by taking the logical disjunction (OR) of the specified array of recipient objects. + attr_accessor :_or + + attr_accessor :_not + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'_and' => :'and', + :'_or' => :'or', + :'_not' => :'not' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'_and' => :'Array', + :'_or' => :'Array', + :'_not' => :'Recipient' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::OperatorRecipientAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::OperatorRecipientAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'_and') + if (value = attributes[:'_and']).is_a?(Array) + self._and = value + end + end + + if attributes.key?(:'_or') + if (value = attributes[:'_or']).is_a?(Array) + self._or = value + end + end + + if attributes.key?(:'_not') + self._not = attributes[:'_not'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + _and == o._and && + _or == o._or && + _not == o._not + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [_and, _or, _not].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/pnp_messages_request.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/pnp_messages_request.rb new file mode 100644 index 00000000..9d1264b2 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/pnp_messages_request.rb @@ -0,0 +1,286 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class PnpMessagesRequest + # Message to be sent. + attr_accessor :messages + + # Message destination. Specify a phone number that has been normalized to E.164 format and hashed with SHA256. + attr_accessor :to + + # `true`: The user doesn’t receive a push notification when a message is sent. `false`: The user receives a push notification when the message is sent (unless they have disabled push notifications in LINE and/or their device). The default value is false. + attr_accessor :notification_disabled + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'messages' => :'messages', + :'to' => :'to', + :'notification_disabled' => :'notificationDisabled' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'messages' => :'Array', + :'to' => :'String', + :'notification_disabled' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::PnpMessagesRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::PnpMessagesRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'messages') + if (value = attributes[:'messages']).is_a?(Array) + self.messages = value + end + else + self.messages = nil + end + + if attributes.key?(:'to') + self.to = attributes[:'to'] + else + self.to = nil + end + + if attributes.key?(:'notification_disabled') + self.notification_disabled = attributes[:'notification_disabled'] + else + self.notification_disabled = false + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @messages.nil? + invalid_properties.push('invalid value for "messages", messages cannot be nil.') + end + + if @messages.length > 5 + invalid_properties.push('invalid value for "messages", number of items must be less than or equal to 5.') + end + + if @messages.length < 1 + invalid_properties.push('invalid value for "messages", number of items must be greater than or equal to 1.') + end + + if @to.nil? + invalid_properties.push('invalid value for "to", to cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @messages.nil? + return false if @messages.length > 5 + return false if @messages.length < 1 + return false if @to.nil? + true + end + + # Custom attribute writer method with validation + # @param [Object] messages Value to be assigned + def messages=(messages) + if messages.nil? + fail ArgumentError, 'messages cannot be nil' + end + + if messages.length > 5 + fail ArgumentError, 'invalid value for "messages", number of items must be less than or equal to 5.' + end + + if messages.length < 1 + fail ArgumentError, 'invalid value for "messages", number of items must be greater than or equal to 1.' + end + + @messages = messages + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + messages == o.messages && + to == o.to && + notification_disabled == o.notification_disabled + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [messages, to, notification_disabled].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/postback_action.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/postback_action.rb new file mode 100644 index 00000000..7c944ef6 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/postback_action.rb @@ -0,0 +1,328 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class PostbackAction < Action + attr_accessor :data + + attr_accessor :display_text + + attr_accessor :text + + attr_accessor :input_option + + attr_accessor :fill_in_text + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data', + :'display_text' => :'displayText', + :'text' => :'text', + :'input_option' => :'inputOption', + :'fill_in_text' => :'fillInText' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'String', + :'display_text' => :'String', + :'text' => :'String', + :'input_option' => :'String', + :'fill_in_text' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Action' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::PostbackAction` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::PostbackAction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'display_text') + self.display_text = attributes[:'display_text'] + end + + if attributes.key?(:'text') + self.text = attributes[:'text'] + end + + if attributes.key?(:'input_option') + self.input_option = attributes[:'input_option'] + end + + if attributes.key?(:'fill_in_text') + self.fill_in_text = attributes[:'fill_in_text'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if !@data.nil? && @data.to_s.length > 300 + invalid_properties.push('invalid value for "data", the character length must be smaller than or equal to 300.') + end + + if !@data.nil? && @data.to_s.length < 0 + invalid_properties.push('invalid value for "data", the character length must be great than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@data.nil? && @data.to_s.length > 300 + return false if !@data.nil? && @data.to_s.length < 0 + input_option_validator = EnumAttributeValidator.new('String', ["closeRichMenu", "openRichMenu", "openKeyboard", "openVoice"]) + return false unless input_option_validator.valid?(@input_option) + true && super + end + + # Custom attribute writer method with validation + # @param [Object] data Value to be assigned + def data=(data) + if data.nil? + fail ArgumentError, 'data cannot be nil' + end + + if data.to_s.length > 300 + fail ArgumentError, 'invalid value for "data", the character length must be smaller than or equal to 300.' + end + + if data.to_s.length < 0 + fail ArgumentError, 'invalid value for "data", the character length must be great than or equal to 0.' + end + + @data = data + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] input_option Object to be assigned + def input_option=(input_option) + validator = EnumAttributeValidator.new('String', ["closeRichMenu", "openRichMenu", "openKeyboard", "openVoice"]) + unless validator.valid?(input_option) + fail ArgumentError, "invalid value for \"input_option\", must be one of #{validator.allowable_values}." + end + @input_option = input_option + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + display_text == o.display_text && + text == o.text && + input_option == o.input_option && + fill_in_text == o.fill_in_text && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data, display_text, text, input_option, fill_in_text].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/postback_action_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/postback_action_all_of.rb new file mode 100644 index 00000000..442a7c91 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/postback_action_all_of.rb @@ -0,0 +1,313 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class PostbackActionAllOf + attr_accessor :data + + attr_accessor :display_text + + attr_accessor :text + + attr_accessor :input_option + + attr_accessor :fill_in_text + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data', + :'display_text' => :'displayText', + :'text' => :'text', + :'input_option' => :'inputOption', + :'fill_in_text' => :'fillInText' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'String', + :'display_text' => :'String', + :'text' => :'String', + :'input_option' => :'String', + :'fill_in_text' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::PostbackActionAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::PostbackActionAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'display_text') + self.display_text = attributes[:'display_text'] + end + + if attributes.key?(:'text') + self.text = attributes[:'text'] + end + + if attributes.key?(:'input_option') + self.input_option = attributes[:'input_option'] + end + + if attributes.key?(:'fill_in_text') + self.fill_in_text = attributes[:'fill_in_text'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@data.nil? && @data.to_s.length > 300 + invalid_properties.push('invalid value for "data", the character length must be smaller than or equal to 300.') + end + + if !@data.nil? && @data.to_s.length < 0 + invalid_properties.push('invalid value for "data", the character length must be great than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@data.nil? && @data.to_s.length > 300 + return false if !@data.nil? && @data.to_s.length < 0 + input_option_validator = EnumAttributeValidator.new('String', ["closeRichMenu", "openRichMenu", "openKeyboard", "openVoice"]) + return false unless input_option_validator.valid?(@input_option) + true + end + + # Custom attribute writer method with validation + # @param [Object] data Value to be assigned + def data=(data) + if !data.nil? && data.to_s.length > 300 + fail ArgumentError, 'invalid value for "data", the character length must be smaller than or equal to 300.' + end + + if !data.nil? && data.to_s.length < 0 + fail ArgumentError, 'invalid value for "data", the character length must be great than or equal to 0.' + end + + @data = data + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] input_option Object to be assigned + def input_option=(input_option) + validator = EnumAttributeValidator.new('String', ["closeRichMenu", "openRichMenu", "openKeyboard", "openVoice"]) + unless validator.valid?(input_option) + fail ArgumentError, "invalid value for \"input_option\", must be one of #{validator.allowable_values}." + end + @input_option = input_option + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + display_text == o.display_text && + text == o.text && + input_option == o.input_option && + fill_in_text == o.fill_in_text + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data, display_text, text, input_option, fill_in_text].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/push_message_request.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/push_message_request.rb new file mode 100644 index 00000000..12b75f30 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/push_message_request.rb @@ -0,0 +1,298 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class PushMessageRequest + # ID of the receiver. + attr_accessor :to + + # List of Message objects. + attr_accessor :messages + + # `true`: The user doesn’t receive a push notification when a message is sent. `false`: The user receives a push notification when the message is sent (unless they have disabled push notifications in LINE and/or their device). The default value is false. + attr_accessor :notification_disabled + + # List of aggregation unit name. Case-sensitive. This functions can only be used by corporate users who have submitted the required applications. + attr_accessor :custom_aggregation_units + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'to' => :'to', + :'messages' => :'messages', + :'notification_disabled' => :'notificationDisabled', + :'custom_aggregation_units' => :'customAggregationUnits' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'to' => :'String', + :'messages' => :'Array', + :'notification_disabled' => :'Boolean', + :'custom_aggregation_units' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::PushMessageRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::PushMessageRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'to') + self.to = attributes[:'to'] + else + self.to = nil + end + + if attributes.key?(:'messages') + if (value = attributes[:'messages']).is_a?(Array) + self.messages = value + end + else + self.messages = nil + end + + if attributes.key?(:'notification_disabled') + self.notification_disabled = attributes[:'notification_disabled'] + else + self.notification_disabled = false + end + + if attributes.key?(:'custom_aggregation_units') + if (value = attributes[:'custom_aggregation_units']).is_a?(Array) + self.custom_aggregation_units = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @to.nil? + invalid_properties.push('invalid value for "to", to cannot be nil.') + end + + if @messages.nil? + invalid_properties.push('invalid value for "messages", messages cannot be nil.') + end + + if @messages.length > 5 + invalid_properties.push('invalid value for "messages", number of items must be less than or equal to 5.') + end + + if @messages.length < 1 + invalid_properties.push('invalid value for "messages", number of items must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @to.nil? + return false if @messages.nil? + return false if @messages.length > 5 + return false if @messages.length < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] messages Value to be assigned + def messages=(messages) + if messages.nil? + fail ArgumentError, 'messages cannot be nil' + end + + if messages.length > 5 + fail ArgumentError, 'invalid value for "messages", number of items must be less than or equal to 5.' + end + + if messages.length < 1 + fail ArgumentError, 'invalid value for "messages", number of items must be greater than or equal to 1.' + end + + @messages = messages + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + to == o.to && + messages == o.messages && + notification_disabled == o.notification_disabled && + custom_aggregation_units == o.custom_aggregation_units + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [to, messages, notification_disabled, custom_aggregation_units].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/push_message_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/push_message_response.rb new file mode 100644 index 00000000..0fd781dc --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/push_message_response.rb @@ -0,0 +1,257 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class PushMessageResponse + # Array of sent messages. + attr_accessor :sent_messages + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'sent_messages' => :'sentMessages' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'sent_messages' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::PushMessageResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::PushMessageResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'sent_messages') + if (value = attributes[:'sent_messages']).is_a?(Array) + self.sent_messages = value + end + else + self.sent_messages = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @sent_messages.nil? + invalid_properties.push('invalid value for "sent_messages", sent_messages cannot be nil.') + end + + if @sent_messages.length > 5 + invalid_properties.push('invalid value for "sent_messages", number of items must be less than or equal to 5.') + end + + if @sent_messages.length < 1 + invalid_properties.push('invalid value for "sent_messages", number of items must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @sent_messages.nil? + return false if @sent_messages.length > 5 + return false if @sent_messages.length < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] sent_messages Value to be assigned + def sent_messages=(sent_messages) + if sent_messages.nil? + fail ArgumentError, 'sent_messages cannot be nil' + end + + if sent_messages.length > 5 + fail ArgumentError, 'invalid value for "sent_messages", number of items must be less than or equal to 5.' + end + + if sent_messages.length < 1 + fail ArgumentError, 'invalid value for "sent_messages", number of items must be greater than or equal to 1.' + end + + @sent_messages = sent_messages + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + sent_messages == o.sent_messages + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [sent_messages].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/quick_reply.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/quick_reply.rb new file mode 100644 index 00000000..d9ecd799 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/quick_reply.rb @@ -0,0 +1,242 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + # Quick reply + class QuickReply + # Quick reply button objects. + attr_accessor :items + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'items' => :'items' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'items' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::QuickReply` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::QuickReply`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'items') + if (value = attributes[:'items']).is_a?(Array) + self.items = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@items.nil? && @items.length > 13 + invalid_properties.push('invalid value for "items", number of items must be less than or equal to 13.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@items.nil? && @items.length > 13 + true + end + + # Custom attribute writer method with validation + # @param [Object] items Value to be assigned + def items=(items) + if items.nil? + fail ArgumentError, 'items cannot be nil' + end + + if items.length > 13 + fail ArgumentError, 'invalid value for "items", number of items must be less than or equal to 13.' + end + + @items = items + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + items == o.items + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [items].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/quick_reply_item.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/quick_reply_item.rb new file mode 100644 index 00000000..2022be21 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/quick_reply_item.rb @@ -0,0 +1,260 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class QuickReplyItem + # URL of the icon that is displayed at the beginning of the button + attr_accessor :image_url + + attr_accessor :action + + # `action` + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'image_url' => :'imageUrl', + :'action' => :'action', + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'image_url' => :'String', + :'action' => :'Action', + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::QuickReplyItem` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::QuickReplyItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'image_url') + self.image_url = attributes[:'image_url'] + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = 'action' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@image_url.nil? && @image_url.to_s.length > 2000 + invalid_properties.push('invalid value for "image_url", the character length must be smaller than or equal to 2000.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@image_url.nil? && @image_url.to_s.length > 2000 + true + end + + # Custom attribute writer method with validation + # @param [Object] image_url Value to be assigned + def image_url=(image_url) + if image_url.nil? + fail ArgumentError, 'image_url cannot be nil' + end + + if image_url.to_s.length > 2000 + fail ArgumentError, 'invalid value for "image_url", the character length must be smaller than or equal to 2000.' + end + + @image_url = image_url + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + image_url == o.image_url && + action == o.action && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [image_url, action, type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/quota_consumption_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/quota_consumption_response.rb new file mode 100644 index 00000000..2d3db139 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/quota_consumption_response.rb @@ -0,0 +1,227 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class QuotaConsumptionResponse + # The number of sent messages in the current month + attr_accessor :total_usage + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total_usage' => :'totalUsage' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'total_usage' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::QuotaConsumptionResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::QuotaConsumptionResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'total_usage') + self.total_usage = attributes[:'total_usage'] + else + self.total_usage = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @total_usage.nil? + invalid_properties.push('invalid value for "total_usage", total_usage cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @total_usage.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total_usage == o.total_usage + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total_usage].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/quota_type.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/quota_type.rb new file mode 100644 index 00000000..bc53d0c1 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/quota_type.rb @@ -0,0 +1,40 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class QuotaType + NONE = "none".freeze + LIMITED = "limited".freeze + + def self.all_vars + @all_vars ||= [NONE, LIMITED].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if QuotaType.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #QuotaType" + end + end +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/recipient.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/recipient.rb new file mode 100644 index 00000000..4cb284d2 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/recipient.rb @@ -0,0 +1,226 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + # Recipient + class Recipient + # Type of recipient + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # discriminator's property name in OpenAPI v3 + def self.openapi_discriminator_name + :'type' + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::Recipient` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::Recipient`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/redelivery_recipient.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/redelivery_recipient.rb new file mode 100644 index 00000000..ed30f5e7 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/redelivery_recipient.rb @@ -0,0 +1,230 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class RedeliveryRecipient < Recipient + attr_accessor :request_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'request_id' => :'requestId' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'request_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Recipient' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::RedeliveryRecipient` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::RedeliveryRecipient`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'request_id') + self.request_id = attributes[:'request_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + request_id == o.request_id && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [request_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/redelivery_recipient_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/redelivery_recipient_all_of.rb new file mode 100644 index 00000000..c7783c45 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/redelivery_recipient_all_of.rb @@ -0,0 +1,219 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class RedeliveryRecipientAllOf + attr_accessor :request_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'request_id' => :'requestId' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'request_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::RedeliveryRecipientAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::RedeliveryRecipientAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'request_id') + self.request_id = attributes[:'request_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + request_id == o.request_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [request_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/reply_message_request.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/reply_message_request.rb new file mode 100644 index 00000000..b54f3ced --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/reply_message_request.rb @@ -0,0 +1,286 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class ReplyMessageRequest + # replyToken received via webhook. + attr_accessor :reply_token + + # List of messages. + attr_accessor :messages + + # `true`: The user doesn’t receive a push notification when a message is sent. `false`: The user receives a push notification when the message is sent (unless they have disabled push notifications in LINE and/or their device). The default value is false. + attr_accessor :notification_disabled + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'reply_token' => :'replyToken', + :'messages' => :'messages', + :'notification_disabled' => :'notificationDisabled' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'reply_token' => :'String', + :'messages' => :'Array', + :'notification_disabled' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::ReplyMessageRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::ReplyMessageRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'reply_token') + self.reply_token = attributes[:'reply_token'] + else + self.reply_token = nil + end + + if attributes.key?(:'messages') + if (value = attributes[:'messages']).is_a?(Array) + self.messages = value + end + else + self.messages = nil + end + + if attributes.key?(:'notification_disabled') + self.notification_disabled = attributes[:'notification_disabled'] + else + self.notification_disabled = false + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @reply_token.nil? + invalid_properties.push('invalid value for "reply_token", reply_token cannot be nil.') + end + + if @messages.nil? + invalid_properties.push('invalid value for "messages", messages cannot be nil.') + end + + if @messages.length > 5 + invalid_properties.push('invalid value for "messages", number of items must be less than or equal to 5.') + end + + if @messages.length < 1 + invalid_properties.push('invalid value for "messages", number of items must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @reply_token.nil? + return false if @messages.nil? + return false if @messages.length > 5 + return false if @messages.length < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] messages Value to be assigned + def messages=(messages) + if messages.nil? + fail ArgumentError, 'messages cannot be nil' + end + + if messages.length > 5 + fail ArgumentError, 'invalid value for "messages", number of items must be less than or equal to 5.' + end + + if messages.length < 1 + fail ArgumentError, 'invalid value for "messages", number of items must be greater than or equal to 1.' + end + + @messages = messages + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + reply_token == o.reply_token && + messages == o.messages && + notification_disabled == o.notification_disabled + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [reply_token, messages, notification_disabled].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/reply_message_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/reply_message_response.rb new file mode 100644 index 00000000..bff23288 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/reply_message_response.rb @@ -0,0 +1,257 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class ReplyMessageResponse + # Array of sent messages. + attr_accessor :sent_messages + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'sent_messages' => :'sentMessages' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'sent_messages' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::ReplyMessageResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::ReplyMessageResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'sent_messages') + if (value = attributes[:'sent_messages']).is_a?(Array) + self.sent_messages = value + end + else + self.sent_messages = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @sent_messages.nil? + invalid_properties.push('invalid value for "sent_messages", sent_messages cannot be nil.') + end + + if @sent_messages.length > 5 + invalid_properties.push('invalid value for "sent_messages", number of items must be less than or equal to 5.') + end + + if @sent_messages.length < 1 + invalid_properties.push('invalid value for "sent_messages", number of items must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @sent_messages.nil? + return false if @sent_messages.length > 5 + return false if @sent_messages.length < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] sent_messages Value to be assigned + def sent_messages=(sent_messages) + if sent_messages.nil? + fail ArgumentError, 'sent_messages cannot be nil' + end + + if sent_messages.length > 5 + fail ArgumentError, 'invalid value for "sent_messages", number of items must be less than or equal to 5.' + end + + if sent_messages.length < 1 + fail ArgumentError, 'invalid value for "sent_messages", number of items must be greater than or equal to 1.' + end + + @sent_messages = sent_messages + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + sent_messages == o.sent_messages + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [sent_messages].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_alias_list_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_alias_list_response.rb new file mode 100644 index 00000000..e68de657 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_alias_list_response.rb @@ -0,0 +1,229 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class RichMenuAliasListResponse + # Rich menu aliases. + attr_accessor :aliases + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'aliases' => :'aliases' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'aliases' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::RichMenuAliasListResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::RichMenuAliasListResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'aliases') + if (value = attributes[:'aliases']).is_a?(Array) + self.aliases = value + end + else + self.aliases = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @aliases.nil? + invalid_properties.push('invalid value for "aliases", aliases cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @aliases.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + aliases == o.aliases + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [aliases].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_alias_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_alias_response.rb new file mode 100644 index 00000000..de78056b --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_alias_response.rb @@ -0,0 +1,244 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class RichMenuAliasResponse + # Rich menu alias ID. + attr_accessor :rich_menu_alias_id + + # The rich menu ID associated with the rich menu alias. + attr_accessor :rich_menu_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'rich_menu_alias_id' => :'richMenuAliasId', + :'rich_menu_id' => :'richMenuId' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'rich_menu_alias_id' => :'String', + :'rich_menu_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::RichMenuAliasResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::RichMenuAliasResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'rich_menu_alias_id') + self.rich_menu_alias_id = attributes[:'rich_menu_alias_id'] + else + self.rich_menu_alias_id = nil + end + + if attributes.key?(:'rich_menu_id') + self.rich_menu_id = attributes[:'rich_menu_id'] + else + self.rich_menu_id = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @rich_menu_alias_id.nil? + invalid_properties.push('invalid value for "rich_menu_alias_id", rich_menu_alias_id cannot be nil.') + end + + if @rich_menu_id.nil? + invalid_properties.push('invalid value for "rich_menu_id", rich_menu_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @rich_menu_alias_id.nil? + return false if @rich_menu_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + rich_menu_alias_id == o.rich_menu_alias_id && + rich_menu_id == o.rich_menu_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [rich_menu_alias_id, rich_menu_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_area.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_area.rb new file mode 100644 index 00000000..ead54d1d --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_area.rb @@ -0,0 +1,229 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + # Rich menu area + class RichMenuArea + attr_accessor :bounds + + attr_accessor :action + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'bounds' => :'bounds', + :'action' => :'action' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'bounds' => :'RichMenuBounds', + :'action' => :'Action' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::RichMenuArea` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::RichMenuArea`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'bounds') + self.bounds = attributes[:'bounds'] + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + bounds == o.bounds && + action == o.action + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [bounds, action].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_link_operation.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_link_operation.rb new file mode 100644 index 00000000..92206761 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_link_operation.rb @@ -0,0 +1,254 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + # Replace the rich menu with the rich menu specified in the `to` property for all users linked to the rich menu specified in the `from` property. + class RichMenuBatchLinkOperation < RichMenuBatchOperation + attr_accessor :from + + attr_accessor :to + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'from' => :'from', + :'to' => :'to' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'from' => :'String', + :'to' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'RichMenuBatchOperation' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::RichMenuBatchLinkOperation` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::RichMenuBatchLinkOperation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'from') + self.from = attributes[:'from'] + else + self.from = nil + end + + if attributes.key?(:'to') + self.to = attributes[:'to'] + else + self.to = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @from.nil? + invalid_properties.push('invalid value for "from", from cannot be nil.') + end + + if @to.nil? + invalid_properties.push('invalid value for "to", to cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @from.nil? + return false if @to.nil? + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + from == o.from && + to == o.to && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [from, to].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_link_operation_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_link_operation_all_of.rb new file mode 100644 index 00000000..e7259282 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_link_operation_all_of.rb @@ -0,0 +1,228 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class RichMenuBatchLinkOperationAllOf + attr_accessor :from + + attr_accessor :to + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'from' => :'from', + :'to' => :'to' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'from' => :'String', + :'to' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::RichMenuBatchLinkOperationAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::RichMenuBatchLinkOperationAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'from') + self.from = attributes[:'from'] + end + + if attributes.key?(:'to') + self.to = attributes[:'to'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + from == o.from && + to == o.to + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [from, to].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_operation.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_operation.rb new file mode 100644 index 00000000..ea13ddd3 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_operation.rb @@ -0,0 +1,233 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + # Rich menu operation object represents the batch operation to the rich menu linked to the user. + class RichMenuBatchOperation + # The type of operation to the rich menu linked to the user. One of link, unlink, or unlinkAll. + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # discriminator's property name in OpenAPI v3 + def self.openapi_discriminator_name + :'type' + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::RichMenuBatchOperation` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::RichMenuBatchOperation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @type.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_progress_phase.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_progress_phase.rb new file mode 100644 index 00000000..20c0d0c7 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_progress_phase.rb @@ -0,0 +1,41 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class RichMenuBatchProgressPhase + ONGOING = "ongoing".freeze + SUCCEEDED = "succeeded".freeze + FAILED = "failed".freeze + + def self.all_vars + @all_vars ||= [ONGOING, SUCCEEDED, FAILED].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if RichMenuBatchProgressPhase.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #RichMenuBatchProgressPhase" + end + end +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_progress_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_progress_response.rb new file mode 100644 index 00000000..7a2e4bb7 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_progress_response.rb @@ -0,0 +1,275 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class RichMenuBatchProgressResponse + attr_accessor :phase + + # The accepted time in milliseconds of the request of batch control the rich menu. Format: ISO 8601 (e.g. 2023-06-08T10:15:30.121Z) Timezone: UTC + attr_accessor :accepted_time + + # The completed time in milliseconds of rich menu batch control. Returned when the phase property is succeeded or failed. Format: ISO 8601 (e.g. 2023-06-08T10:15:30.121Z) Timezone: UTC + attr_accessor :completed_time + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'phase' => :'phase', + :'accepted_time' => :'acceptedTime', + :'completed_time' => :'completedTime' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'phase' => :'RichMenuBatchProgressPhase', + :'accepted_time' => :'Time', + :'completed_time' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::RichMenuBatchProgressResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::RichMenuBatchProgressResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'phase') + self.phase = attributes[:'phase'] + else + self.phase = nil + end + + if attributes.key?(:'accepted_time') + self.accepted_time = attributes[:'accepted_time'] + else + self.accepted_time = nil + end + + if attributes.key?(:'completed_time') + self.completed_time = attributes[:'completed_time'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @phase.nil? + invalid_properties.push('invalid value for "phase", phase cannot be nil.') + end + + if @accepted_time.nil? + invalid_properties.push('invalid value for "accepted_time", accepted_time cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @phase.nil? + return false if @accepted_time.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + phase == o.phase && + accepted_time == o.accepted_time && + completed_time == o.completed_time + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [phase, accepted_time, completed_time].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_request.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_request.rb new file mode 100644 index 00000000..7691ffd7 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_request.rb @@ -0,0 +1,297 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class RichMenuBatchRequest + # Array of Rich menu operation object... + attr_accessor :operations + + # Key for retry. Key value is a string matching the regular expression pattern + attr_accessor :resume_request_key + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'operations' => :'operations', + :'resume_request_key' => :'resumeRequestKey' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'operations' => :'Array', + :'resume_request_key' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::RichMenuBatchRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::RichMenuBatchRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'operations') + if (value = attributes[:'operations']).is_a?(Array) + self.operations = value + end + else + self.operations = nil + end + + if attributes.key?(:'resume_request_key') + self.resume_request_key = attributes[:'resume_request_key'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @operations.nil? + invalid_properties.push('invalid value for "operations", operations cannot be nil.') + end + + if @operations.length > 1000 + invalid_properties.push('invalid value for "operations", number of items must be less than or equal to 1000.') + end + + if !@resume_request_key.nil? && @resume_request_key.to_s.length > 100 + invalid_properties.push('invalid value for "resume_request_key", the character length must be smaller than or equal to 100.') + end + + if !@resume_request_key.nil? && @resume_request_key.to_s.length < 1 + invalid_properties.push('invalid value for "resume_request_key", the character length must be great than or equal to 1.') + end + + pattern = Regexp.new(/^[a-zA-Z0-9_-]{1,100}$/) + if !@resume_request_key.nil? && @resume_request_key !~ pattern + invalid_properties.push("invalid value for \"resume_request_key\", must conform to the pattern #{pattern}.") + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @operations.nil? + return false if @operations.length > 1000 + return false if !@resume_request_key.nil? && @resume_request_key.to_s.length > 100 + return false if !@resume_request_key.nil? && @resume_request_key.to_s.length < 1 + return false if !@resume_request_key.nil? && @resume_request_key !~ Regexp.new(/^[a-zA-Z0-9_-]{1,100}$/) + true + end + + # Custom attribute writer method with validation + # @param [Object] operations Value to be assigned + def operations=(operations) + if operations.nil? + fail ArgumentError, 'operations cannot be nil' + end + + if operations.length > 1000 + fail ArgumentError, 'invalid value for "operations", number of items must be less than or equal to 1000.' + end + + @operations = operations + end + + # Custom attribute writer method with validation + # @param [Object] resume_request_key Value to be assigned + def resume_request_key=(resume_request_key) + if resume_request_key.nil? + fail ArgumentError, 'resume_request_key cannot be nil' + end + + if resume_request_key.to_s.length > 100 + fail ArgumentError, 'invalid value for "resume_request_key", the character length must be smaller than or equal to 100.' + end + + if resume_request_key.to_s.length < 1 + fail ArgumentError, 'invalid value for "resume_request_key", the character length must be great than or equal to 1.' + end + + pattern = Regexp.new(/^[a-zA-Z0-9_-]{1,100}$/) + if resume_request_key !~ pattern + fail ArgumentError, "invalid value for \"resume_request_key\", must conform to the pattern #{pattern}." + end + + @resume_request_key = resume_request_key + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + operations == o.operations && + resume_request_key == o.resume_request_key + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [operations, resume_request_key].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_unlink_all_operation.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_unlink_all_operation.rb new file mode 100644 index 00000000..67c143ab --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_unlink_all_operation.rb @@ -0,0 +1,222 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + # Unlink the rich menu from all users linked to the rich menu. + class RichMenuBatchUnlinkAllOperation < RichMenuBatchOperation + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'RichMenuBatchOperation' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::RichMenuBatchUnlinkAllOperation` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::RichMenuBatchUnlinkAllOperation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_unlink_operation.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_unlink_operation.rb new file mode 100644 index 00000000..f44f9785 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_unlink_operation.rb @@ -0,0 +1,238 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + # Unlink the rich menu for all users linked to the rich menu specified in the `from` property. + class RichMenuBatchUnlinkOperation < RichMenuBatchOperation + attr_accessor :from + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'from' => :'from' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'from' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'RichMenuBatchOperation' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::RichMenuBatchUnlinkOperation` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::RichMenuBatchUnlinkOperation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'from') + self.from = attributes[:'from'] + else + self.from = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @from.nil? + invalid_properties.push('invalid value for "from", from cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @from.nil? + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + from == o.from && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [from].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_unlink_operation_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_unlink_operation_all_of.rb new file mode 100644 index 00000000..dc7f56fc --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_batch_unlink_operation_all_of.rb @@ -0,0 +1,219 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class RichMenuBatchUnlinkOperationAllOf + attr_accessor :from + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'from' => :'from' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'from' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::RichMenuBatchUnlinkOperationAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::RichMenuBatchUnlinkOperationAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'from') + self.from = attributes[:'from'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + from == o.from + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [from].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_bounds.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_bounds.rb new file mode 100644 index 00000000..ca5c39aa --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_bounds.rb @@ -0,0 +1,363 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + # Rich menu bounds + class RichMenuBounds + # Horizontal position relative to the top-left corner of the area. + attr_accessor :x + + # Vertical position relative to the top-left corner of the area. + attr_accessor :y + + # Width of the area. + attr_accessor :width + + # Height of the area. + attr_accessor :height + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'x' => :'x', + :'y' => :'y', + :'width' => :'width', + :'height' => :'height' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'x' => :'Integer', + :'y' => :'Integer', + :'width' => :'Integer', + :'height' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::RichMenuBounds` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::RichMenuBounds`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'x') + self.x = attributes[:'x'] + end + + if attributes.key?(:'y') + self.y = attributes[:'y'] + end + + if attributes.key?(:'width') + self.width = attributes[:'width'] + end + + if attributes.key?(:'height') + self.height = attributes[:'height'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@x.nil? && @x > 2147483647 + invalid_properties.push('invalid value for "x", must be smaller than or equal to 2147483647.') + end + + if !@x.nil? && @x < 0 + invalid_properties.push('invalid value for "x", must be greater than or equal to 0.') + end + + if !@y.nil? && @y > 2147483647 + invalid_properties.push('invalid value for "y", must be smaller than or equal to 2147483647.') + end + + if !@y.nil? && @y < 0 + invalid_properties.push('invalid value for "y", must be greater than or equal to 0.') + end + + if !@width.nil? && @width > 2147483647 + invalid_properties.push('invalid value for "width", must be smaller than or equal to 2147483647.') + end + + if !@width.nil? && @width < 1 + invalid_properties.push('invalid value for "width", must be greater than or equal to 1.') + end + + if !@height.nil? && @height > 2147483647 + invalid_properties.push('invalid value for "height", must be smaller than or equal to 2147483647.') + end + + if !@height.nil? && @height < 1 + invalid_properties.push('invalid value for "height", must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@x.nil? && @x > 2147483647 + return false if !@x.nil? && @x < 0 + return false if !@y.nil? && @y > 2147483647 + return false if !@y.nil? && @y < 0 + return false if !@width.nil? && @width > 2147483647 + return false if !@width.nil? && @width < 1 + return false if !@height.nil? && @height > 2147483647 + return false if !@height.nil? && @height < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] x Value to be assigned + def x=(x) + if x.nil? + fail ArgumentError, 'x cannot be nil' + end + + if x > 2147483647 + fail ArgumentError, 'invalid value for "x", must be smaller than or equal to 2147483647.' + end + + if x < 0 + fail ArgumentError, 'invalid value for "x", must be greater than or equal to 0.' + end + + @x = x + end + + # Custom attribute writer method with validation + # @param [Object] y Value to be assigned + def y=(y) + if y.nil? + fail ArgumentError, 'y cannot be nil' + end + + if y > 2147483647 + fail ArgumentError, 'invalid value for "y", must be smaller than or equal to 2147483647.' + end + + if y < 0 + fail ArgumentError, 'invalid value for "y", must be greater than or equal to 0.' + end + + @y = y + end + + # Custom attribute writer method with validation + # @param [Object] width Value to be assigned + def width=(width) + if width.nil? + fail ArgumentError, 'width cannot be nil' + end + + if width > 2147483647 + fail ArgumentError, 'invalid value for "width", must be smaller than or equal to 2147483647.' + end + + if width < 1 + fail ArgumentError, 'invalid value for "width", must be greater than or equal to 1.' + end + + @width = width + end + + # Custom attribute writer method with validation + # @param [Object] height Value to be assigned + def height=(height) + if height.nil? + fail ArgumentError, 'height cannot be nil' + end + + if height > 2147483647 + fail ArgumentError, 'invalid value for "height", must be smaller than or equal to 2147483647.' + end + + if height < 1 + fail ArgumentError, 'invalid value for "height", must be greater than or equal to 1.' + end + + @height = height + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + x == o.x && + y == o.y && + width == o.width && + height == o.height + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [x, y, width, height].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_bulk_link_request.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_bulk_link_request.rb new file mode 100644 index 00000000..5ab7b476 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_bulk_link_request.rb @@ -0,0 +1,274 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class RichMenuBulkLinkRequest + # ID of a rich menu + attr_accessor :rich_menu_id + + # Array of user IDs. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. + attr_accessor :user_ids + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'rich_menu_id' => :'richMenuId', + :'user_ids' => :'userIds' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'rich_menu_id' => :'String', + :'user_ids' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::RichMenuBulkLinkRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::RichMenuBulkLinkRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'rich_menu_id') + self.rich_menu_id = attributes[:'rich_menu_id'] + else + self.rich_menu_id = nil + end + + if attributes.key?(:'user_ids') + if (value = attributes[:'user_ids']).is_a?(Array) + self.user_ids = value + end + else + self.user_ids = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @rich_menu_id.nil? + invalid_properties.push('invalid value for "rich_menu_id", rich_menu_id cannot be nil.') + end + + if @user_ids.nil? + invalid_properties.push('invalid value for "user_ids", user_ids cannot be nil.') + end + + if @user_ids.length > 500 + invalid_properties.push('invalid value for "user_ids", number of items must be less than or equal to 500.') + end + + if @user_ids.length < 1 + invalid_properties.push('invalid value for "user_ids", number of items must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @rich_menu_id.nil? + return false if @user_ids.nil? + return false if @user_ids.length > 500 + return false if @user_ids.length < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] user_ids Value to be assigned + def user_ids=(user_ids) + if user_ids.nil? + fail ArgumentError, 'user_ids cannot be nil' + end + + if user_ids.length > 500 + fail ArgumentError, 'invalid value for "user_ids", number of items must be less than or equal to 500.' + end + + if user_ids.length < 1 + fail ArgumentError, 'invalid value for "user_ids", number of items must be greater than or equal to 1.' + end + + @user_ids = user_ids + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + rich_menu_id == o.rich_menu_id && + user_ids == o.user_ids + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [rich_menu_id, user_ids].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_bulk_unlink_request.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_bulk_unlink_request.rb new file mode 100644 index 00000000..32177d6d --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_bulk_unlink_request.rb @@ -0,0 +1,257 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class RichMenuBulkUnlinkRequest + # Array of user IDs. Found in the `source` object of webhook event objects. Do not use the LINE ID used in LINE. + attr_accessor :user_ids + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'user_ids' => :'userIds' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'user_ids' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::RichMenuBulkUnlinkRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::RichMenuBulkUnlinkRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'user_ids') + if (value = attributes[:'user_ids']).is_a?(Array) + self.user_ids = value + end + else + self.user_ids = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @user_ids.nil? + invalid_properties.push('invalid value for "user_ids", user_ids cannot be nil.') + end + + if @user_ids.length > 500 + invalid_properties.push('invalid value for "user_ids", number of items must be less than or equal to 500.') + end + + if @user_ids.length < 1 + invalid_properties.push('invalid value for "user_ids", number of items must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @user_ids.nil? + return false if @user_ids.length > 500 + return false if @user_ids.length < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] user_ids Value to be assigned + def user_ids=(user_ids) + if user_ids.nil? + fail ArgumentError, 'user_ids cannot be nil' + end + + if user_ids.length > 500 + fail ArgumentError, 'invalid value for "user_ids", number of items must be less than or equal to 500.' + end + + if user_ids.length < 1 + fail ArgumentError, 'invalid value for "user_ids", number of items must be greater than or equal to 1.' + end + + @user_ids = user_ids + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + user_ids == o.user_ids + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [user_ids].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_id_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_id_response.rb new file mode 100644 index 00000000..db722e5d --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_id_response.rb @@ -0,0 +1,227 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class RichMenuIdResponse + # Rich menu ID + attr_accessor :rich_menu_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'rich_menu_id' => :'richMenuId' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'rich_menu_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::RichMenuIdResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::RichMenuIdResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'rich_menu_id') + self.rich_menu_id = attributes[:'rich_menu_id'] + else + self.rich_menu_id = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @rich_menu_id.nil? + invalid_properties.push('invalid value for "rich_menu_id", rich_menu_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @rich_menu_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + rich_menu_id == o.rich_menu_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [rich_menu_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_list_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_list_response.rb new file mode 100644 index 00000000..a702b90c --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_list_response.rb @@ -0,0 +1,229 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class RichMenuListResponse + # Rich menus + attr_accessor :richmenus + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'richmenus' => :'richmenus' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'richmenus' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::RichMenuListResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::RichMenuListResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'richmenus') + if (value = attributes[:'richmenus']).is_a?(Array) + self.richmenus = value + end + else + self.richmenus = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @richmenus.nil? + invalid_properties.push('invalid value for "richmenus", richmenus cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @richmenus.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + richmenus == o.richmenus + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [richmenus].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_request.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_request.rb new file mode 100644 index 00000000..e6a84cb2 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_request.rb @@ -0,0 +1,299 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class RichMenuRequest + attr_accessor :size + + # `true` to display the rich menu by default. Otherwise, `false`. + attr_accessor :selected + + # Name of the rich menu. This value can be used to help manage your rich menus and is not displayed to users. + attr_accessor :name + + # Text displayed in the chat bar + attr_accessor :chat_bar_text + + # Array of area objects which define the coordinates and size of tappable areas + attr_accessor :areas + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'size' => :'size', + :'selected' => :'selected', + :'name' => :'name', + :'chat_bar_text' => :'chatBarText', + :'areas' => :'areas' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'size' => :'RichMenuSize', + :'selected' => :'Boolean', + :'name' => :'String', + :'chat_bar_text' => :'String', + :'areas' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::RichMenuRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::RichMenuRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'size') + self.size = attributes[:'size'] + end + + if attributes.key?(:'selected') + self.selected = attributes[:'selected'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'chat_bar_text') + self.chat_bar_text = attributes[:'chat_bar_text'] + end + + if attributes.key?(:'areas') + if (value = attributes[:'areas']).is_a?(Array) + self.areas = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@name.nil? && @name.to_s.length > 300 + invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 300.') + end + + if !@chat_bar_text.nil? && @chat_bar_text.to_s.length > 14 + invalid_properties.push('invalid value for "chat_bar_text", the character length must be smaller than or equal to 14.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@name.nil? && @name.to_s.length > 300 + return false if !@chat_bar_text.nil? && @chat_bar_text.to_s.length > 14 + true + end + + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + if name.to_s.length > 300 + fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 300.' + end + + @name = name + end + + # Custom attribute writer method with validation + # @param [Object] chat_bar_text Value to be assigned + def chat_bar_text=(chat_bar_text) + if chat_bar_text.nil? + fail ArgumentError, 'chat_bar_text cannot be nil' + end + + if chat_bar_text.to_s.length > 14 + fail ArgumentError, 'invalid value for "chat_bar_text", the character length must be smaller than or equal to 14.' + end + + @chat_bar_text = chat_bar_text + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + size == o.size && + selected == o.selected && + name == o.name && + chat_bar_text == o.chat_bar_text && + areas == o.areas + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [size, selected, name, chat_bar_text, areas].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_response.rb new file mode 100644 index 00000000..87eb38d6 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_response.rb @@ -0,0 +1,370 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class RichMenuResponse + # ID of a rich menu + attr_accessor :rich_menu_id + + attr_accessor :size + + # `true` to display the rich menu by default. Otherwise, `false`. + attr_accessor :selected + + # Name of the rich menu. This value can be used to help manage your rich menus and is not displayed to users. + attr_accessor :name + + # Text displayed in the chat bar + attr_accessor :chat_bar_text + + # Array of area objects which define the coordinates and size of tappable areas + attr_accessor :areas + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'rich_menu_id' => :'richMenuId', + :'size' => :'size', + :'selected' => :'selected', + :'name' => :'name', + :'chat_bar_text' => :'chatBarText', + :'areas' => :'areas' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'rich_menu_id' => :'String', + :'size' => :'RichMenuSize', + :'selected' => :'Boolean', + :'name' => :'String', + :'chat_bar_text' => :'String', + :'areas' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::RichMenuResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::RichMenuResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'rich_menu_id') + self.rich_menu_id = attributes[:'rich_menu_id'] + else + self.rich_menu_id = nil + end + + if attributes.key?(:'size') + self.size = attributes[:'size'] + else + self.size = nil + end + + if attributes.key?(:'selected') + self.selected = attributes[:'selected'] + else + self.selected = nil + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'chat_bar_text') + self.chat_bar_text = attributes[:'chat_bar_text'] + else + self.chat_bar_text = nil + end + + if attributes.key?(:'areas') + if (value = attributes[:'areas']).is_a?(Array) + self.areas = value + end + else + self.areas = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @rich_menu_id.nil? + invalid_properties.push('invalid value for "rich_menu_id", rich_menu_id cannot be nil.') + end + + if @size.nil? + invalid_properties.push('invalid value for "size", size cannot be nil.') + end + + if @selected.nil? + invalid_properties.push('invalid value for "selected", selected cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + if @name.to_s.length > 300 + invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 300.') + end + + if @chat_bar_text.nil? + invalid_properties.push('invalid value for "chat_bar_text", chat_bar_text cannot be nil.') + end + + if @chat_bar_text.to_s.length > 14 + invalid_properties.push('invalid value for "chat_bar_text", the character length must be smaller than or equal to 14.') + end + + if @areas.nil? + invalid_properties.push('invalid value for "areas", areas cannot be nil.') + end + + if @areas.length > 20 + invalid_properties.push('invalid value for "areas", number of items must be less than or equal to 20.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @rich_menu_id.nil? + return false if @size.nil? + return false if @selected.nil? + return false if @name.nil? + return false if @name.to_s.length > 300 + return false if @chat_bar_text.nil? + return false if @chat_bar_text.to_s.length > 14 + return false if @areas.nil? + return false if @areas.length > 20 + true + end + + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + if name.to_s.length > 300 + fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 300.' + end + + @name = name + end + + # Custom attribute writer method with validation + # @param [Object] chat_bar_text Value to be assigned + def chat_bar_text=(chat_bar_text) + if chat_bar_text.nil? + fail ArgumentError, 'chat_bar_text cannot be nil' + end + + if chat_bar_text.to_s.length > 14 + fail ArgumentError, 'invalid value for "chat_bar_text", the character length must be smaller than or equal to 14.' + end + + @chat_bar_text = chat_bar_text + end + + # Custom attribute writer method with validation + # @param [Object] areas Value to be assigned + def areas=(areas) + if areas.nil? + fail ArgumentError, 'areas cannot be nil' + end + + if areas.length > 20 + fail ArgumentError, 'invalid value for "areas", number of items must be less than or equal to 20.' + end + + @areas = areas + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + rich_menu_id == o.rich_menu_id && + size == o.size && + selected == o.selected && + name == o.name && + chat_bar_text == o.chat_bar_text && + areas == o.areas + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [rich_menu_id, size, selected, name, chat_bar_text, areas].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_size.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_size.rb new file mode 100644 index 00000000..666311b1 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_size.rb @@ -0,0 +1,287 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + # Rich menu size + class RichMenuSize + # width + attr_accessor :width + + # height + attr_accessor :height + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'width' => :'width', + :'height' => :'height' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'width' => :'Integer', + :'height' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::RichMenuSize` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::RichMenuSize`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'width') + self.width = attributes[:'width'] + end + + if attributes.key?(:'height') + self.height = attributes[:'height'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@width.nil? && @width > 2147483647 + invalid_properties.push('invalid value for "width", must be smaller than or equal to 2147483647.') + end + + if !@width.nil? && @width < 1 + invalid_properties.push('invalid value for "width", must be greater than or equal to 1.') + end + + if !@height.nil? && @height > 2147483647 + invalid_properties.push('invalid value for "height", must be smaller than or equal to 2147483647.') + end + + if !@height.nil? && @height < 1 + invalid_properties.push('invalid value for "height", must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@width.nil? && @width > 2147483647 + return false if !@width.nil? && @width < 1 + return false if !@height.nil? && @height > 2147483647 + return false if !@height.nil? && @height < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] width Value to be assigned + def width=(width) + if width.nil? + fail ArgumentError, 'width cannot be nil' + end + + if width > 2147483647 + fail ArgumentError, 'invalid value for "width", must be smaller than or equal to 2147483647.' + end + + if width < 1 + fail ArgumentError, 'invalid value for "width", must be greater than or equal to 1.' + end + + @width = width + end + + # Custom attribute writer method with validation + # @param [Object] height Value to be assigned + def height=(height) + if height.nil? + fail ArgumentError, 'height cannot be nil' + end + + if height > 2147483647 + fail ArgumentError, 'invalid value for "height", must be smaller than or equal to 2147483647.' + end + + if height < 1 + fail ArgumentError, 'invalid value for "height", must be greater than or equal to 1.' + end + + @height = height + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + width == o.width && + height == o.height + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [width, height].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_switch_action.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_switch_action.rb new file mode 100644 index 00000000..196856ab --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_switch_action.rb @@ -0,0 +1,295 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class RichMenuSwitchAction < Action + attr_accessor :data + + attr_accessor :rich_menu_alias_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data', + :'rich_menu_alias_id' => :'richMenuAliasId' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'String', + :'rich_menu_alias_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Action' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::RichMenuSwitchAction` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::RichMenuSwitchAction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'rich_menu_alias_id') + self.rich_menu_alias_id = attributes[:'rich_menu_alias_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if !@data.nil? && @data.to_s.length > 300 + invalid_properties.push('invalid value for "data", the character length must be smaller than or equal to 300.') + end + + if !@data.nil? && @data.to_s.length < 0 + invalid_properties.push('invalid value for "data", the character length must be great than or equal to 0.') + end + + if !@rich_menu_alias_id.nil? && @rich_menu_alias_id.to_s.length > 32 + invalid_properties.push('invalid value for "rich_menu_alias_id", the character length must be smaller than or equal to 32.') + end + + if !@rich_menu_alias_id.nil? && @rich_menu_alias_id.to_s.length < 0 + invalid_properties.push('invalid value for "rich_menu_alias_id", the character length must be great than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@data.nil? && @data.to_s.length > 300 + return false if !@data.nil? && @data.to_s.length < 0 + return false if !@rich_menu_alias_id.nil? && @rich_menu_alias_id.to_s.length > 32 + return false if !@rich_menu_alias_id.nil? && @rich_menu_alias_id.to_s.length < 0 + true && super + end + + # Custom attribute writer method with validation + # @param [Object] data Value to be assigned + def data=(data) + if data.nil? + fail ArgumentError, 'data cannot be nil' + end + + if data.to_s.length > 300 + fail ArgumentError, 'invalid value for "data", the character length must be smaller than or equal to 300.' + end + + if data.to_s.length < 0 + fail ArgumentError, 'invalid value for "data", the character length must be great than or equal to 0.' + end + + @data = data + end + + # Custom attribute writer method with validation + # @param [Object] rich_menu_alias_id Value to be assigned + def rich_menu_alias_id=(rich_menu_alias_id) + if rich_menu_alias_id.nil? + fail ArgumentError, 'rich_menu_alias_id cannot be nil' + end + + if rich_menu_alias_id.to_s.length > 32 + fail ArgumentError, 'invalid value for "rich_menu_alias_id", the character length must be smaller than or equal to 32.' + end + + if rich_menu_alias_id.to_s.length < 0 + fail ArgumentError, 'invalid value for "rich_menu_alias_id", the character length must be great than or equal to 0.' + end + + @rich_menu_alias_id = rich_menu_alias_id + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + rich_menu_alias_id == o.rich_menu_alias_id && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data, rich_menu_alias_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_switch_action_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_switch_action_all_of.rb new file mode 100644 index 00000000..c8e63e5c --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/rich_menu_switch_action_all_of.rb @@ -0,0 +1,276 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class RichMenuSwitchActionAllOf + attr_accessor :data + + attr_accessor :rich_menu_alias_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data', + :'rich_menu_alias_id' => :'richMenuAliasId' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'String', + :'rich_menu_alias_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::RichMenuSwitchActionAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::RichMenuSwitchActionAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'rich_menu_alias_id') + self.rich_menu_alias_id = attributes[:'rich_menu_alias_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@data.nil? && @data.to_s.length > 300 + invalid_properties.push('invalid value for "data", the character length must be smaller than or equal to 300.') + end + + if !@data.nil? && @data.to_s.length < 0 + invalid_properties.push('invalid value for "data", the character length must be great than or equal to 0.') + end + + if !@rich_menu_alias_id.nil? && @rich_menu_alias_id.to_s.length > 32 + invalid_properties.push('invalid value for "rich_menu_alias_id", the character length must be smaller than or equal to 32.') + end + + if !@rich_menu_alias_id.nil? && @rich_menu_alias_id.to_s.length < 0 + invalid_properties.push('invalid value for "rich_menu_alias_id", the character length must be great than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@data.nil? && @data.to_s.length > 300 + return false if !@data.nil? && @data.to_s.length < 0 + return false if !@rich_menu_alias_id.nil? && @rich_menu_alias_id.to_s.length > 32 + return false if !@rich_menu_alias_id.nil? && @rich_menu_alias_id.to_s.length < 0 + true + end + + # Custom attribute writer method with validation + # @param [Object] data Value to be assigned + def data=(data) + if !data.nil? && data.to_s.length > 300 + fail ArgumentError, 'invalid value for "data", the character length must be smaller than or equal to 300.' + end + + if !data.nil? && data.to_s.length < 0 + fail ArgumentError, 'invalid value for "data", the character length must be great than or equal to 0.' + end + + @data = data + end + + # Custom attribute writer method with validation + # @param [Object] rich_menu_alias_id Value to be assigned + def rich_menu_alias_id=(rich_menu_alias_id) + if !rich_menu_alias_id.nil? && rich_menu_alias_id.to_s.length > 32 + fail ArgumentError, 'invalid value for "rich_menu_alias_id", the character length must be smaller than or equal to 32.' + end + + if !rich_menu_alias_id.nil? && rich_menu_alias_id.to_s.length < 0 + fail ArgumentError, 'invalid value for "rich_menu_alias_id", the character length must be great than or equal to 0.' + end + + @rich_menu_alias_id = rich_menu_alias_id + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + rich_menu_alias_id == o.rich_menu_alias_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data, rich_menu_alias_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/room_member_count_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/room_member_count_response.rb new file mode 100644 index 00000000..7e340401 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/room_member_count_response.rb @@ -0,0 +1,227 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class RoomMemberCountResponse + # The count of members in the multi-person chat. The number returned excludes the LINE Official Account. + attr_accessor :count + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'count' => :'count' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'count' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::RoomMemberCountResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::RoomMemberCountResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'count') + self.count = attributes[:'count'] + else + self.count = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @count.nil? + invalid_properties.push('invalid value for "count", count cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @count.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + count == o.count + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [count].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/room_user_profile_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/room_user_profile_response.rb new file mode 100644 index 00000000..a259c71c --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/room_user_profile_response.rb @@ -0,0 +1,254 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class RoomUserProfileResponse + # User's display name + attr_accessor :display_name + + # User ID + attr_accessor :user_id + + # Profile image URL. `https` image URL. Not included in the response if the user doesn't have a profile image. + attr_accessor :picture_url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'display_name' => :'displayName', + :'user_id' => :'userId', + :'picture_url' => :'pictureUrl' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'display_name' => :'String', + :'user_id' => :'String', + :'picture_url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::RoomUserProfileResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::RoomUserProfileResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'display_name') + self.display_name = attributes[:'display_name'] + else + self.display_name = nil + end + + if attributes.key?(:'user_id') + self.user_id = attributes[:'user_id'] + else + self.user_id = nil + end + + if attributes.key?(:'picture_url') + self.picture_url = attributes[:'picture_url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @display_name.nil? + invalid_properties.push('invalid value for "display_name", display_name cannot be nil.') + end + + if @user_id.nil? + invalid_properties.push('invalid value for "user_id", user_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @display_name.nil? + return false if @user_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + display_name == o.display_name && + user_id == o.user_id && + picture_url == o.picture_url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [display_name, user_id, picture_url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/sender.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/sender.rb new file mode 100644 index 00000000..fccc66fb --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/sender.rb @@ -0,0 +1,269 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + # Change icon and display name + class Sender + # Display name. Certain words such as `LINE` may not be used. + attr_accessor :name + + # URL of the image to display as an icon when sending a message + attr_accessor :icon_url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'icon_url' => :'iconUrl' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'icon_url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::Sender` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::Sender`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'icon_url') + self.icon_url = attributes[:'icon_url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@name.nil? && @name.to_s.length > 20 + invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 20.') + end + + if !@icon_url.nil? && @icon_url.to_s.length > 2000 + invalid_properties.push('invalid value for "icon_url", the character length must be smaller than or equal to 2000.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@name.nil? && @name.to_s.length > 20 + return false if !@icon_url.nil? && @icon_url.to_s.length > 2000 + true + end + + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + if name.to_s.length > 20 + fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 20.' + end + + @name = name + end + + # Custom attribute writer method with validation + # @param [Object] icon_url Value to be assigned + def icon_url=(icon_url) + if icon_url.nil? + fail ArgumentError, 'icon_url cannot be nil' + end + + if icon_url.to_s.length > 2000 + fail ArgumentError, 'invalid value for "icon_url", the character length must be smaller than or equal to 2000.' + end + + @icon_url = icon_url + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + icon_url == o.icon_url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name, icon_url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/sent_message.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/sent_message.rb new file mode 100644 index 00000000..b7bff627 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/sent_message.rb @@ -0,0 +1,237 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class SentMessage + # ID of the sent message. + attr_accessor :id + + # Quote token of the message. Only included when a message object that can be specified as a quote target was sent as a push or reply message. + attr_accessor :quote_token + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'quote_token' => :'quoteToken' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'quote_token' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::SentMessage` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::SentMessage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'quote_token') + self.quote_token = attributes[:'quote_token'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + quote_token == o.quote_token + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, quote_token].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/set_webhook_endpoint_request.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/set_webhook_endpoint_request.rb new file mode 100644 index 00000000..cbfaf391 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/set_webhook_endpoint_request.rb @@ -0,0 +1,255 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class SetWebhookEndpointRequest + # A valid webhook URL. + attr_accessor :endpoint + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'endpoint' => :'endpoint' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'endpoint' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::SetWebhookEndpointRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::SetWebhookEndpointRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'endpoint') + self.endpoint = attributes[:'endpoint'] + else + self.endpoint = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @endpoint.nil? + invalid_properties.push('invalid value for "endpoint", endpoint cannot be nil.') + end + + if @endpoint.to_s.length > 500 + invalid_properties.push('invalid value for "endpoint", the character length must be smaller than or equal to 500.') + end + + if @endpoint.to_s.length < 0 + invalid_properties.push('invalid value for "endpoint", the character length must be great than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @endpoint.nil? + return false if @endpoint.to_s.length > 500 + return false if @endpoint.to_s.length < 0 + true + end + + # Custom attribute writer method with validation + # @param [Object] endpoint Value to be assigned + def endpoint=(endpoint) + if endpoint.nil? + fail ArgumentError, 'endpoint cannot be nil' + end + + if endpoint.to_s.length > 500 + fail ArgumentError, 'invalid value for "endpoint", the character length must be smaller than or equal to 500.' + end + + if endpoint.to_s.length < 0 + fail ArgumentError, 'invalid value for "endpoint", the character length must be great than or equal to 0.' + end + + @endpoint = endpoint + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + endpoint == o.endpoint + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [endpoint].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/sticker_message.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/sticker_message.rb new file mode 100644 index 00000000..3788adbc --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/sticker_message.rb @@ -0,0 +1,249 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class StickerMessage < Message + attr_accessor :package_id + + attr_accessor :sticker_id + + # Quote token of the message you want to quote. + attr_accessor :quote_token + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'package_id' => :'packageId', + :'sticker_id' => :'stickerId', + :'quote_token' => :'quoteToken' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'package_id' => :'String', + :'sticker_id' => :'String', + :'quote_token' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Message' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::StickerMessage` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::StickerMessage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'package_id') + self.package_id = attributes[:'package_id'] + end + + if attributes.key?(:'sticker_id') + self.sticker_id = attributes[:'sticker_id'] + end + + if attributes.key?(:'quote_token') + self.quote_token = attributes[:'quote_token'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + package_id == o.package_id && + sticker_id == o.sticker_id && + quote_token == o.quote_token && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [package_id, sticker_id, quote_token].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/sticker_message_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/sticker_message_all_of.rb new file mode 100644 index 00000000..5e32fe60 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/sticker_message_all_of.rb @@ -0,0 +1,228 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class StickerMessageAllOf + attr_accessor :package_id + + attr_accessor :sticker_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'package_id' => :'packageId', + :'sticker_id' => :'stickerId' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'package_id' => :'String', + :'sticker_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::StickerMessageAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::StickerMessageAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'package_id') + self.package_id = attributes[:'package_id'] + end + + if attributes.key?(:'sticker_id') + self.sticker_id = attributes[:'sticker_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + package_id == o.package_id && + sticker_id == o.sticker_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [package_id, sticker_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/subscription_period_demographic.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/subscription_period_demographic.rb new file mode 100644 index 00000000..449f20df --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/subscription_period_demographic.rb @@ -0,0 +1,43 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class SubscriptionPeriodDemographic + N7 = "day_7".freeze + N30 = "day_30".freeze + N90 = "day_90".freeze + N180 = "day_180".freeze + N365 = "day_365".freeze + + def self.all_vars + @all_vars ||= [N7, N30, N90, N180, N365].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if SubscriptionPeriodDemographic.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #SubscriptionPeriodDemographic" + end + end +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/subscription_period_demographic_filter.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/subscription_period_demographic_filter.rb new file mode 100644 index 00000000..ae02f2e4 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/subscription_period_demographic_filter.rb @@ -0,0 +1,261 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class SubscriptionPeriodDemographicFilter < DemographicFilter + attr_accessor :gte + + attr_accessor :lt + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'gte' => :'gte', + :'lt' => :'lt' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'gte' => :'SubscriptionPeriodDemographic', + :'lt' => :'SubscriptionPeriodDemographic' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'DemographicFilter' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::SubscriptionPeriodDemographicFilter` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::SubscriptionPeriodDemographicFilter`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'gte') + self.gte = attributes[:'gte'] + end + + if attributes.key?(:'lt') + self.lt = attributes[:'lt'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + gte == o.gte && + lt == o.lt && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [gte, lt].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/subscription_period_demographic_filter_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/subscription_period_demographic_filter_all_of.rb new file mode 100644 index 00000000..50a81f51 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/subscription_period_demographic_filter_all_of.rb @@ -0,0 +1,250 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class SubscriptionPeriodDemographicFilterAllOf + attr_accessor :gte + + attr_accessor :lt + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'gte' => :'gte', + :'lt' => :'lt' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'gte' => :'SubscriptionPeriodDemographic', + :'lt' => :'SubscriptionPeriodDemographic' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::SubscriptionPeriodDemographicFilterAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::SubscriptionPeriodDemographicFilterAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'gte') + self.gte = attributes[:'gte'] + end + + if attributes.key?(:'lt') + self.lt = attributes[:'lt'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + gte == o.gte && + lt == o.lt + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [gte, lt].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/template.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/template.rb new file mode 100644 index 00000000..57c5d581 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/template.rb @@ -0,0 +1,231 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class Template + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # discriminator's property name in OpenAPI v3 + def self.openapi_discriminator_name + :'type' + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::Template` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::Template`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @type.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/template_message.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/template_message.rb new file mode 100644 index 00000000..7b941811 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/template_message.rb @@ -0,0 +1,239 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class TemplateMessage < Message + attr_accessor :alt_text + + attr_accessor :template + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'alt_text' => :'altText', + :'template' => :'template' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'alt_text' => :'String', + :'template' => :'Template' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Message' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::TemplateMessage` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::TemplateMessage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'alt_text') + self.alt_text = attributes[:'alt_text'] + end + + if attributes.key?(:'template') + self.template = attributes[:'template'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + alt_text == o.alt_text && + template == o.template && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [alt_text, template].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/template_message_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/template_message_all_of.rb new file mode 100644 index 00000000..c52bd6f1 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/template_message_all_of.rb @@ -0,0 +1,228 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class TemplateMessageAllOf + attr_accessor :alt_text + + attr_accessor :template + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'alt_text' => :'altText', + :'template' => :'template' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'alt_text' => :'String', + :'template' => :'Template' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::TemplateMessageAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::TemplateMessageAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'alt_text') + self.alt_text = attributes[:'alt_text'] + end + + if attributes.key?(:'template') + self.template = attributes[:'template'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + alt_text == o.alt_text && + template == o.template + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [alt_text, template].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/test_webhook_endpoint_request.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/test_webhook_endpoint_request.rb new file mode 100644 index 00000000..7adb0a7f --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/test_webhook_endpoint_request.rb @@ -0,0 +1,248 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class TestWebhookEndpointRequest + # A webhook URL to be validated. + attr_accessor :endpoint + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'endpoint' => :'endpoint' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'endpoint' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::TestWebhookEndpointRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::TestWebhookEndpointRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'endpoint') + self.endpoint = attributes[:'endpoint'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@endpoint.nil? && @endpoint.to_s.length > 500 + invalid_properties.push('invalid value for "endpoint", the character length must be smaller than or equal to 500.') + end + + if !@endpoint.nil? && @endpoint.to_s.length < 0 + invalid_properties.push('invalid value for "endpoint", the character length must be great than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@endpoint.nil? && @endpoint.to_s.length > 500 + return false if !@endpoint.nil? && @endpoint.to_s.length < 0 + true + end + + # Custom attribute writer method with validation + # @param [Object] endpoint Value to be assigned + def endpoint=(endpoint) + if endpoint.nil? + fail ArgumentError, 'endpoint cannot be nil' + end + + if endpoint.to_s.length > 500 + fail ArgumentError, 'invalid value for "endpoint", the character length must be smaller than or equal to 500.' + end + + if endpoint.to_s.length < 0 + fail ArgumentError, 'invalid value for "endpoint", the character length must be great than or equal to 0.' + end + + @endpoint = endpoint + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + endpoint == o.endpoint + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [endpoint].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/test_webhook_endpoint_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/test_webhook_endpoint_response.rb new file mode 100644 index 00000000..b485f1cf --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/test_webhook_endpoint_response.rb @@ -0,0 +1,288 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class TestWebhookEndpointResponse + # Result of the communication from the LINE platform to the webhook URL. + attr_accessor :success + + # Time of the event in milliseconds. Even in the case of a redelivered webhook, it represents the time the event occurred, not the time it was redelivered. + attr_accessor :timestamp + + # The HTTP status code. If the webhook response isn't received, the status code is set to zero or a negative number. + attr_accessor :status_code + + # Reason for the response. + attr_accessor :reason + + # Details of the response. + attr_accessor :detail + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'success' => :'success', + :'timestamp' => :'timestamp', + :'status_code' => :'statusCode', + :'reason' => :'reason', + :'detail' => :'detail' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'success' => :'Boolean', + :'timestamp' => :'Time', + :'status_code' => :'Integer', + :'reason' => :'String', + :'detail' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::TestWebhookEndpointResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::TestWebhookEndpointResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'success') + self.success = attributes[:'success'] + end + + if attributes.key?(:'timestamp') + self.timestamp = attributes[:'timestamp'] + else + self.timestamp = nil + end + + if attributes.key?(:'status_code') + self.status_code = attributes[:'status_code'] + else + self.status_code = nil + end + + if attributes.key?(:'reason') + self.reason = attributes[:'reason'] + else + self.reason = nil + end + + if attributes.key?(:'detail') + self.detail = attributes[:'detail'] + else + self.detail = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @timestamp.nil? + invalid_properties.push('invalid value for "timestamp", timestamp cannot be nil.') + end + + if @status_code.nil? + invalid_properties.push('invalid value for "status_code", status_code cannot be nil.') + end + + if @reason.nil? + invalid_properties.push('invalid value for "reason", reason cannot be nil.') + end + + if @detail.nil? + invalid_properties.push('invalid value for "detail", detail cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @timestamp.nil? + return false if @status_code.nil? + return false if @reason.nil? + return false if @detail.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + success == o.success && + timestamp == o.timestamp && + status_code == o.status_code && + reason == o.reason && + detail == o.detail + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [success, timestamp, status_code, reason, detail].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/text_message.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/text_message.rb new file mode 100644 index 00000000..dbd1b24b --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/text_message.rb @@ -0,0 +1,251 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class TextMessage < Message + attr_accessor :text + + attr_accessor :emojis + + # Quote token of the message you want to quote. + attr_accessor :quote_token + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'text' => :'text', + :'emojis' => :'emojis', + :'quote_token' => :'quoteToken' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'text' => :'String', + :'emojis' => :'Array', + :'quote_token' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Message' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::TextMessage` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::TextMessage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'text') + self.text = attributes[:'text'] + end + + if attributes.key?(:'emojis') + if (value = attributes[:'emojis']).is_a?(Array) + self.emojis = value + end + end + + if attributes.key?(:'quote_token') + self.quote_token = attributes[:'quote_token'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + text == o.text && + emojis == o.emojis && + quote_token == o.quote_token && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [text, emojis, quote_token].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/text_message_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/text_message_all_of.rb new file mode 100644 index 00000000..8bcda68b --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/text_message_all_of.rb @@ -0,0 +1,230 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class TextMessageAllOf + attr_accessor :text + + attr_accessor :emojis + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'text' => :'text', + :'emojis' => :'emojis' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'text' => :'String', + :'emojis' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::TextMessageAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::TextMessageAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'text') + self.text = attributes[:'text'] + end + + if attributes.key?(:'emojis') + if (value = attributes[:'emojis']).is_a?(Array) + self.emojis = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + text == o.text && + emojis == o.emojis + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [text, emojis].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/update_rich_menu_alias_request.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/update_rich_menu_alias_request.rb new file mode 100644 index 00000000..6226f43a --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/update_rich_menu_alias_request.rb @@ -0,0 +1,227 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class UpdateRichMenuAliasRequest + # The rich menu ID to be associated with the rich menu alias. + attr_accessor :rich_menu_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'rich_menu_id' => :'richMenuId' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'rich_menu_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::UpdateRichMenuAliasRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::UpdateRichMenuAliasRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'rich_menu_id') + self.rich_menu_id = attributes[:'rich_menu_id'] + else + self.rich_menu_id = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @rich_menu_id.nil? + invalid_properties.push('invalid value for "rich_menu_id", rich_menu_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @rich_menu_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + rich_menu_id == o.rich_menu_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [rich_menu_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/uri_action.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/uri_action.rb new file mode 100644 index 00000000..8e3acdbf --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/uri_action.rb @@ -0,0 +1,239 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class URIAction < Action + attr_accessor :uri + + attr_accessor :alt_uri + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'uri' => :'uri', + :'alt_uri' => :'altUri' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'uri' => :'String', + :'alt_uri' => :'AltUri' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Action' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::URIAction` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::URIAction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'uri') + self.uri = attributes[:'uri'] + end + + if attributes.key?(:'alt_uri') + self.alt_uri = attributes[:'alt_uri'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + uri == o.uri && + alt_uri == o.alt_uri && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [uri, alt_uri].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/uri_action_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/uri_action_all_of.rb new file mode 100644 index 00000000..6869cbfc --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/uri_action_all_of.rb @@ -0,0 +1,228 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class URIActionAllOf + attr_accessor :uri + + attr_accessor :alt_uri + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'uri' => :'uri', + :'alt_uri' => :'altUri' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'uri' => :'String', + :'alt_uri' => :'AltUri' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::URIActionAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::URIActionAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'uri') + self.uri = attributes[:'uri'] + end + + if attributes.key?(:'alt_uri') + self.alt_uri = attributes[:'alt_uri'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + uri == o.uri && + alt_uri == o.alt_uri + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [uri, alt_uri].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/uri_imagemap_action.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/uri_imagemap_action.rb new file mode 100644 index 00000000..c5457a21 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/uri_imagemap_action.rb @@ -0,0 +1,239 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class URIImagemapAction < ImagemapAction + attr_accessor :link_uri + + attr_accessor :label + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'link_uri' => :'linkUri', + :'label' => :'label' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'link_uri' => :'String', + :'label' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ImagemapAction' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::URIImagemapAction` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::URIImagemapAction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'link_uri') + self.link_uri = attributes[:'link_uri'] + end + + if attributes.key?(:'label') + self.label = attributes[:'label'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + link_uri == o.link_uri && + label == o.label && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [link_uri, label].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/uri_imagemap_action_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/uri_imagemap_action_all_of.rb new file mode 100644 index 00000000..071c37d3 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/uri_imagemap_action_all_of.rb @@ -0,0 +1,228 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class URIImagemapActionAllOf + attr_accessor :link_uri + + attr_accessor :label + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'link_uri' => :'linkUri', + :'label' => :'label' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'link_uri' => :'String', + :'label' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::URIImagemapActionAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::URIImagemapActionAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'link_uri') + self.link_uri = attributes[:'link_uri'] + end + + if attributes.key?(:'label') + self.label = attributes[:'label'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + link_uri == o.link_uri && + label == o.label + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [link_uri, label].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/user_profile_response.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/user_profile_response.rb new file mode 100644 index 00000000..7ae5ce47 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/user_profile_response.rb @@ -0,0 +1,274 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class UserProfileResponse + # User's display name + attr_accessor :display_name + + # User ID + attr_accessor :user_id + + # Profile image URL. `https` image URL. Not included in the response if the user doesn't have a profile image. + attr_accessor :picture_url + + # User's status message. Not included in the response if the user doesn't have a status message. + attr_accessor :status_message + + # User's language, as a BCP 47 language tag. Not included in the response if the user hasn't yet consented to the LINE Privacy Policy. + attr_accessor :language + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'display_name' => :'displayName', + :'user_id' => :'userId', + :'picture_url' => :'pictureUrl', + :'status_message' => :'statusMessage', + :'language' => :'language' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'display_name' => :'String', + :'user_id' => :'String', + :'picture_url' => :'String', + :'status_message' => :'String', + :'language' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::UserProfileResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::UserProfileResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'display_name') + self.display_name = attributes[:'display_name'] + else + self.display_name = nil + end + + if attributes.key?(:'user_id') + self.user_id = attributes[:'user_id'] + else + self.user_id = nil + end + + if attributes.key?(:'picture_url') + self.picture_url = attributes[:'picture_url'] + end + + if attributes.key?(:'status_message') + self.status_message = attributes[:'status_message'] + end + + if attributes.key?(:'language') + self.language = attributes[:'language'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @display_name.nil? + invalid_properties.push('invalid value for "display_name", display_name cannot be nil.') + end + + if @user_id.nil? + invalid_properties.push('invalid value for "user_id", user_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @display_name.nil? + return false if @user_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + display_name == o.display_name && + user_id == o.user_id && + picture_url == o.picture_url && + status_message == o.status_message && + language == o.language + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [display_name, user_id, picture_url, status_message, language].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/validate_message_request.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/validate_message_request.rb new file mode 100644 index 00000000..2bfd04a2 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/validate_message_request.rb @@ -0,0 +1,257 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class ValidateMessageRequest + # Array of message objects to validate + attr_accessor :messages + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'messages' => :'messages' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'messages' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::ValidateMessageRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::ValidateMessageRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'messages') + if (value = attributes[:'messages']).is_a?(Array) + self.messages = value + end + else + self.messages = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @messages.nil? + invalid_properties.push('invalid value for "messages", messages cannot be nil.') + end + + if @messages.length > 5 + invalid_properties.push('invalid value for "messages", number of items must be less than or equal to 5.') + end + + if @messages.length < 1 + invalid_properties.push('invalid value for "messages", number of items must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @messages.nil? + return false if @messages.length > 5 + return false if @messages.length < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] messages Value to be assigned + def messages=(messages) + if messages.nil? + fail ArgumentError, 'messages cannot be nil' + end + + if messages.length > 5 + fail ArgumentError, 'invalid value for "messages", number of items must be less than or equal to 5.' + end + + if messages.length < 1 + fail ArgumentError, 'invalid value for "messages", number of items must be greater than or equal to 1.' + end + + @messages = messages + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + messages == o.messages + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [messages].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/video_message.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/video_message.rb new file mode 100644 index 00000000..6d0bf81b --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/video_message.rb @@ -0,0 +1,248 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class VideoMessage < Message + attr_accessor :original_content_url + + attr_accessor :preview_image_url + + attr_accessor :tracking_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'original_content_url' => :'originalContentUrl', + :'preview_image_url' => :'previewImageUrl', + :'tracking_id' => :'trackingId' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'original_content_url' => :'String', + :'preview_image_url' => :'String', + :'tracking_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Message' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::VideoMessage` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::VideoMessage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'original_content_url') + self.original_content_url = attributes[:'original_content_url'] + end + + if attributes.key?(:'preview_image_url') + self.preview_image_url = attributes[:'preview_image_url'] + end + + if attributes.key?(:'tracking_id') + self.tracking_id = attributes[:'tracking_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + original_content_url == o.original_content_url && + preview_image_url == o.preview_image_url && + tracking_id == o.tracking_id && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [original_content_url, preview_image_url, tracking_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/models/video_message_all_of.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/models/video_message_all_of.rb new file mode 100644 index 00000000..987e1b34 --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/models/video_message_all_of.rb @@ -0,0 +1,237 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::MessagingApi + class VideoMessageAllOf + attr_accessor :original_content_url + + attr_accessor :preview_image_url + + attr_accessor :tracking_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'original_content_url' => :'originalContentUrl', + :'preview_image_url' => :'previewImageUrl', + :'tracking_id' => :'trackingId' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'original_content_url' => :'String', + :'preview_image_url' => :'String', + :'tracking_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::MessagingApi::VideoMessageAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::MessagingApi::VideoMessageAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'original_content_url') + self.original_content_url = attributes[:'original_content_url'] + end + + if attributes.key?(:'preview_image_url') + self.preview_image_url = attributes[:'preview_image_url'] + end + + if attributes.key?(:'tracking_id') + self.tracking_id = attributes[:'tracking_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + original_content_url == o.original_content_url && + preview_image_url == o.preview_image_url && + tracking_id == o.tracking_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [original_content_url, preview_image_url, tracking_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::MessagingApi.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/messaging-api/lib/line_client_messaging_api/version.rb b/lib/clients/messaging-api/lib/line_client_messaging_api/version.rb new file mode 100644 index 00000000..2c0f059e --- /dev/null +++ b/lib/clients/messaging-api/lib/line_client_messaging_api/version.rb @@ -0,0 +1,15 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::MessagingApi + VERSION = '2.0.0' +end diff --git a/lib/clients/module-attach/.gitignore b/lib/clients/module-attach/.gitignore new file mode 100644 index 00000000..05a17cb8 --- /dev/null +++ b/lib/clients/module-attach/.gitignore @@ -0,0 +1,39 @@ +# Generated by: https://openapi-generator.tech +# + +*.gem +*.rbc +/.config +/coverage/ +/InstalledFiles +/pkg/ +/spec/reports/ +/spec/examples.txt +/test/tmp/ +/test/version_tmp/ +/tmp/ + +## Specific to RubyMotion: +.dat* +.repl_history +build/ + +## Documentation cache and generated files: +/.yardoc/ +/_yardoc/ +/doc/ +/rdoc/ + +## Environment normalization: +/.bundle/ +/vendor/bundle +/lib/bundler/man/ + +# for a library or gem, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# Gemfile.lock +# .ruby-version +# .ruby-gemset + +# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: +.rvmrc diff --git a/lib/clients/module-attach/.openapi-generator/FILES b/lib/clients/module-attach/.openapi-generator/FILES new file mode 100644 index 00000000..b77e8e33 --- /dev/null +++ b/lib/clients/module-attach/.openapi-generator/FILES @@ -0,0 +1,22 @@ +.gitignore +.gitlab-ci.yml +.rspec +.rubocop.yml +.travis.yml +Gemfile +README.md +Rakefile +docs/AttachModuleResponse.md +docs/LineModuleAttachApi.md +git_push.sh +lib/line_client_module_attach.rb +lib/line_client_module_attach/api/line_module_attach_api.rb +lib/line_client_module_attach/api_client.rb +lib/line_client_module_attach/api_error.rb +lib/line_client_module_attach/configuration.rb +lib/line_client_module_attach/models/attach_module_response.rb +lib/line_client_module_attach/version.rb +line_client_module_attach.gemspec +spec/api_client_spec.rb +spec/configuration_spec.rb +spec/spec_helper.rb diff --git a/lib/clients/module-attach/.openapi-generator/VERSION b/lib/clients/module-attach/.openapi-generator/VERSION new file mode 100644 index 00000000..41225218 --- /dev/null +++ b/lib/clients/module-attach/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.0.0 \ No newline at end of file diff --git a/lib/clients/module-attach/README.md b/lib/clients/module-attach/README.md new file mode 100644 index 00000000..687439d4 --- /dev/null +++ b/lib/clients/module-attach/README.md @@ -0,0 +1,108 @@ +# LINE::Client::ModuleAttach + +This document describes LINE Messaging API. + +This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 0.0.1 +- Package version: 2.0.0 +- Build package: org.openapitools.codegen.languages.RubyClientCodegen + +## Installation + +### Build a gem + +To build the Ruby code into a gem: + +```shell +gem build line-bot-api.gemspec +``` + +Then either install the gem locally: + +```shell +gem install ./line-bot-api-2.0.0.gem +``` + +(for development, run `gem install --dev ./line-bot-api-2.0.0.gem` to install the development dependencies) + +or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/). + +Finally add this to the Gemfile: + + gem 'line-bot-api', '~> 2.0.0' + +### Install from Git + +If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile: + + gem 'line-bot-api', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git' + +### Include the Ruby code directly + +Include the Ruby code directly using `-I` as follows: + +```shell +ruby -Ilib script.rb +``` + +## Getting Started + +Please follow the [installation](#installation) procedure and then run the following code: + +```ruby +# Load the gem +require 'line-bot-api' + +# Setup authorization +LINE::Client::ModuleAttach.configure do |config| + # Configure HTTP basic authorization: basicAuth + config.username = 'YOUR_USERNAME' + config.password = 'YOUR_PASSWORD' +end + +api_instance = LINE::Client::ModuleAttach::LineModuleAttachApi.new +opts = { + grant_type: 'grant_type_example', # String | authorization_code + code: 'code_example', # String | Authorization code received from the LINE Platform. + redirect_uri: 'redirect_uri_example', # String | Specify the redirect_uri specified in the URL for authentication and authorization. + code_verifier: 'code_verifier_example', # String | Specify when using PKCE (Proof Key for Code Exchange) defined in the OAuth 2.0 extension specification as a countermeasure against authorization code interception attacks. + client_id: 'client_id_example', # String | Instead of using Authorization header, you can use this parameter to specify the channel ID of the module channel. You can find the channel ID of the module channel in the LINE Developers Console. + client_secret: 'client_secret_example', # String | Instead of using Authorization header, you can use this parameter to specify the channel secret of the module channel. You can find the channel secret of the module channel in the LINE Developers Console. + region: 'region_example', # String | If you specified a value for region in the URL for authentication and authorization, specify the same value. + basic_search_id: 'basic_search_id_example', # String | If you specified a value for basic_search_id in the URL for authentication and authorization, specify the same value. + scope: 'scope_example', # String | If you specified a value for scope in the URL for authentication and authorization, specify the same value. + brand_type: 'brand_type_example' # String | If you specified a value for brand_type in the URL for authentication and authorization, specify the same value. +} + +begin + result = api_instance.attach_module(opts) + p result +rescue LINE::Client::ModuleAttach::ApiError => e + puts "Exception when calling LineModuleAttachApi->attach_module: #{e}" +end + +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://manager.line.biz* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*LINE::Client::ModuleAttach::LineModuleAttachApi* | [**attach_module**](docs/LineModuleAttachApi.md#attach_module) | **POST** /module/auth/v1/token | + + +## Documentation for Models + + - [LINE::Client::ModuleAttach::AttachModuleResponse](docs/AttachModuleResponse.md) + + +## Documentation for Authorization + + +Authentication schemes defined for the API: +### basicAuth + +- **Type**: HTTP basic authentication + diff --git a/lib/clients/module-attach/docs/AttachModuleResponse.md b/lib/clients/module-attach/docs/AttachModuleResponse.md new file mode 100644 index 00000000..0a43766d --- /dev/null +++ b/lib/clients/module-attach/docs/AttachModuleResponse.md @@ -0,0 +1,20 @@ +# LINE::Client::ModuleAttach::AttachModuleResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **bot_id** | **String** | User ID of the bot on the LINE Official Account. | | +| **scopes** | **Array<String>** | Permissions (scope) granted by the LINE Official Account admin. | | + +## Example + +```ruby +require 'line_client_module_attach' + +instance = LINE::Client::ModuleAttach::AttachModuleResponse.new( + bot_id: null, + scopes: null +) +``` + diff --git a/lib/clients/module-attach/docs/LineModuleAttachApi.md b/lib/clients/module-attach/docs/LineModuleAttachApi.md new file mode 100644 index 00000000..4582f599 --- /dev/null +++ b/lib/clients/module-attach/docs/LineModuleAttachApi.md @@ -0,0 +1,98 @@ +# LINE::Client::ModuleAttach::LineModuleAttachApi + +All URIs are relative to *https://manager.line.biz* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**attach_module**](LineModuleAttachApi.md#attach_module) | **POST** /module/auth/v1/token | | + + +## attach_module + +> attach_module(opts) + + + +Attach by operation of the module channel provider + +### Examples + +```ruby +require 'time' +require 'line_client_module_attach' +# setup authorization +LINE::Client::ModuleAttach.configure do |config| + # Configure HTTP basic authorization: basicAuth + config.username = 'YOUR USERNAME' + config.password = 'YOUR PASSWORD' +end + +api_instance = LINE::Client::ModuleAttach::LineModuleAttachApi.new +opts = { + grant_type: 'grant_type_example', # String | authorization_code + code: 'code_example', # String | Authorization code received from the LINE Platform. + redirect_uri: 'redirect_uri_example', # String | Specify the redirect_uri specified in the URL for authentication and authorization. + code_verifier: 'code_verifier_example', # String | Specify when using PKCE (Proof Key for Code Exchange) defined in the OAuth 2.0 extension specification as a countermeasure against authorization code interception attacks. + client_id: 'client_id_example', # String | Instead of using Authorization header, you can use this parameter to specify the channel ID of the module channel. You can find the channel ID of the module channel in the LINE Developers Console. + client_secret: 'client_secret_example', # String | Instead of using Authorization header, you can use this parameter to specify the channel secret of the module channel. You can find the channel secret of the module channel in the LINE Developers Console. + region: 'region_example', # String | If you specified a value for region in the URL for authentication and authorization, specify the same value. + basic_search_id: 'basic_search_id_example', # String | If you specified a value for basic_search_id in the URL for authentication and authorization, specify the same value. + scope: 'scope_example', # String | If you specified a value for scope in the URL for authentication and authorization, specify the same value. + brand_type: 'brand_type_example' # String | If you specified a value for brand_type in the URL for authentication and authorization, specify the same value. +} + +begin + + result = api_instance.attach_module(opts) + p result +rescue LINE::Client::ModuleAttach::ApiError => e + puts "Error when calling LineModuleAttachApi->attach_module: #{e}" +end +``` + +#### Using the attach_module_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> attach_module_with_http_info(opts) + +```ruby +begin + + data, status_code, headers = api_instance.attach_module_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::ModuleAttach::ApiError => e + puts "Error when calling LineModuleAttachApi->attach_module_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **grant_type** | **String** | authorization_code | [optional] | +| **code** | **String** | Authorization code received from the LINE Platform. | [optional] | +| **redirect_uri** | **String** | Specify the redirect_uri specified in the URL for authentication and authorization. | [optional] | +| **code_verifier** | **String** | Specify when using PKCE (Proof Key for Code Exchange) defined in the OAuth 2.0 extension specification as a countermeasure against authorization code interception attacks. | [optional] | +| **client_id** | **String** | Instead of using Authorization header, you can use this parameter to specify the channel ID of the module channel. You can find the channel ID of the module channel in the LINE Developers Console. | [optional] | +| **client_secret** | **String** | Instead of using Authorization header, you can use this parameter to specify the channel secret of the module channel. You can find the channel secret of the module channel in the LINE Developers Console. | [optional] | +| **region** | **String** | If you specified a value for region in the URL for authentication and authorization, specify the same value. | [optional] | +| **basic_search_id** | **String** | If you specified a value for basic_search_id in the URL for authentication and authorization, specify the same value. | [optional] | +| **scope** | **String** | If you specified a value for scope in the URL for authentication and authorization, specify the same value. | [optional] | +| **brand_type** | **String** | If you specified a value for brand_type in the URL for authentication and authorization, specify the same value. | [optional] | + +### Return type + +[**AttachModuleResponse**](AttachModuleResponse.md) + +### Authorization + +[basicAuth](../README.md#basicAuth) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: application/json + diff --git a/lib/clients/module-attach/lib/line_client_module_attach.rb b/lib/clients/module-attach/lib/line_client_module_attach.rb new file mode 100644 index 00000000..57599aea --- /dev/null +++ b/lib/clients/module-attach/lib/line_client_module_attach.rb @@ -0,0 +1,41 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +# Common files +require 'line_client_module_attach/api_client' +require 'line_client_module_attach/api_error' +require 'line_client_module_attach/version' +require 'line_client_module_attach/configuration' + +# Models +require 'line_client_module_attach/models/attach_module_response' + +# APIs +require 'line_client_module_attach/api/line_module_attach_api' + +module LINE::Client::ModuleAttach + class << self + # Customize default settings for the SDK using block. + # LINE::Client::ModuleAttach.configure do |config| + # config.username = "xxx" + # config.password = "xxx" + # end + # If no block given, return the default Configuration object. + def configure + if block_given? + yield(Configuration.default) + else + Configuration.default + end + end + end +end diff --git a/lib/clients/module-attach/lib/line_client_module_attach/api/line_module_attach_api.rb b/lib/clients/module-attach/lib/line_client_module_attach/api/line_module_attach_api.rb new file mode 100644 index 00000000..c2c2b89b --- /dev/null +++ b/lib/clients/module-attach/lib/line_client_module_attach/api/line_module_attach_api.rb @@ -0,0 +1,112 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'cgi' + +module LINE::Client::ModuleAttach + class LineModuleAttachApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Attach by operation of the module channel provider + # @param [Hash] opts the optional parameters + # @option opts [String] :grant_type authorization_code + # @option opts [String] :code Authorization code received from the LINE Platform. + # @option opts [String] :redirect_uri Specify the redirect_uri specified in the URL for authentication and authorization. + # @option opts [String] :code_verifier Specify when using PKCE (Proof Key for Code Exchange) defined in the OAuth 2.0 extension specification as a countermeasure against authorization code interception attacks. + # @option opts [String] :client_id Instead of using Authorization header, you can use this parameter to specify the channel ID of the module channel. You can find the channel ID of the module channel in the LINE Developers Console. + # @option opts [String] :client_secret Instead of using Authorization header, you can use this parameter to specify the channel secret of the module channel. You can find the channel secret of the module channel in the LINE Developers Console. + # @option opts [String] :region If you specified a value for region in the URL for authentication and authorization, specify the same value. + # @option opts [String] :basic_search_id If you specified a value for basic_search_id in the URL for authentication and authorization, specify the same value. + # @option opts [String] :scope If you specified a value for scope in the URL for authentication and authorization, specify the same value. + # @option opts [String] :brand_type If you specified a value for brand_type in the URL for authentication and authorization, specify the same value. + # @return [AttachModuleResponse] + def attach_module(opts = {}) + data, _status_code, _headers = attach_module_with_http_info(opts) + data + end + + # Attach by operation of the module channel provider + # @param [Hash] opts the optional parameters + # @option opts [String] :grant_type authorization_code + # @option opts [String] :code Authorization code received from the LINE Platform. + # @option opts [String] :redirect_uri Specify the redirect_uri specified in the URL for authentication and authorization. + # @option opts [String] :code_verifier Specify when using PKCE (Proof Key for Code Exchange) defined in the OAuth 2.0 extension specification as a countermeasure against authorization code interception attacks. + # @option opts [String] :client_id Instead of using Authorization header, you can use this parameter to specify the channel ID of the module channel. You can find the channel ID of the module channel in the LINE Developers Console. + # @option opts [String] :client_secret Instead of using Authorization header, you can use this parameter to specify the channel secret of the module channel. You can find the channel secret of the module channel in the LINE Developers Console. + # @option opts [String] :region If you specified a value for region in the URL for authentication and authorization, specify the same value. + # @option opts [String] :basic_search_id If you specified a value for basic_search_id in the URL for authentication and authorization, specify the same value. + # @option opts [String] :scope If you specified a value for scope in the URL for authentication and authorization, specify the same value. + # @option opts [String] :brand_type If you specified a value for brand_type in the URL for authentication and authorization, specify the same value. + # @return [Array<(AttachModuleResponse, Integer, Hash)>] AttachModuleResponse data, response status code and response headers + def attach_module_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LineModuleAttachApi.attach_module ...' + end + # resource path + local_var_path = '/module/auth/v1/token' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + form_params['grant_type'] = opts[:'grant_type'] if !opts[:'grant_type'].nil? + form_params['code'] = opts[:'code'] if !opts[:'code'].nil? + form_params['redirect_uri'] = opts[:'redirect_uri'] if !opts[:'redirect_uri'].nil? + form_params['code_verifier'] = opts[:'code_verifier'] if !opts[:'code_verifier'].nil? + form_params['client_id'] = opts[:'client_id'] if !opts[:'client_id'].nil? + form_params['client_secret'] = opts[:'client_secret'] if !opts[:'client_secret'].nil? + form_params['region'] = opts[:'region'] if !opts[:'region'].nil? + form_params['basic_search_id'] = opts[:'basic_search_id'] if !opts[:'basic_search_id'].nil? + form_params['scope'] = opts[:'scope'] if !opts[:'scope'].nil? + form_params['brand_type'] = opts[:'brand_type'] if !opts[:'brand_type'].nil? + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'AttachModuleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['basicAuth'] + + new_options = opts.merge( + :operation => :"LineModuleAttachApi.attach_module", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LineModuleAttachApi#attach_module\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/clients/module-attach/lib/line_client_module_attach/api_client.rb b/lib/clients/module-attach/lib/line_client_module_attach/api_client.rb new file mode 100644 index 00000000..6fe366c6 --- /dev/null +++ b/lib/clients/module-attach/lib/line_client_module_attach/api_client.rb @@ -0,0 +1,392 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'json' +require 'logger' +require 'tempfile' +require 'time' +require 'typhoeus' + +module LINE::Client::ModuleAttach + class ApiClient + # The Configuration object holding settings to be used in the API client. + attr_accessor :config + + # Defines the headers to be used in HTTP requests of all API calls by default. + # + # @return [Hash] + attr_accessor :default_headers + + # Initializes the ApiClient + # @option config [Configuration] Configuration for initializing the object, default to Configuration.default + def initialize(config = Configuration.default) + @config = config + @user_agent = "LINE-BotSDK-Ruby/2.0.0" + @default_headers = { + 'Content-Type' => 'application/json', + 'User-Agent' => @user_agent + } + end + + def self.default + @@default ||= ApiClient.new + end + + # Call an API with given options. + # + # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: + # the data deserialized from response body (could be nil), response status code and response headers. + def call_api(http_method, path, opts = {}) + request = build_request(http_method, path, opts) + response = request.run + + if @config.debugging + @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" + end + + unless response.success? + if response.timed_out? + fail ApiError.new('Connection timed out') + elsif response.code == 0 + # Errors from libcurl will be made visible here + fail ApiError.new(:code => 0, + :message => response.return_message) + else + fail ApiError.new(:code => response.code, + :response_headers => response.headers, + :response_body => response.body), + response.status_message + end + end + + if opts[:return_type] + data = deserialize(response, opts[:return_type]) + else + data = nil + end + return data, response.code, response.headers + end + + # Builds the HTTP request + # + # @param [String] http_method HTTP method/verb (e.g. POST) + # @param [String] path URL path (e.g. /account/new) + # @option opts [Hash] :header_params Header parameters + # @option opts [Hash] :query_params Query parameters + # @option opts [Hash] :form_params Query parameters + # @option opts [Object] :body HTTP body (JSON/XML) + # @return [Typhoeus::Request] A Typhoeus Request + def build_request(http_method, path, opts = {}) + url = build_request_url(path, opts) + http_method = http_method.to_sym.downcase + + header_params = @default_headers.merge(opts[:header_params] || {}) + query_params = opts[:query_params] || {} + form_params = opts[:form_params] || {} + follow_location = opts[:follow_location] || true + + update_params_for_auth! header_params, query_params, opts[:auth_names] + + # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false) + _verify_ssl_host = @config.verify_ssl_host ? 2 : 0 + + req_opts = { + :method => http_method, + :headers => header_params, + :params => query_params, + :params_encoding => @config.params_encoding, + :timeout => @config.timeout, + :ssl_verifypeer => @config.verify_ssl, + :ssl_verifyhost => _verify_ssl_host, + :sslcert => @config.cert_file, + :sslkey => @config.key_file, + :verbose => @config.debugging, + :followlocation => follow_location + } + + # set custom cert, if provided + req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert + + if [:post, :patch, :put, :delete].include?(http_method) + req_body = build_request_body(header_params, form_params, opts[:body]) + req_opts.update :body => req_body + if @config.debugging + @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n" + end + end + + request = Typhoeus::Request.new(url, req_opts) + download_file(request) if opts[:return_type] == 'File' + request + end + + # Builds the HTTP request body + # + # @param [Hash] header_params Header parameters + # @param [Hash] form_params Query parameters + # @param [Object] body HTTP body (JSON/XML) + # @return [String] HTTP body data in the form of string + def build_request_body(header_params, form_params, body) + # http form + if header_params['Content-Type'] == 'application/x-www-form-urlencoded' || + header_params['Content-Type'] == 'multipart/form-data' + data = {} + form_params.each do |key, value| + case value + when ::File, ::Array, nil + # let typhoeus handle File, Array and nil parameters + data[key] = value + else + data[key] = value.to_s + end + end + elsif body + data = body.is_a?(String) ? body : body.to_json + else + data = nil + end + data + end + + # Save response body into a file in (the defined) temporary folder, using the filename + # from the "Content-Disposition" header if provided, otherwise a random filename. + # The response body is written to the file in chunks in order to handle files which + # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby + # process can use. + # + # @see Configuration#temp_folder_path + def download_file(request) + tempfile = nil + encoding = nil + request.on_headers do |response| + content_disposition = response.headers['Content-Disposition'] + if content_disposition && content_disposition =~ /filename=/i + filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1] + prefix = sanitize_filename(filename) + else + prefix = 'download-' + end + prefix = prefix + '-' unless prefix.end_with?('-') + encoding = response.body.encoding + tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) + @tempfile = tempfile + end + request.on_body do |chunk| + chunk.force_encoding(encoding) + tempfile.write(chunk) + end + request.on_complete do |response| + if tempfile + tempfile.close + @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ + "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ + "will be deleted automatically with GC. It's also recommended to delete the temp file "\ + "explicitly with `tempfile.delete`" + end + end + end + + # Check if the given MIME is a JSON MIME. + # JSON MIME examples: + # application/json + # application/json; charset=UTF8 + # APPLICATION/JSON + # */* + # @param [String] mime MIME + # @return [Boolean] True if the MIME is application/json + def json_mime?(mime) + (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + end + + # Deserialize the response to the given return type. + # + # @param [Response] response HTTP response + # @param [String] return_type some examples: "User", "Array", "Hash" + def deserialize(response, return_type) + body = response.body + + # handle file downloading - return the File instance processed in request callbacks + # note that response body is empty when the file is written in chunks in request on_body callback + return @tempfile if return_type == 'File' + + return nil if body.nil? || body.empty? + + # return response body directly for String return type + return body if return_type == 'String' + + # ensuring a default content type + content_type = response.headers['Content-Type'] || 'application/json' + + fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type) + + begin + data = JSON.parse("[#{body}]", :symbolize_names => true)[0] + rescue JSON::ParserError => e + if %w(String Date Time).include?(return_type) + data = body + else + raise e + end + end + + convert_to_type data, return_type + end + + # Convert data to the given return type. + # @param [Object] data Data to be converted + # @param [String] return_type Return type + # @return [Mixed] Data in a particular type + def convert_to_type(data, return_type) + return nil if data.nil? + case return_type + when 'String' + data.to_s + when 'Integer' + data.to_i + when 'Float' + data.to_f + when 'Boolean' + data == true + when 'Time' + # parse date time (expecting ISO 8601 format) + Time.parse data + when 'Date' + # parse date time (expecting ISO 8601 format) + Date.parse data + when 'Object' + # generic object (usually a Hash), return directly + data + when /\AArray<(.+)>\z/ + # e.g. Array + sub_type = $1 + data.map { |item| convert_to_type(item, sub_type) } + when /\AHash\\z/ + # e.g. Hash + sub_type = $1 + {}.tap do |hash| + data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } + end + else + # models (e.g. Pet) or oneOf + klass = LINE::Client::ModuleAttach.const_get(return_type) + klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + end + end + + # Sanitize filename by removing path. + # e.g. ../../sun.gif becomes sun.gif + # + # @param [String] filename the filename to be sanitized + # @return [String] the sanitized filename + def sanitize_filename(filename) + filename.gsub(/.*[\/\\]/, '') + end + + def build_request_url(path, opts = {}) + # Add leading and trailing slashes to path + path = "/#{path}".gsub(/\/+/, '/') + @config.base_url(opts[:operation]) + path + end + + # Update header and query params based on authentication settings. + # + # @param [Hash] header_params Header parameters + # @param [Hash] query_params Query parameters + # @param [String] auth_names Authentication scheme name + def update_params_for_auth!(header_params, query_params, auth_names) + Array(auth_names).each do |auth_name| + auth_setting = @config.auth_settings[auth_name] + next unless auth_setting + case auth_setting[:in] + when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] + when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] + else fail ArgumentError, 'Authentication token must be in `query` or `header`' + end + end + end + + # Sets user agent in HTTP header + # + # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0) + def user_agent=(user_agent) + @user_agent = user_agent + @default_headers['User-Agent'] = @user_agent + end + + # Return Accept header based on an array of accepts provided. + # @param [Array] accepts array for Accept + # @return [String] the Accept header (e.g. application/json) + def select_header_accept(accepts) + return nil if accepts.nil? || accepts.empty? + # use JSON when present, otherwise use all of the provided + json_accept = accepts.find { |s| json_mime?(s) } + json_accept || accepts.join(',') + end + + # Return Content-Type header based on an array of content types provided. + # @param [Array] content_types array for Content-Type + # @return [String] the Content-Type header (e.g. application/json) + def select_header_content_type(content_types) + # return nil by default + return if content_types.nil? || content_types.empty? + # use JSON when present, otherwise use the first one + json_content_type = content_types.find { |s| json_mime?(s) } + json_content_type || content_types.first + end + + # Convert object (array, hash, object, etc) to JSON string. + # @param [Object] model object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_http_body(model) + return model if model.nil? || model.is_a?(String) + local_body = nil + if model.is_a?(Array) + local_body = model.map { |m| object_to_hash(m) } + else + local_body = object_to_hash(model) + end + local_body.to_json + end + + # Convert object(non-array) to hash. + # @param [Object] obj object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_hash(obj) + if obj.respond_to?(:to_hash) + obj.to_hash + else + obj + end + end + + # Build parameter value according to the given collection format. + # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi + def build_collection_param(param, collection_format) + case collection_format + when :csv + param.join(',') + when :ssv + param.join(' ') + when :tsv + param.join("\t") + when :pipes + param.join('|') + when :multi + # return the array directly as typhoeus will handle it as expected + param + else + fail "unknown collection format: #{collection_format.inspect}" + end + end + end +end diff --git a/lib/clients/module-attach/lib/line_client_module_attach/api_error.rb b/lib/clients/module-attach/lib/line_client_module_attach/api_error.rb new file mode 100644 index 00000000..df572471 --- /dev/null +++ b/lib/clients/module-attach/lib/line_client_module_attach/api_error.rb @@ -0,0 +1,58 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::ModuleAttach + class ApiError < StandardError + attr_reader :code, :response_headers, :response_body + + # Usage examples: + # ApiError.new + # ApiError.new("message") + # ApiError.new(:code => 500, :response_headers => {}, :response_body => "") + # ApiError.new(:code => 404, :message => "Not Found") + def initialize(arg = nil) + if arg.is_a? Hash + if arg.key?(:message) || arg.key?('message') + super(arg[:message] || arg['message']) + else + super arg + end + + arg.each do |k, v| + instance_variable_set "@#{k}", v + end + else + super arg + @message = arg + end + end + + # Override to_s to display a friendly error message + def to_s + message + end + + def message + if @message.nil? + msg = "Error message: the server returns an error" + else + msg = @message + end + + msg += "\nHTTP status code: #{code}" if code + msg += "\nResponse headers: #{response_headers}" if response_headers + msg += "\nResponse body: #{response_body}" if response_body + + msg + end + end +end diff --git a/lib/clients/module-attach/lib/line_client_module_attach/configuration.rb b/lib/clients/module-attach/lib/line_client_module_attach/configuration.rb new file mode 100644 index 00000000..e53ab284 --- /dev/null +++ b/lib/clients/module-attach/lib/line_client_module_attach/configuration.rb @@ -0,0 +1,297 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::ModuleAttach + class Configuration + # Defines url scheme + attr_accessor :scheme + + # Defines url host + attr_accessor :host + + # Defines url base path + attr_accessor :base_path + + # Define server configuration index + attr_accessor :server_index + + # Define server operation configuration index + attr_accessor :server_operation_index + + # Default server variables + attr_accessor :server_variables + + # Default server operation variables + attr_accessor :server_operation_variables + + # Defines API keys used with API Key authentications. + # + # @return [Hash] key: parameter name, value: parameter value (API key) + # + # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string) + # config.api_key['api_key'] = 'xxx' + attr_accessor :api_key + + # Defines API key prefixes used with API Key authentications. + # + # @return [Hash] key: parameter name, value: API key prefix + # + # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers) + # config.api_key_prefix['api_key'] = 'Token' + attr_accessor :api_key_prefix + + # Defines the username used with HTTP basic authentication. + # + # @return [String] + attr_accessor :username + + # Defines the password used with HTTP basic authentication. + # + # @return [String] + attr_accessor :password + + # Defines the access token (Bearer) used with OAuth2. + attr_accessor :access_token + + # Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2. + # Overrides the access_token if set + # @return [Proc] + attr_accessor :access_token_getter + + # Set this to return data as binary instead of downloading a temp file. When enabled (set to true) + # HTTP responses with return type `File` will be returned as a stream of binary data. + # Default to false. + attr_accessor :return_binary_data + + # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response + # details will be logged with `logger.debug` (see the `logger` attribute). + # Default to false. + # + # @return [true, false] + attr_accessor :debugging + + # Defines the logger used for debugging. + # Default to `Rails.logger` (when in Rails) or logging to STDOUT. + # + # @return [#debug] + attr_accessor :logger + + # Defines the temporary folder to store downloaded files + # (for API endpoints that have file response). + # Default to use `Tempfile`. + # + # @return [String] + attr_accessor :temp_folder_path + + # The time limit for HTTP request in seconds. + # Default to 0 (never times out). + attr_accessor :timeout + + # Set this to false to skip client side validation in the operation. + # Default to true. + # @return [true, false] + attr_accessor :client_side_validation + + ### TLS/SSL setting + # Set this to false to skip verifying SSL certificate when calling API from https server. + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl + + ### TLS/SSL setting + # Set this to false to skip verifying SSL host name + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl_host + + ### TLS/SSL setting + # Set this to customize the certificate file to verify the peer. + # + # @return [String] the path to the certificate file + # + # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code: + # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145 + attr_accessor :ssl_ca_cert + + ### TLS/SSL setting + # Client certificate file (for client certificate) + attr_accessor :cert_file + + ### TLS/SSL setting + # Client private key file (for client certificate) + attr_accessor :key_file + + # Set this to customize parameters encoding of array parameter with multi collectionFormat. + # Default to nil. + # + # @see The params_encoding option of Ethon. Related source code: + # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 + attr_accessor :params_encoding + + + attr_accessor :inject_format + + attr_accessor :force_ending_format + + def initialize + @scheme = 'https' + @host = 'manager.line.biz' + @base_path = '' + @server_index = nil + @server_operation_index = {} + @server_variables = {} + @server_operation_variables = {} + @api_key = {} + @api_key_prefix = {} + @client_side_validation = true + @verify_ssl = true + @verify_ssl_host = true + @cert_file = nil + @key_file = nil + @timeout = 0 + @params_encoding = nil + @debugging = false + @inject_format = false + @force_ending_format = false + @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) + + yield(self) if block_given? + end + + # The default Configuration object. + def self.default + @@default ||= Configuration.new + end + + def configure + yield(self) if block_given? + end + + def scheme=(scheme) + # remove :// from scheme + @scheme = scheme.sub(/:\/\//, '') + end + + def host=(host) + # remove http(s):// and anything after a slash + @host = host.sub(/https?:\/\//, '').split('/').first + end + + def base_path=(base_path) + # Add leading and trailing slashes to base_path + @base_path = "/#{base_path}".gsub(/\/+/, '/') + @base_path = '' if @base_path == '/' + end + + # Returns base URL for specified operation based on server settings + def base_url(operation = nil) + if operation_server_settings.key?(operation) then + index = server_operation_index.fetch(operation, server_index) + server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) + else + server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil) + end + end + + # Gets API key (with prefix if set). + # @param [String] param_name the parameter name of API key auth + def api_key_with_prefix(param_name, param_alias = nil) + key = @api_key[param_name] + key = @api_key.fetch(param_alias, key) unless param_alias.nil? + if @api_key_prefix[param_name] + "#{@api_key_prefix[param_name]} #{key}" + else + key + end + end + + # Gets access_token using access_token_getter or uses the static access_token + def access_token_with_refresh + return access_token if access_token_getter.nil? + access_token_getter.call + end + + # Gets Basic Auth token string + def basic_auth_token + 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") + end + + # Returns Auth Settings hash for api client. + def auth_settings + { + 'basicAuth' => + { + type: 'basic', + in: 'header', + key: 'Authorization', + value: basic_auth_token + }, + } + end + + # Returns an array of Server setting + def server_settings + [ + { + url: "https://manager.line.biz", + description: "No description provided", + } + ] + end + + def operation_server_settings + { + } + end + + # Returns URL based on server settings + # + # @param index array index of the server settings + # @param variables hash of variable and the corresponding value + def server_url(index, variables = {}, servers = nil) + servers = server_settings if servers == nil + + # check array index out of bound + if (index.nil? || index < 0 || index >= servers.size) + fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}" + end + + server = servers[index] + url = server[:url] + + return url unless server.key? :variables + + # go through variable and assign a value + server[:variables].each do |name, variable| + if variables.key?(name) + if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name])) + url.gsub! "{" + name.to_s + "}", variables[name] + else + fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}." + end + else + # use default value + url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] + end + end + + url + end + + end +end diff --git a/lib/clients/module-attach/lib/line_client_module_attach/models/attach_module_response.rb b/lib/clients/module-attach/lib/line_client_module_attach/models/attach_module_response.rb new file mode 100644 index 00000000..a87c5b1e --- /dev/null +++ b/lib/clients/module-attach/lib/line_client_module_attach/models/attach_module_response.rb @@ -0,0 +1,247 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::ModuleAttach + # Attach by operation of the module channel provider + class AttachModuleResponse + # User ID of the bot on the LINE Official Account. + attr_accessor :bot_id + + # Permissions (scope) granted by the LINE Official Account admin. + attr_accessor :scopes + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'bot_id' => :'bot_id', + :'scopes' => :'scopes' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'bot_id' => :'String', + :'scopes' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::ModuleAttach::AttachModuleResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::ModuleAttach::AttachModuleResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'bot_id') + self.bot_id = attributes[:'bot_id'] + else + self.bot_id = nil + end + + if attributes.key?(:'scopes') + if (value = attributes[:'scopes']).is_a?(Array) + self.scopes = value + end + else + self.scopes = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @bot_id.nil? + invalid_properties.push('invalid value for "bot_id", bot_id cannot be nil.') + end + + if @scopes.nil? + invalid_properties.push('invalid value for "scopes", scopes cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @bot_id.nil? + return false if @scopes.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + bot_id == o.bot_id && + scopes == o.scopes + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [bot_id, scopes].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::ModuleAttach.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/module-attach/lib/line_client_module_attach/version.rb b/lib/clients/module-attach/lib/line_client_module_attach/version.rb new file mode 100644 index 00000000..e0f004b4 --- /dev/null +++ b/lib/clients/module-attach/lib/line_client_module_attach/version.rb @@ -0,0 +1,15 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::ModuleAttach + VERSION = '2.0.0' +end diff --git a/lib/clients/module/.gitignore b/lib/clients/module/.gitignore new file mode 100644 index 00000000..05a17cb8 --- /dev/null +++ b/lib/clients/module/.gitignore @@ -0,0 +1,39 @@ +# Generated by: https://openapi-generator.tech +# + +*.gem +*.rbc +/.config +/coverage/ +/InstalledFiles +/pkg/ +/spec/reports/ +/spec/examples.txt +/test/tmp/ +/test/version_tmp/ +/tmp/ + +## Specific to RubyMotion: +.dat* +.repl_history +build/ + +## Documentation cache and generated files: +/.yardoc/ +/_yardoc/ +/doc/ +/rdoc/ + +## Environment normalization: +/.bundle/ +/vendor/bundle +/lib/bundler/man/ + +# for a library or gem, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# Gemfile.lock +# .ruby-version +# .ruby-gemset + +# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: +.rvmrc diff --git a/lib/clients/module/.openapi-generator/FILES b/lib/clients/module/.openapi-generator/FILES new file mode 100644 index 00000000..903bd3a1 --- /dev/null +++ b/lib/clients/module/.openapi-generator/FILES @@ -0,0 +1,28 @@ +.gitignore +.gitlab-ci.yml +.rspec +.rubocop.yml +.travis.yml +Gemfile +README.md +Rakefile +docs/AcquireChatControlRequest.md +docs/DetachModuleRequest.md +docs/GetModulesResponse.md +docs/LineModuleApi.md +docs/ModuleBot.md +git_push.sh +lib/line_client_module.rb +lib/line_client_module/api/line_module_api.rb +lib/line_client_module/api_client.rb +lib/line_client_module/api_error.rb +lib/line_client_module/configuration.rb +lib/line_client_module/models/acquire_chat_control_request.rb +lib/line_client_module/models/detach_module_request.rb +lib/line_client_module/models/get_modules_response.rb +lib/line_client_module/models/module_bot.rb +lib/line_client_module/version.rb +line_client_module.gemspec +spec/api_client_spec.rb +spec/configuration_spec.rb +spec/spec_helper.rb diff --git a/lib/clients/module/.openapi-generator/VERSION b/lib/clients/module/.openapi-generator/VERSION new file mode 100644 index 00000000..41225218 --- /dev/null +++ b/lib/clients/module/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.0.0 \ No newline at end of file diff --git a/lib/clients/module/README.md b/lib/clients/module/README.md new file mode 100644 index 00000000..948071f6 --- /dev/null +++ b/lib/clients/module/README.md @@ -0,0 +1,106 @@ +# LINE::Client::Module + +This document describes LINE Messaging API. + +This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 0.0.1 +- Package version: 2.0.0 +- Build package: org.openapitools.codegen.languages.RubyClientCodegen + +## Installation + +### Build a gem + +To build the Ruby code into a gem: + +```shell +gem build line-bot-api.gemspec +``` + +Then either install the gem locally: + +```shell +gem install ./line-bot-api-2.0.0.gem +``` + +(for development, run `gem install --dev ./line-bot-api-2.0.0.gem` to install the development dependencies) + +or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/). + +Finally add this to the Gemfile: + + gem 'line-bot-api', '~> 2.0.0' + +### Install from Git + +If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile: + + gem 'line-bot-api', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git' + +### Include the Ruby code directly + +Include the Ruby code directly using `-I` as follows: + +```shell +ruby -Ilib script.rb +``` + +## Getting Started + +Please follow the [installation](#installation) procedure and then run the following code: + +```ruby +# Load the gem +require 'line-bot-api' + +# Setup authorization +LINE::Client::Module.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' + # Configure a proc to get access tokens in lieu of the static access_token configuration + config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' } +end + +api_instance = LINE::Client::Module::LineModuleApi.new +chat_id = 'chat_id_example' # String | The `userId`, `roomId`, or `groupId` +opts = { + acquire_chat_control_request: LINE::Client::Module::AcquireChatControlRequest.new # AcquireChatControlRequest | +} + +begin + api_instance.acquire_chat_control(chat_id, opts) +rescue LINE::Client::Module::ApiError => e + puts "Exception when calling LineModuleApi->acquire_chat_control: #{e}" +end + +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://api.line.me* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*LINE::Client::Module::LineModuleApi* | [**acquire_chat_control**](docs/LineModuleApi.md#acquire_chat_control) | **POST** /v2/bot/chat/{chatId}/control/acquire | +*LINE::Client::Module::LineModuleApi* | [**detach_module**](docs/LineModuleApi.md#detach_module) | **POST** /v2/bot/channel/detach | +*LINE::Client::Module::LineModuleApi* | [**get_modules**](docs/LineModuleApi.md#get_modules) | **GET** /v2/bot/list | +*LINE::Client::Module::LineModuleApi* | [**release_chat_control**](docs/LineModuleApi.md#release_chat_control) | **POST** /v2/bot/chat/{chatId}/control/release | + + +## Documentation for Models + + - [LINE::Client::Module::AcquireChatControlRequest](docs/AcquireChatControlRequest.md) + - [LINE::Client::Module::DetachModuleRequest](docs/DetachModuleRequest.md) + - [LINE::Client::Module::GetModulesResponse](docs/GetModulesResponse.md) + - [LINE::Client::Module::ModuleBot](docs/ModuleBot.md) + + +## Documentation for Authorization + + +Authentication schemes defined for the API: +### Bearer + +- **Type**: Bearer authentication + diff --git a/lib/clients/module/docs/AcquireChatControlRequest.md b/lib/clients/module/docs/AcquireChatControlRequest.md new file mode 100644 index 00000000..b2755077 --- /dev/null +++ b/lib/clients/module/docs/AcquireChatControlRequest.md @@ -0,0 +1,20 @@ +# LINE::Client::Module::AcquireChatControlRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **expired** | **Boolean** | `True`: After the time limit (ttl) has passed, the initiative (Chat Control) will return to the Primary Channel. (Default) `False`: There's no time limit and the initiative (Chat Control) doesn't change over time. | [optional] | +| **ttl** | **Integer** | The time it takes for initiative (Chat Control) to return to the Primary Channel (the time that the module channel stays on the Active Channel). The value is specified in seconds. The maximum value is one year (3600 * 24 * 365). The default value is 3600 (1 hour). * Ignored if the value of expired is false. | [optional] | + +## Example + +```ruby +require 'line_client_module' + +instance = LINE::Client::Module::AcquireChatControlRequest.new( + expired: true, + ttl: 3600 +) +``` + diff --git a/lib/clients/module/docs/DetachModuleRequest.md b/lib/clients/module/docs/DetachModuleRequest.md new file mode 100644 index 00000000..ed855078 --- /dev/null +++ b/lib/clients/module/docs/DetachModuleRequest.md @@ -0,0 +1,18 @@ +# LINE::Client::Module::DetachModuleRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **bot_id** | **String** | User ID of the LINE Official Account bot attached to the module channel. | [optional] | + +## Example + +```ruby +require 'line_client_module' + +instance = LINE::Client::Module::DetachModuleRequest.new( + bot_id: null +) +``` + diff --git a/lib/clients/module/docs/GetModulesResponse.md b/lib/clients/module/docs/GetModulesResponse.md new file mode 100644 index 00000000..99eca0b9 --- /dev/null +++ b/lib/clients/module/docs/GetModulesResponse.md @@ -0,0 +1,20 @@ +# LINE::Client::Module::GetModulesResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **bots** | [**Array<ModuleBot>**](ModuleBot.md) | Array of Bot list Item objects representing basic information about the bot. | | +| **_next** | **String** | Continuation token. Used to get the next array of basic bot information. This property is only returned if there are more unreturned results. | [optional] | + +## Example + +```ruby +require 'line_client_module' + +instance = LINE::Client::Module::GetModulesResponse.new( + bots: null, + _next: null +) +``` + diff --git a/lib/clients/module/docs/LineModuleApi.md b/lib/clients/module/docs/LineModuleApi.md new file mode 100644 index 00000000..daa402bb --- /dev/null +++ b/lib/clients/module/docs/LineModuleApi.md @@ -0,0 +1,294 @@ +# LINE::Client::Module::LineModuleApi + +All URIs are relative to *https://api.line.me* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**acquire_chat_control**](LineModuleApi.md#acquire_chat_control) | **POST** /v2/bot/chat/{chatId}/control/acquire | | +| [**detach_module**](LineModuleApi.md#detach_module) | **POST** /v2/bot/channel/detach | | +| [**get_modules**](LineModuleApi.md#get_modules) | **GET** /v2/bot/list | | +| [**release_chat_control**](LineModuleApi.md#release_chat_control) | **POST** /v2/bot/chat/{chatId}/control/release | | + + +## acquire_chat_control + +> acquire_chat_control(chat_id, opts) + + + +If the Standby Channel wants to take the initiative (Chat Control), it calls the Acquire Control API. The channel that was previously an Active Channel will automatically switch to a Standby Channel. + +### Examples + +```ruby +require 'time' +require 'line_client_module' +# setup authorization +LINE::Client::Module.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::Module::LineModuleApi.new +chat_id = 'chat_id_example' # String | The `userId`, `roomId`, or `groupId` +opts = { + acquire_chat_control_request: LINE::Client::Module::AcquireChatControlRequest.new # AcquireChatControlRequest | +} + +begin + + api_instance.acquire_chat_control(chat_id, opts) +rescue LINE::Client::Module::ApiError => e + puts "Error when calling LineModuleApi->acquire_chat_control: #{e}" +end +``` + +#### Using the acquire_chat_control_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> acquire_chat_control_with_http_info(chat_id, opts) + +```ruby +begin + + data, status_code, headers = api_instance.acquire_chat_control_with_http_info(chat_id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::Module::ApiError => e + puts "Error when calling LineModuleApi->acquire_chat_control_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **chat_id** | **String** | The `userId`, `roomId`, or `groupId` | | +| **acquire_chat_control_request** | [**AcquireChatControlRequest**](AcquireChatControlRequest.md) | | [optional] | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## detach_module + +> detach_module(opts) + + + +The module channel admin calls the Detach API to detach the module channel from a LINE Official Account. + +### Examples + +```ruby +require 'time' +require 'line_client_module' +# setup authorization +LINE::Client::Module.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::Module::LineModuleApi.new +opts = { + detach_module_request: LINE::Client::Module::DetachModuleRequest.new # DetachModuleRequest | +} + +begin + + api_instance.detach_module(opts) +rescue LINE::Client::Module::ApiError => e + puts "Error when calling LineModuleApi->detach_module: #{e}" +end +``` + +#### Using the detach_module_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> detach_module_with_http_info(opts) + +```ruby +begin + + data, status_code, headers = api_instance.detach_module_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::Module::ApiError => e + puts "Error when calling LineModuleApi->detach_module_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **detach_module_request** | [**DetachModuleRequest**](DetachModuleRequest.md) | | [optional] | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + + +## get_modules + +> get_modules(opts) + + + +Gets a list of basic information about the bots of multiple LINE Official Accounts that have attached module channels. + +### Examples + +```ruby +require 'time' +require 'line_client_module' +# setup authorization +LINE::Client::Module.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::Module::LineModuleApi.new +opts = { + start: 'start_example', # String | Value of the continuation token found in the next property of the JSON object returned in the response. If you can't get all basic information about the bots in one request, include this parameter to get the remaining array. + limit: 56 # Integer | Specify the maximum number of bots that you get basic information from. The default value is 100. Max value: 100 +} + +begin + + result = api_instance.get_modules(opts) + p result +rescue LINE::Client::Module::ApiError => e + puts "Error when calling LineModuleApi->get_modules: #{e}" +end +``` + +#### Using the get_modules_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_modules_with_http_info(opts) + +```ruby +begin + + data, status_code, headers = api_instance.get_modules_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue LINE::Client::Module::ApiError => e + puts "Error when calling LineModuleApi->get_modules_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **start** | **String** | Value of the continuation token found in the next property of the JSON object returned in the response. If you can't get all basic information about the bots in one request, include this parameter to get the remaining array. | [optional] | +| **limit** | **Integer** | Specify the maximum number of bots that you get basic information from. The default value is 100. Max value: 100 | [optional][default to 100] | + +### Return type + +[**GetModulesResponse**](GetModulesResponse.md) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## release_chat_control + +> release_chat_control(chat_id) + + + +To return the initiative (Chat Control) of Active Channel to Primary Channel, call the Release Control API. + +### Examples + +```ruby +require 'time' +require 'line_client_module' +# setup authorization +LINE::Client::Module.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::Module::LineModuleApi.new +chat_id = 'chat_id_example' # String | The `userId`, `roomId`, or `groupId` + +begin + + api_instance.release_chat_control(chat_id) +rescue LINE::Client::Module::ApiError => e + puts "Error when calling LineModuleApi->release_chat_control: #{e}" +end +``` + +#### Using the release_chat_control_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> release_chat_control_with_http_info(chat_id) + +```ruby +begin + + data, status_code, headers = api_instance.release_chat_control_with_http_info(chat_id) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::Module::ApiError => e + puts "Error when calling LineModuleApi->release_chat_control_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **chat_id** | **String** | The `userId`, `roomId`, or `groupId` | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + diff --git a/lib/clients/module/docs/ModuleBot.md b/lib/clients/module/docs/ModuleBot.md new file mode 100644 index 00000000..50be7fe5 --- /dev/null +++ b/lib/clients/module/docs/ModuleBot.md @@ -0,0 +1,26 @@ +# LINE::Client::Module::ModuleBot + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **user_id** | **String** | Bot's user ID | | +| **basic_id** | **String** | Bot's basic ID | | +| **premium_id** | **String** | Bot's premium ID. Not included in the response if the premium ID isn't set. | [optional] | +| **display_name** | **String** | Bot's display name | | +| **picture_url** | **String** | Profile image URL. Image URL starting with `https://`. Not included in the response if the bot doesn't have a profile image. | [optional] | + +## Example + +```ruby +require 'line_client_module' + +instance = LINE::Client::Module::ModuleBot.new( + user_id: null, + basic_id: null, + premium_id: null, + display_name: null, + picture_url: null +) +``` + diff --git a/lib/clients/module/lib/line_client_module.rb b/lib/clients/module/lib/line_client_module.rb new file mode 100644 index 00000000..a73b348a --- /dev/null +++ b/lib/clients/module/lib/line_client_module.rb @@ -0,0 +1,44 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +# Common files +require 'line_client_module/api_client' +require 'line_client_module/api_error' +require 'line_client_module/version' +require 'line_client_module/configuration' + +# Models +require 'line_client_module/models/acquire_chat_control_request' +require 'line_client_module/models/detach_module_request' +require 'line_client_module/models/get_modules_response' +require 'line_client_module/models/module_bot' + +# APIs +require 'line_client_module/api/line_module_api' + +module LINE::Client::Module + class << self + # Customize default settings for the SDK using block. + # LINE::Client::Module.configure do |config| + # config.username = "xxx" + # config.password = "xxx" + # end + # If no block given, return the default Configuration object. + def configure + if block_given? + yield(Configuration.default) + else + Configuration.default + end + end + end +end diff --git a/lib/clients/module/lib/line_client_module/api/line_module_api.rb b/lib/clients/module/lib/line_client_module/api/line_module_api.rb new file mode 100644 index 00000000..a5357d5f --- /dev/null +++ b/lib/clients/module/lib/line_client_module/api/line_module_api.rb @@ -0,0 +1,272 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'cgi' + +module LINE::Client::Module + class LineModuleApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # If the Standby Channel wants to take the initiative (Chat Control), it calls the Acquire Control API. The channel that was previously an Active Channel will automatically switch to a Standby Channel. + # @param chat_id [String] The `userId`, `roomId`, or `groupId` + # @param [Hash] opts the optional parameters + # @option opts [AcquireChatControlRequest] :acquire_chat_control_request + # @return [nil] + def acquire_chat_control(chat_id, opts = {}) + acquire_chat_control_with_http_info(chat_id, opts) + nil + end + + # If the Standby Channel wants to take the initiative (Chat Control), it calls the Acquire Control API. The channel that was previously an Active Channel will automatically switch to a Standby Channel. + # @param chat_id [String] The `userId`, `roomId`, or `groupId` + # @param [Hash] opts the optional parameters + # @option opts [AcquireChatControlRequest] :acquire_chat_control_request + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def acquire_chat_control_with_http_info(chat_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LineModuleApi.acquire_chat_control ...' + end + # verify the required parameter 'chat_id' is set + if @api_client.config.client_side_validation && chat_id.nil? + fail ArgumentError, "Missing the required parameter 'chat_id' when calling LineModuleApi.acquire_chat_control" + end + # resource path + local_var_path = '/v2/bot/chat/{chatId}/control/acquire'.sub('{' + 'chatId' + '}', CGI.escape(chat_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'acquire_chat_control_request']) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"LineModuleApi.acquire_chat_control", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LineModuleApi#acquire_chat_control\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # The module channel admin calls the Detach API to detach the module channel from a LINE Official Account. + # @param [Hash] opts the optional parameters + # @option opts [DetachModuleRequest] :detach_module_request + # @return [nil] + def detach_module(opts = {}) + detach_module_with_http_info(opts) + nil + end + + # The module channel admin calls the Detach API to detach the module channel from a LINE Official Account. + # @param [Hash] opts the optional parameters + # @option opts [DetachModuleRequest] :detach_module_request + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def detach_module_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LineModuleApi.detach_module ...' + end + # resource path + local_var_path = '/v2/bot/channel/detach' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'detach_module_request']) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"LineModuleApi.detach_module", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LineModuleApi#detach_module\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Gets a list of basic information about the bots of multiple LINE Official Accounts that have attached module channels. + # @param [Hash] opts the optional parameters + # @option opts [String] :start Value of the continuation token found in the next property of the JSON object returned in the response. If you can't get all basic information about the bots in one request, include this parameter to get the remaining array. + # @option opts [Integer] :limit Specify the maximum number of bots that you get basic information from. The default value is 100. Max value: 100 (default to 100) + # @return [GetModulesResponse] + def get_modules(opts = {}) + data, _status_code, _headers = get_modules_with_http_info(opts) + data + end + + # Gets a list of basic information about the bots of multiple LINE Official Accounts that have attached module channels. + # @param [Hash] opts the optional parameters + # @option opts [String] :start Value of the continuation token found in the next property of the JSON object returned in the response. If you can't get all basic information about the bots in one request, include this parameter to get the remaining array. + # @option opts [Integer] :limit Specify the maximum number of bots that you get basic information from. The default value is 100. Max value: 100 (default to 100) + # @return [Array<(GetModulesResponse, Integer, Hash)>] GetModulesResponse data, response status code and response headers + def get_modules_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LineModuleApi.get_modules ...' + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling LineModuleApi.get_modules, must be smaller than or equal to 100.' + end + + # resource path + local_var_path = '/v2/bot/list' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil? + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetModulesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"LineModuleApi.get_modules", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LineModuleApi#get_modules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # To return the initiative (Chat Control) of Active Channel to Primary Channel, call the Release Control API. + # @param chat_id [String] The `userId`, `roomId`, or `groupId` + # @param [Hash] opts the optional parameters + # @return [nil] + def release_chat_control(chat_id, opts = {}) + release_chat_control_with_http_info(chat_id, opts) + nil + end + + # To return the initiative (Chat Control) of Active Channel to Primary Channel, call the Release Control API. + # @param chat_id [String] The `userId`, `roomId`, or `groupId` + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def release_chat_control_with_http_info(chat_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: LineModuleApi.release_chat_control ...' + end + # verify the required parameter 'chat_id' is set + if @api_client.config.client_side_validation && chat_id.nil? + fail ArgumentError, "Missing the required parameter 'chat_id' when calling LineModuleApi.release_chat_control" + end + # resource path + local_var_path = '/v2/bot/chat/{chatId}/control/release'.sub('{' + 'chatId' + '}', CGI.escape(chat_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"LineModuleApi.release_chat_control", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: LineModuleApi#release_chat_control\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/clients/module/lib/line_client_module/api_client.rb b/lib/clients/module/lib/line_client_module/api_client.rb new file mode 100644 index 00000000..b3f13381 --- /dev/null +++ b/lib/clients/module/lib/line_client_module/api_client.rb @@ -0,0 +1,392 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'json' +require 'logger' +require 'tempfile' +require 'time' +require 'typhoeus' + +module LINE::Client::Module + class ApiClient + # The Configuration object holding settings to be used in the API client. + attr_accessor :config + + # Defines the headers to be used in HTTP requests of all API calls by default. + # + # @return [Hash] + attr_accessor :default_headers + + # Initializes the ApiClient + # @option config [Configuration] Configuration for initializing the object, default to Configuration.default + def initialize(config = Configuration.default) + @config = config + @user_agent = "LINE-BotSDK-Ruby/2.0.0" + @default_headers = { + 'Content-Type' => 'application/json', + 'User-Agent' => @user_agent + } + end + + def self.default + @@default ||= ApiClient.new + end + + # Call an API with given options. + # + # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: + # the data deserialized from response body (could be nil), response status code and response headers. + def call_api(http_method, path, opts = {}) + request = build_request(http_method, path, opts) + response = request.run + + if @config.debugging + @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" + end + + unless response.success? + if response.timed_out? + fail ApiError.new('Connection timed out') + elsif response.code == 0 + # Errors from libcurl will be made visible here + fail ApiError.new(:code => 0, + :message => response.return_message) + else + fail ApiError.new(:code => response.code, + :response_headers => response.headers, + :response_body => response.body), + response.status_message + end + end + + if opts[:return_type] + data = deserialize(response, opts[:return_type]) + else + data = nil + end + return data, response.code, response.headers + end + + # Builds the HTTP request + # + # @param [String] http_method HTTP method/verb (e.g. POST) + # @param [String] path URL path (e.g. /account/new) + # @option opts [Hash] :header_params Header parameters + # @option opts [Hash] :query_params Query parameters + # @option opts [Hash] :form_params Query parameters + # @option opts [Object] :body HTTP body (JSON/XML) + # @return [Typhoeus::Request] A Typhoeus Request + def build_request(http_method, path, opts = {}) + url = build_request_url(path, opts) + http_method = http_method.to_sym.downcase + + header_params = @default_headers.merge(opts[:header_params] || {}) + query_params = opts[:query_params] || {} + form_params = opts[:form_params] || {} + follow_location = opts[:follow_location] || true + + update_params_for_auth! header_params, query_params, opts[:auth_names] + + # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false) + _verify_ssl_host = @config.verify_ssl_host ? 2 : 0 + + req_opts = { + :method => http_method, + :headers => header_params, + :params => query_params, + :params_encoding => @config.params_encoding, + :timeout => @config.timeout, + :ssl_verifypeer => @config.verify_ssl, + :ssl_verifyhost => _verify_ssl_host, + :sslcert => @config.cert_file, + :sslkey => @config.key_file, + :verbose => @config.debugging, + :followlocation => follow_location + } + + # set custom cert, if provided + req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert + + if [:post, :patch, :put, :delete].include?(http_method) + req_body = build_request_body(header_params, form_params, opts[:body]) + req_opts.update :body => req_body + if @config.debugging + @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n" + end + end + + request = Typhoeus::Request.new(url, req_opts) + download_file(request) if opts[:return_type] == 'File' + request + end + + # Builds the HTTP request body + # + # @param [Hash] header_params Header parameters + # @param [Hash] form_params Query parameters + # @param [Object] body HTTP body (JSON/XML) + # @return [String] HTTP body data in the form of string + def build_request_body(header_params, form_params, body) + # http form + if header_params['Content-Type'] == 'application/x-www-form-urlencoded' || + header_params['Content-Type'] == 'multipart/form-data' + data = {} + form_params.each do |key, value| + case value + when ::File, ::Array, nil + # let typhoeus handle File, Array and nil parameters + data[key] = value + else + data[key] = value.to_s + end + end + elsif body + data = body.is_a?(String) ? body : body.to_json + else + data = nil + end + data + end + + # Save response body into a file in (the defined) temporary folder, using the filename + # from the "Content-Disposition" header if provided, otherwise a random filename. + # The response body is written to the file in chunks in order to handle files which + # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby + # process can use. + # + # @see Configuration#temp_folder_path + def download_file(request) + tempfile = nil + encoding = nil + request.on_headers do |response| + content_disposition = response.headers['Content-Disposition'] + if content_disposition && content_disposition =~ /filename=/i + filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1] + prefix = sanitize_filename(filename) + else + prefix = 'download-' + end + prefix = prefix + '-' unless prefix.end_with?('-') + encoding = response.body.encoding + tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) + @tempfile = tempfile + end + request.on_body do |chunk| + chunk.force_encoding(encoding) + tempfile.write(chunk) + end + request.on_complete do |response| + if tempfile + tempfile.close + @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ + "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ + "will be deleted automatically with GC. It's also recommended to delete the temp file "\ + "explicitly with `tempfile.delete`" + end + end + end + + # Check if the given MIME is a JSON MIME. + # JSON MIME examples: + # application/json + # application/json; charset=UTF8 + # APPLICATION/JSON + # */* + # @param [String] mime MIME + # @return [Boolean] True if the MIME is application/json + def json_mime?(mime) + (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + end + + # Deserialize the response to the given return type. + # + # @param [Response] response HTTP response + # @param [String] return_type some examples: "User", "Array", "Hash" + def deserialize(response, return_type) + body = response.body + + # handle file downloading - return the File instance processed in request callbacks + # note that response body is empty when the file is written in chunks in request on_body callback + return @tempfile if return_type == 'File' + + return nil if body.nil? || body.empty? + + # return response body directly for String return type + return body if return_type == 'String' + + # ensuring a default content type + content_type = response.headers['Content-Type'] || 'application/json' + + fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type) + + begin + data = JSON.parse("[#{body}]", :symbolize_names => true)[0] + rescue JSON::ParserError => e + if %w(String Date Time).include?(return_type) + data = body + else + raise e + end + end + + convert_to_type data, return_type + end + + # Convert data to the given return type. + # @param [Object] data Data to be converted + # @param [String] return_type Return type + # @return [Mixed] Data in a particular type + def convert_to_type(data, return_type) + return nil if data.nil? + case return_type + when 'String' + data.to_s + when 'Integer' + data.to_i + when 'Float' + data.to_f + when 'Boolean' + data == true + when 'Time' + # parse date time (expecting ISO 8601 format) + Time.parse data + when 'Date' + # parse date time (expecting ISO 8601 format) + Date.parse data + when 'Object' + # generic object (usually a Hash), return directly + data + when /\AArray<(.+)>\z/ + # e.g. Array + sub_type = $1 + data.map { |item| convert_to_type(item, sub_type) } + when /\AHash\\z/ + # e.g. Hash + sub_type = $1 + {}.tap do |hash| + data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } + end + else + # models (e.g. Pet) or oneOf + klass = LINE::Client::Module.const_get(return_type) + klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + end + end + + # Sanitize filename by removing path. + # e.g. ../../sun.gif becomes sun.gif + # + # @param [String] filename the filename to be sanitized + # @return [String] the sanitized filename + def sanitize_filename(filename) + filename.gsub(/.*[\/\\]/, '') + end + + def build_request_url(path, opts = {}) + # Add leading and trailing slashes to path + path = "/#{path}".gsub(/\/+/, '/') + @config.base_url(opts[:operation]) + path + end + + # Update header and query params based on authentication settings. + # + # @param [Hash] header_params Header parameters + # @param [Hash] query_params Query parameters + # @param [String] auth_names Authentication scheme name + def update_params_for_auth!(header_params, query_params, auth_names) + Array(auth_names).each do |auth_name| + auth_setting = @config.auth_settings[auth_name] + next unless auth_setting + case auth_setting[:in] + when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] + when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] + else fail ArgumentError, 'Authentication token must be in `query` or `header`' + end + end + end + + # Sets user agent in HTTP header + # + # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0) + def user_agent=(user_agent) + @user_agent = user_agent + @default_headers['User-Agent'] = @user_agent + end + + # Return Accept header based on an array of accepts provided. + # @param [Array] accepts array for Accept + # @return [String] the Accept header (e.g. application/json) + def select_header_accept(accepts) + return nil if accepts.nil? || accepts.empty? + # use JSON when present, otherwise use all of the provided + json_accept = accepts.find { |s| json_mime?(s) } + json_accept || accepts.join(',') + end + + # Return Content-Type header based on an array of content types provided. + # @param [Array] content_types array for Content-Type + # @return [String] the Content-Type header (e.g. application/json) + def select_header_content_type(content_types) + # return nil by default + return if content_types.nil? || content_types.empty? + # use JSON when present, otherwise use the first one + json_content_type = content_types.find { |s| json_mime?(s) } + json_content_type || content_types.first + end + + # Convert object (array, hash, object, etc) to JSON string. + # @param [Object] model object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_http_body(model) + return model if model.nil? || model.is_a?(String) + local_body = nil + if model.is_a?(Array) + local_body = model.map { |m| object_to_hash(m) } + else + local_body = object_to_hash(model) + end + local_body.to_json + end + + # Convert object(non-array) to hash. + # @param [Object] obj object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_hash(obj) + if obj.respond_to?(:to_hash) + obj.to_hash + else + obj + end + end + + # Build parameter value according to the given collection format. + # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi + def build_collection_param(param, collection_format) + case collection_format + when :csv + param.join(',') + when :ssv + param.join(' ') + when :tsv + param.join("\t") + when :pipes + param.join('|') + when :multi + # return the array directly as typhoeus will handle it as expected + param + else + fail "unknown collection format: #{collection_format.inspect}" + end + end + end +end diff --git a/lib/clients/module/lib/line_client_module/api_error.rb b/lib/clients/module/lib/line_client_module/api_error.rb new file mode 100644 index 00000000..d9800353 --- /dev/null +++ b/lib/clients/module/lib/line_client_module/api_error.rb @@ -0,0 +1,58 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::Module + class ApiError < StandardError + attr_reader :code, :response_headers, :response_body + + # Usage examples: + # ApiError.new + # ApiError.new("message") + # ApiError.new(:code => 500, :response_headers => {}, :response_body => "") + # ApiError.new(:code => 404, :message => "Not Found") + def initialize(arg = nil) + if arg.is_a? Hash + if arg.key?(:message) || arg.key?('message') + super(arg[:message] || arg['message']) + else + super arg + end + + arg.each do |k, v| + instance_variable_set "@#{k}", v + end + else + super arg + @message = arg + end + end + + # Override to_s to display a friendly error message + def to_s + message + end + + def message + if @message.nil? + msg = "Error message: the server returns an error" + else + msg = @message + end + + msg += "\nHTTP status code: #{code}" if code + msg += "\nResponse headers: #{response_headers}" if response_headers + msg += "\nResponse body: #{response_body}" if response_body + + msg + end + end +end diff --git a/lib/clients/module/lib/line_client_module/configuration.rb b/lib/clients/module/lib/line_client_module/configuration.rb new file mode 100644 index 00000000..b85e96d6 --- /dev/null +++ b/lib/clients/module/lib/line_client_module/configuration.rb @@ -0,0 +1,297 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::Module + class Configuration + # Defines url scheme + attr_accessor :scheme + + # Defines url host + attr_accessor :host + + # Defines url base path + attr_accessor :base_path + + # Define server configuration index + attr_accessor :server_index + + # Define server operation configuration index + attr_accessor :server_operation_index + + # Default server variables + attr_accessor :server_variables + + # Default server operation variables + attr_accessor :server_operation_variables + + # Defines API keys used with API Key authentications. + # + # @return [Hash] key: parameter name, value: parameter value (API key) + # + # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string) + # config.api_key['api_key'] = 'xxx' + attr_accessor :api_key + + # Defines API key prefixes used with API Key authentications. + # + # @return [Hash] key: parameter name, value: API key prefix + # + # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers) + # config.api_key_prefix['api_key'] = 'Token' + attr_accessor :api_key_prefix + + # Defines the username used with HTTP basic authentication. + # + # @return [String] + attr_accessor :username + + # Defines the password used with HTTP basic authentication. + # + # @return [String] + attr_accessor :password + + # Defines the access token (Bearer) used with OAuth2. + attr_accessor :access_token + + # Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2. + # Overrides the access_token if set + # @return [Proc] + attr_accessor :access_token_getter + + # Set this to return data as binary instead of downloading a temp file. When enabled (set to true) + # HTTP responses with return type `File` will be returned as a stream of binary data. + # Default to false. + attr_accessor :return_binary_data + + # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response + # details will be logged with `logger.debug` (see the `logger` attribute). + # Default to false. + # + # @return [true, false] + attr_accessor :debugging + + # Defines the logger used for debugging. + # Default to `Rails.logger` (when in Rails) or logging to STDOUT. + # + # @return [#debug] + attr_accessor :logger + + # Defines the temporary folder to store downloaded files + # (for API endpoints that have file response). + # Default to use `Tempfile`. + # + # @return [String] + attr_accessor :temp_folder_path + + # The time limit for HTTP request in seconds. + # Default to 0 (never times out). + attr_accessor :timeout + + # Set this to false to skip client side validation in the operation. + # Default to true. + # @return [true, false] + attr_accessor :client_side_validation + + ### TLS/SSL setting + # Set this to false to skip verifying SSL certificate when calling API from https server. + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl + + ### TLS/SSL setting + # Set this to false to skip verifying SSL host name + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl_host + + ### TLS/SSL setting + # Set this to customize the certificate file to verify the peer. + # + # @return [String] the path to the certificate file + # + # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code: + # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145 + attr_accessor :ssl_ca_cert + + ### TLS/SSL setting + # Client certificate file (for client certificate) + attr_accessor :cert_file + + ### TLS/SSL setting + # Client private key file (for client certificate) + attr_accessor :key_file + + # Set this to customize parameters encoding of array parameter with multi collectionFormat. + # Default to nil. + # + # @see The params_encoding option of Ethon. Related source code: + # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 + attr_accessor :params_encoding + + + attr_accessor :inject_format + + attr_accessor :force_ending_format + + def initialize + @scheme = 'https' + @host = 'api.line.me' + @base_path = '' + @server_index = nil + @server_operation_index = {} + @server_variables = {} + @server_operation_variables = {} + @api_key = {} + @api_key_prefix = {} + @client_side_validation = true + @verify_ssl = true + @verify_ssl_host = true + @cert_file = nil + @key_file = nil + @timeout = 0 + @params_encoding = nil + @debugging = false + @inject_format = false + @force_ending_format = false + @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) + + yield(self) if block_given? + end + + # The default Configuration object. + def self.default + @@default ||= Configuration.new + end + + def configure + yield(self) if block_given? + end + + def scheme=(scheme) + # remove :// from scheme + @scheme = scheme.sub(/:\/\//, '') + end + + def host=(host) + # remove http(s):// and anything after a slash + @host = host.sub(/https?:\/\//, '').split('/').first + end + + def base_path=(base_path) + # Add leading and trailing slashes to base_path + @base_path = "/#{base_path}".gsub(/\/+/, '/') + @base_path = '' if @base_path == '/' + end + + # Returns base URL for specified operation based on server settings + def base_url(operation = nil) + if operation_server_settings.key?(operation) then + index = server_operation_index.fetch(operation, server_index) + server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) + else + server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil) + end + end + + # Gets API key (with prefix if set). + # @param [String] param_name the parameter name of API key auth + def api_key_with_prefix(param_name, param_alias = nil) + key = @api_key[param_name] + key = @api_key.fetch(param_alias, key) unless param_alias.nil? + if @api_key_prefix[param_name] + "#{@api_key_prefix[param_name]} #{key}" + else + key + end + end + + # Gets access_token using access_token_getter or uses the static access_token + def access_token_with_refresh + return access_token if access_token_getter.nil? + access_token_getter.call + end + + # Gets Basic Auth token string + def basic_auth_token + 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") + end + + # Returns Auth Settings hash for api client. + def auth_settings + { + 'Bearer' => + { + type: 'bearer', + in: 'header', + key: 'Authorization', + value: "Bearer #{access_token_with_refresh}" + }, + } + end + + # Returns an array of Server setting + def server_settings + [ + { + url: "https://api.line.me", + description: "No description provided", + } + ] + end + + def operation_server_settings + { + } + end + + # Returns URL based on server settings + # + # @param index array index of the server settings + # @param variables hash of variable and the corresponding value + def server_url(index, variables = {}, servers = nil) + servers = server_settings if servers == nil + + # check array index out of bound + if (index.nil? || index < 0 || index >= servers.size) + fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}" + end + + server = servers[index] + url = server[:url] + + return url unless server.key? :variables + + # go through variable and assign a value + server[:variables].each do |name, variable| + if variables.key?(name) + if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name])) + url.gsub! "{" + name.to_s + "}", variables[name] + else + fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}." + end + else + # use default value + url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] + end + end + + url + end + + end +end diff --git a/lib/clients/module/lib/line_client_module/models/acquire_chat_control_request.rb b/lib/clients/module/lib/line_client_module/models/acquire_chat_control_request.rb new file mode 100644 index 00000000..01b7e110 --- /dev/null +++ b/lib/clients/module/lib/line_client_module/models/acquire_chat_control_request.rb @@ -0,0 +1,250 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Module + # Request entity of the Acquire Control API + class AcquireChatControlRequest + # `True`: After the time limit (ttl) has passed, the initiative (Chat Control) will return to the Primary Channel. (Default) `False`: There's no time limit and the initiative (Chat Control) doesn't change over time. + attr_accessor :expired + + # The time it takes for initiative (Chat Control) to return to the Primary Channel (the time that the module channel stays on the Active Channel). The value is specified in seconds. The maximum value is one year (3600 * 24 * 365). The default value is 3600 (1 hour). * Ignored if the value of expired is false. + attr_accessor :ttl + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'expired' => :'expired', + :'ttl' => :'ttl' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'expired' => :'Boolean', + :'ttl' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Module::AcquireChatControlRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Module::AcquireChatControlRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'expired') + self.expired = attributes[:'expired'] + end + + if attributes.key?(:'ttl') + self.ttl = attributes[:'ttl'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@ttl.nil? && @ttl > 31536000 + invalid_properties.push('invalid value for "ttl", must be smaller than or equal to 31536000.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@ttl.nil? && @ttl > 31536000 + true + end + + # Custom attribute writer method with validation + # @param [Object] ttl Value to be assigned + def ttl=(ttl) + if ttl.nil? + fail ArgumentError, 'ttl cannot be nil' + end + + if ttl > 31536000 + fail ArgumentError, 'invalid value for "ttl", must be smaller than or equal to 31536000.' + end + + @ttl = ttl + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + expired == o.expired && + ttl == o.ttl + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [expired, ttl].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Module.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/module/lib/line_client_module/models/detach_module_request.rb b/lib/clients/module/lib/line_client_module/models/detach_module_request.rb new file mode 100644 index 00000000..c0c2da82 --- /dev/null +++ b/lib/clients/module/lib/line_client_module/models/detach_module_request.rb @@ -0,0 +1,221 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Module + # Unlink (detach) the module channel by the operation of the module channel administrator + class DetachModuleRequest + # User ID of the LINE Official Account bot attached to the module channel. + attr_accessor :bot_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'bot_id' => :'botId' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'bot_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Module::DetachModuleRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Module::DetachModuleRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'bot_id') + self.bot_id = attributes[:'bot_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + bot_id == o.bot_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [bot_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Module.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/module/lib/line_client_module/models/get_modules_response.rb b/lib/clients/module/lib/line_client_module/models/get_modules_response.rb new file mode 100644 index 00000000..ac5701a2 --- /dev/null +++ b/lib/clients/module/lib/line_client_module/models/get_modules_response.rb @@ -0,0 +1,240 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Module + # List of bots to which the module is attached + class GetModulesResponse + # Array of Bot list Item objects representing basic information about the bot. + attr_accessor :bots + + # Continuation token. Used to get the next array of basic bot information. This property is only returned if there are more unreturned results. + attr_accessor :_next + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'bots' => :'bots', + :'_next' => :'next' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'bots' => :'Array', + :'_next' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Module::GetModulesResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Module::GetModulesResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'bots') + if (value = attributes[:'bots']).is_a?(Array) + self.bots = value + end + else + self.bots = nil + end + + if attributes.key?(:'_next') + self._next = attributes[:'_next'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @bots.nil? + invalid_properties.push('invalid value for "bots", bots cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @bots.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + bots == o.bots && + _next == o._next + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [bots, _next].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Module.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/module/lib/line_client_module/models/module_bot.rb b/lib/clients/module/lib/line_client_module/models/module_bot.rb new file mode 100644 index 00000000..c215b798 --- /dev/null +++ b/lib/clients/module/lib/line_client_module/models/module_bot.rb @@ -0,0 +1,282 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Module + # basic information about the bot. + class ModuleBot + # Bot's user ID + attr_accessor :user_id + + # Bot's basic ID + attr_accessor :basic_id + + # Bot's premium ID. Not included in the response if the premium ID isn't set. + attr_accessor :premium_id + + # Bot's display name + attr_accessor :display_name + + # Profile image URL. Image URL starting with `https://`. Not included in the response if the bot doesn't have a profile image. + attr_accessor :picture_url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'user_id' => :'userId', + :'basic_id' => :'basicId', + :'premium_id' => :'premiumId', + :'display_name' => :'displayName', + :'picture_url' => :'pictureUrl' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'user_id' => :'String', + :'basic_id' => :'String', + :'premium_id' => :'String', + :'display_name' => :'String', + :'picture_url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Module::ModuleBot` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Module::ModuleBot`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'user_id') + self.user_id = attributes[:'user_id'] + else + self.user_id = nil + end + + if attributes.key?(:'basic_id') + self.basic_id = attributes[:'basic_id'] + else + self.basic_id = nil + end + + if attributes.key?(:'premium_id') + self.premium_id = attributes[:'premium_id'] + end + + if attributes.key?(:'display_name') + self.display_name = attributes[:'display_name'] + else + self.display_name = nil + end + + if attributes.key?(:'picture_url') + self.picture_url = attributes[:'picture_url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @user_id.nil? + invalid_properties.push('invalid value for "user_id", user_id cannot be nil.') + end + + if @basic_id.nil? + invalid_properties.push('invalid value for "basic_id", basic_id cannot be nil.') + end + + if @display_name.nil? + invalid_properties.push('invalid value for "display_name", display_name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @user_id.nil? + return false if @basic_id.nil? + return false if @display_name.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + user_id == o.user_id && + basic_id == o.basic_id && + premium_id == o.premium_id && + display_name == o.display_name && + picture_url == o.picture_url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [user_id, basic_id, premium_id, display_name, picture_url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Module.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/module/lib/line_client_module/version.rb b/lib/clients/module/lib/line_client_module/version.rb new file mode 100644 index 00000000..08e22d5e --- /dev/null +++ b/lib/clients/module/lib/line_client_module/version.rb @@ -0,0 +1,15 @@ +=begin +#LINE Messaging API + +#This document describes LINE Messaging API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::Module + VERSION = '2.0.0' +end diff --git a/lib/clients/shop/.gitignore b/lib/clients/shop/.gitignore new file mode 100644 index 00000000..05a17cb8 --- /dev/null +++ b/lib/clients/shop/.gitignore @@ -0,0 +1,39 @@ +# Generated by: https://openapi-generator.tech +# + +*.gem +*.rbc +/.config +/coverage/ +/InstalledFiles +/pkg/ +/spec/reports/ +/spec/examples.txt +/test/tmp/ +/test/version_tmp/ +/tmp/ + +## Specific to RubyMotion: +.dat* +.repl_history +build/ + +## Documentation cache and generated files: +/.yardoc/ +/_yardoc/ +/doc/ +/rdoc/ + +## Environment normalization: +/.bundle/ +/vendor/bundle +/lib/bundler/man/ + +# for a library or gem, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# Gemfile.lock +# .ruby-version +# .ruby-gemset + +# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: +.rvmrc diff --git a/lib/clients/shop/.openapi-generator/FILES b/lib/clients/shop/.openapi-generator/FILES new file mode 100644 index 00000000..9a043287 --- /dev/null +++ b/lib/clients/shop/.openapi-generator/FILES @@ -0,0 +1,24 @@ +.gitignore +.gitlab-ci.yml +.rspec +.rubocop.yml +.travis.yml +Gemfile +README.md +Rakefile +docs/ErrorResponse.md +docs/MissionStickerRequest.md +docs/ShopApi.md +git_push.sh +lib/line_client_shop.rb +lib/line_client_shop/api/shop_api.rb +lib/line_client_shop/api_client.rb +lib/line_client_shop/api_error.rb +lib/line_client_shop/configuration.rb +lib/line_client_shop/models/error_response.rb +lib/line_client_shop/models/mission_sticker_request.rb +lib/line_client_shop/version.rb +line_client_shop.gemspec +spec/api_client_spec.rb +spec/configuration_spec.rb +spec/spec_helper.rb diff --git a/lib/clients/shop/.openapi-generator/VERSION b/lib/clients/shop/.openapi-generator/VERSION new file mode 100644 index 00000000..41225218 --- /dev/null +++ b/lib/clients/shop/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.0.0 \ No newline at end of file diff --git a/lib/clients/shop/README.md b/lib/clients/shop/README.md new file mode 100644 index 00000000..d7d686cd --- /dev/null +++ b/lib/clients/shop/README.md @@ -0,0 +1,98 @@ +# LINE::Client::Shop + +This document describes LINE Mission Stickers API. + +This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 0.0.1 +- Package version: 2.0.0 +- Build package: org.openapitools.codegen.languages.RubyClientCodegen + +## Installation + +### Build a gem + +To build the Ruby code into a gem: + +```shell +gem build line-bot-api.gemspec +``` + +Then either install the gem locally: + +```shell +gem install ./line-bot-api-2.0.0.gem +``` + +(for development, run `gem install --dev ./line-bot-api-2.0.0.gem` to install the development dependencies) + +or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/). + +Finally add this to the Gemfile: + + gem 'line-bot-api', '~> 2.0.0' + +### Install from Git + +If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile: + + gem 'line-bot-api', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git' + +### Include the Ruby code directly + +Include the Ruby code directly using `-I` as follows: + +```shell +ruby -Ilib script.rb +``` + +## Getting Started + +Please follow the [installation](#installation) procedure and then run the following code: + +```ruby +# Load the gem +require 'line-bot-api' + +# Setup authorization +LINE::Client::Shop.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' + # Configure a proc to get access tokens in lieu of the static access_token configuration + config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' } +end + +api_instance = LINE::Client::Shop::ShopApi.new +mission_sticker_request = LINE::Client::Shop::MissionStickerRequest.new({to: 'to_example', product_id: 'product_id_example', product_type: 'STICKER', send_present_message: false}) # MissionStickerRequest | + +begin + api_instance.mission_sticker_v3(mission_sticker_request) +rescue LINE::Client::Shop::ApiError => e + puts "Exception when calling ShopApi->mission_sticker_v3: #{e}" +end + +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://api.line.me* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*LINE::Client::Shop::ShopApi* | [**mission_sticker_v3**](docs/ShopApi.md#mission_sticker_v3) | **POST** /shop/v3/mission | + + +## Documentation for Models + + - [LINE::Client::Shop::ErrorResponse](docs/ErrorResponse.md) + - [LINE::Client::Shop::MissionStickerRequest](docs/MissionStickerRequest.md) + + +## Documentation for Authorization + + +Authentication schemes defined for the API: +### Bearer + +- **Type**: Bearer authentication + diff --git a/lib/clients/shop/docs/ErrorResponse.md b/lib/clients/shop/docs/ErrorResponse.md new file mode 100644 index 00000000..2ef41ca7 --- /dev/null +++ b/lib/clients/shop/docs/ErrorResponse.md @@ -0,0 +1,18 @@ +# LINE::Client::Shop::ErrorResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **message** | **String** | Message containing information about the error. | | + +## Example + +```ruby +require 'line_client_shop' + +instance = LINE::Client::Shop::ErrorResponse.new( + message: null +) +``` + diff --git a/lib/clients/shop/docs/MissionStickerRequest.md b/lib/clients/shop/docs/MissionStickerRequest.md new file mode 100644 index 00000000..21691ac0 --- /dev/null +++ b/lib/clients/shop/docs/MissionStickerRequest.md @@ -0,0 +1,24 @@ +# LINE::Client::Shop::MissionStickerRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **to** | **String** | Destination user ID | | +| **product_id** | **String** | Package ID for a set of stickers | | +| **product_type** | **String** | `STICKER` | | +| **send_present_message** | **Boolean** | `false` | | + +## Example + +```ruby +require 'line_client_shop' + +instance = LINE::Client::Shop::MissionStickerRequest.new( + to: null, + product_id: null, + product_type: STICKER, + send_present_message: false +) +``` + diff --git a/lib/clients/shop/docs/ShopApi.md b/lib/clients/shop/docs/ShopApi.md new file mode 100644 index 00000000..041bdef5 --- /dev/null +++ b/lib/clients/shop/docs/ShopApi.md @@ -0,0 +1,76 @@ +# LINE::Client::Shop::ShopApi + +All URIs are relative to *https://api.line.me* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**mission_sticker_v3**](ShopApi.md#mission_sticker_v3) | **POST** /shop/v3/mission | | + + +## mission_sticker_v3 + +> mission_sticker_v3(mission_sticker_request) + + + +Sends a mission sticker. + +### Examples + +```ruby +require 'time' +require 'line_client_shop' +# setup authorization +LINE::Client::Shop.configure do |config| + # Configure Bearer authorization: Bearer + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = LINE::Client::Shop::ShopApi.new +mission_sticker_request = LINE::Client::Shop::MissionStickerRequest.new({to: 'to_example', product_id: 'product_id_example', product_type: 'STICKER', send_present_message: false}) # MissionStickerRequest | + +begin + + api_instance.mission_sticker_v3(mission_sticker_request) +rescue LINE::Client::Shop::ApiError => e + puts "Error when calling ShopApi->mission_sticker_v3: #{e}" +end +``` + +#### Using the mission_sticker_v3_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> mission_sticker_v3_with_http_info(mission_sticker_request) + +```ruby +begin + + data, status_code, headers = api_instance.mission_sticker_v3_with_http_info(mission_sticker_request) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue LINE::Client::Shop::ApiError => e + puts "Error when calling ShopApi->mission_sticker_v3_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **mission_sticker_request** | [**MissionStickerRequest**](MissionStickerRequest.md) | | | + +### Return type + +nil (empty response body) + +### Authorization + +[Bearer](../README.md#Bearer) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + diff --git a/lib/clients/shop/lib/line_client_shop.rb b/lib/clients/shop/lib/line_client_shop.rb new file mode 100644 index 00000000..cdbbd19f --- /dev/null +++ b/lib/clients/shop/lib/line_client_shop.rb @@ -0,0 +1,42 @@ +=begin +#Mission Stickers API + +#This document describes LINE Mission Stickers API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +# Common files +require 'line_client_shop/api_client' +require 'line_client_shop/api_error' +require 'line_client_shop/version' +require 'line_client_shop/configuration' + +# Models +require 'line_client_shop/models/error_response' +require 'line_client_shop/models/mission_sticker_request' + +# APIs +require 'line_client_shop/api/shop_api' + +module LINE::Client::Shop + class << self + # Customize default settings for the SDK using block. + # LINE::Client::Shop.configure do |config| + # config.username = "xxx" + # config.password = "xxx" + # end + # If no block given, return the default Configuration object. + def configure + if block_given? + yield(Configuration.default) + else + Configuration.default + end + end + end +end diff --git a/lib/clients/shop/lib/line_client_shop/api/shop_api.rb b/lib/clients/shop/lib/line_client_shop/api/shop_api.rb new file mode 100644 index 00000000..b0afdb39 --- /dev/null +++ b/lib/clients/shop/lib/line_client_shop/api/shop_api.rb @@ -0,0 +1,86 @@ +=begin +#Mission Stickers API + +#This document describes LINE Mission Stickers API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'cgi' + +module LINE::Client::Shop + class ShopApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Sends a mission sticker. + # @param mission_sticker_request [MissionStickerRequest] + # @param [Hash] opts the optional parameters + # @return [nil] + def mission_sticker_v3(mission_sticker_request, opts = {}) + mission_sticker_v3_with_http_info(mission_sticker_request, opts) + nil + end + + # Sends a mission sticker. + # @param mission_sticker_request [MissionStickerRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def mission_sticker_v3_with_http_info(mission_sticker_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ShopApi.mission_sticker_v3 ...' + end + # verify the required parameter 'mission_sticker_request' is set + if @api_client.config.client_side_validation && mission_sticker_request.nil? + fail ArgumentError, "Missing the required parameter 'mission_sticker_request' when calling ShopApi.mission_sticker_v3" + end + # resource path + local_var_path = '/shop/v3/mission' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(mission_sticker_request) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['Bearer'] + + new_options = opts.merge( + :operation => :"ShopApi.mission_sticker_v3", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ShopApi#mission_sticker_v3\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/clients/shop/lib/line_client_shop/api_client.rb b/lib/clients/shop/lib/line_client_shop/api_client.rb new file mode 100644 index 00000000..a9c964c5 --- /dev/null +++ b/lib/clients/shop/lib/line_client_shop/api_client.rb @@ -0,0 +1,392 @@ +=begin +#Mission Stickers API + +#This document describes LINE Mission Stickers API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'json' +require 'logger' +require 'tempfile' +require 'time' +require 'typhoeus' + +module LINE::Client::Shop + class ApiClient + # The Configuration object holding settings to be used in the API client. + attr_accessor :config + + # Defines the headers to be used in HTTP requests of all API calls by default. + # + # @return [Hash] + attr_accessor :default_headers + + # Initializes the ApiClient + # @option config [Configuration] Configuration for initializing the object, default to Configuration.default + def initialize(config = Configuration.default) + @config = config + @user_agent = "LINE-BotSDK-Ruby/2.0.0" + @default_headers = { + 'Content-Type' => 'application/json', + 'User-Agent' => @user_agent + } + end + + def self.default + @@default ||= ApiClient.new + end + + # Call an API with given options. + # + # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: + # the data deserialized from response body (could be nil), response status code and response headers. + def call_api(http_method, path, opts = {}) + request = build_request(http_method, path, opts) + response = request.run + + if @config.debugging + @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" + end + + unless response.success? + if response.timed_out? + fail ApiError.new('Connection timed out') + elsif response.code == 0 + # Errors from libcurl will be made visible here + fail ApiError.new(:code => 0, + :message => response.return_message) + else + fail ApiError.new(:code => response.code, + :response_headers => response.headers, + :response_body => response.body), + response.status_message + end + end + + if opts[:return_type] + data = deserialize(response, opts[:return_type]) + else + data = nil + end + return data, response.code, response.headers + end + + # Builds the HTTP request + # + # @param [String] http_method HTTP method/verb (e.g. POST) + # @param [String] path URL path (e.g. /account/new) + # @option opts [Hash] :header_params Header parameters + # @option opts [Hash] :query_params Query parameters + # @option opts [Hash] :form_params Query parameters + # @option opts [Object] :body HTTP body (JSON/XML) + # @return [Typhoeus::Request] A Typhoeus Request + def build_request(http_method, path, opts = {}) + url = build_request_url(path, opts) + http_method = http_method.to_sym.downcase + + header_params = @default_headers.merge(opts[:header_params] || {}) + query_params = opts[:query_params] || {} + form_params = opts[:form_params] || {} + follow_location = opts[:follow_location] || true + + update_params_for_auth! header_params, query_params, opts[:auth_names] + + # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false) + _verify_ssl_host = @config.verify_ssl_host ? 2 : 0 + + req_opts = { + :method => http_method, + :headers => header_params, + :params => query_params, + :params_encoding => @config.params_encoding, + :timeout => @config.timeout, + :ssl_verifypeer => @config.verify_ssl, + :ssl_verifyhost => _verify_ssl_host, + :sslcert => @config.cert_file, + :sslkey => @config.key_file, + :verbose => @config.debugging, + :followlocation => follow_location + } + + # set custom cert, if provided + req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert + + if [:post, :patch, :put, :delete].include?(http_method) + req_body = build_request_body(header_params, form_params, opts[:body]) + req_opts.update :body => req_body + if @config.debugging + @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n" + end + end + + request = Typhoeus::Request.new(url, req_opts) + download_file(request) if opts[:return_type] == 'File' + request + end + + # Builds the HTTP request body + # + # @param [Hash] header_params Header parameters + # @param [Hash] form_params Query parameters + # @param [Object] body HTTP body (JSON/XML) + # @return [String] HTTP body data in the form of string + def build_request_body(header_params, form_params, body) + # http form + if header_params['Content-Type'] == 'application/x-www-form-urlencoded' || + header_params['Content-Type'] == 'multipart/form-data' + data = {} + form_params.each do |key, value| + case value + when ::File, ::Array, nil + # let typhoeus handle File, Array and nil parameters + data[key] = value + else + data[key] = value.to_s + end + end + elsif body + data = body.is_a?(String) ? body : body.to_json + else + data = nil + end + data + end + + # Save response body into a file in (the defined) temporary folder, using the filename + # from the "Content-Disposition" header if provided, otherwise a random filename. + # The response body is written to the file in chunks in order to handle files which + # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby + # process can use. + # + # @see Configuration#temp_folder_path + def download_file(request) + tempfile = nil + encoding = nil + request.on_headers do |response| + content_disposition = response.headers['Content-Disposition'] + if content_disposition && content_disposition =~ /filename=/i + filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1] + prefix = sanitize_filename(filename) + else + prefix = 'download-' + end + prefix = prefix + '-' unless prefix.end_with?('-') + encoding = response.body.encoding + tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) + @tempfile = tempfile + end + request.on_body do |chunk| + chunk.force_encoding(encoding) + tempfile.write(chunk) + end + request.on_complete do |response| + if tempfile + tempfile.close + @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ + "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ + "will be deleted automatically with GC. It's also recommended to delete the temp file "\ + "explicitly with `tempfile.delete`" + end + end + end + + # Check if the given MIME is a JSON MIME. + # JSON MIME examples: + # application/json + # application/json; charset=UTF8 + # APPLICATION/JSON + # */* + # @param [String] mime MIME + # @return [Boolean] True if the MIME is application/json + def json_mime?(mime) + (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + end + + # Deserialize the response to the given return type. + # + # @param [Response] response HTTP response + # @param [String] return_type some examples: "User", "Array", "Hash" + def deserialize(response, return_type) + body = response.body + + # handle file downloading - return the File instance processed in request callbacks + # note that response body is empty when the file is written in chunks in request on_body callback + return @tempfile if return_type == 'File' + + return nil if body.nil? || body.empty? + + # return response body directly for String return type + return body if return_type == 'String' + + # ensuring a default content type + content_type = response.headers['Content-Type'] || 'application/json' + + fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type) + + begin + data = JSON.parse("[#{body}]", :symbolize_names => true)[0] + rescue JSON::ParserError => e + if %w(String Date Time).include?(return_type) + data = body + else + raise e + end + end + + convert_to_type data, return_type + end + + # Convert data to the given return type. + # @param [Object] data Data to be converted + # @param [String] return_type Return type + # @return [Mixed] Data in a particular type + def convert_to_type(data, return_type) + return nil if data.nil? + case return_type + when 'String' + data.to_s + when 'Integer' + data.to_i + when 'Float' + data.to_f + when 'Boolean' + data == true + when 'Time' + # parse date time (expecting ISO 8601 format) + Time.parse data + when 'Date' + # parse date time (expecting ISO 8601 format) + Date.parse data + when 'Object' + # generic object (usually a Hash), return directly + data + when /\AArray<(.+)>\z/ + # e.g. Array + sub_type = $1 + data.map { |item| convert_to_type(item, sub_type) } + when /\AHash\\z/ + # e.g. Hash + sub_type = $1 + {}.tap do |hash| + data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } + end + else + # models (e.g. Pet) or oneOf + klass = LINE::Client::Shop.const_get(return_type) + klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + end + end + + # Sanitize filename by removing path. + # e.g. ../../sun.gif becomes sun.gif + # + # @param [String] filename the filename to be sanitized + # @return [String] the sanitized filename + def sanitize_filename(filename) + filename.gsub(/.*[\/\\]/, '') + end + + def build_request_url(path, opts = {}) + # Add leading and trailing slashes to path + path = "/#{path}".gsub(/\/+/, '/') + @config.base_url(opts[:operation]) + path + end + + # Update header and query params based on authentication settings. + # + # @param [Hash] header_params Header parameters + # @param [Hash] query_params Query parameters + # @param [String] auth_names Authentication scheme name + def update_params_for_auth!(header_params, query_params, auth_names) + Array(auth_names).each do |auth_name| + auth_setting = @config.auth_settings[auth_name] + next unless auth_setting + case auth_setting[:in] + when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] + when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] + else fail ArgumentError, 'Authentication token must be in `query` or `header`' + end + end + end + + # Sets user agent in HTTP header + # + # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0) + def user_agent=(user_agent) + @user_agent = user_agent + @default_headers['User-Agent'] = @user_agent + end + + # Return Accept header based on an array of accepts provided. + # @param [Array] accepts array for Accept + # @return [String] the Accept header (e.g. application/json) + def select_header_accept(accepts) + return nil if accepts.nil? || accepts.empty? + # use JSON when present, otherwise use all of the provided + json_accept = accepts.find { |s| json_mime?(s) } + json_accept || accepts.join(',') + end + + # Return Content-Type header based on an array of content types provided. + # @param [Array] content_types array for Content-Type + # @return [String] the Content-Type header (e.g. application/json) + def select_header_content_type(content_types) + # return nil by default + return if content_types.nil? || content_types.empty? + # use JSON when present, otherwise use the first one + json_content_type = content_types.find { |s| json_mime?(s) } + json_content_type || content_types.first + end + + # Convert object (array, hash, object, etc) to JSON string. + # @param [Object] model object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_http_body(model) + return model if model.nil? || model.is_a?(String) + local_body = nil + if model.is_a?(Array) + local_body = model.map { |m| object_to_hash(m) } + else + local_body = object_to_hash(model) + end + local_body.to_json + end + + # Convert object(non-array) to hash. + # @param [Object] obj object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_hash(obj) + if obj.respond_to?(:to_hash) + obj.to_hash + else + obj + end + end + + # Build parameter value according to the given collection format. + # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi + def build_collection_param(param, collection_format) + case collection_format + when :csv + param.join(',') + when :ssv + param.join(' ') + when :tsv + param.join("\t") + when :pipes + param.join('|') + when :multi + # return the array directly as typhoeus will handle it as expected + param + else + fail "unknown collection format: #{collection_format.inspect}" + end + end + end +end diff --git a/lib/clients/shop/lib/line_client_shop/api_error.rb b/lib/clients/shop/lib/line_client_shop/api_error.rb new file mode 100644 index 00000000..5e7b19ec --- /dev/null +++ b/lib/clients/shop/lib/line_client_shop/api_error.rb @@ -0,0 +1,58 @@ +=begin +#Mission Stickers API + +#This document describes LINE Mission Stickers API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::Shop + class ApiError < StandardError + attr_reader :code, :response_headers, :response_body + + # Usage examples: + # ApiError.new + # ApiError.new("message") + # ApiError.new(:code => 500, :response_headers => {}, :response_body => "") + # ApiError.new(:code => 404, :message => "Not Found") + def initialize(arg = nil) + if arg.is_a? Hash + if arg.key?(:message) || arg.key?('message') + super(arg[:message] || arg['message']) + else + super arg + end + + arg.each do |k, v| + instance_variable_set "@#{k}", v + end + else + super arg + @message = arg + end + end + + # Override to_s to display a friendly error message + def to_s + message + end + + def message + if @message.nil? + msg = "Error message: the server returns an error" + else + msg = @message + end + + msg += "\nHTTP status code: #{code}" if code + msg += "\nResponse headers: #{response_headers}" if response_headers + msg += "\nResponse body: #{response_body}" if response_body + + msg + end + end +end diff --git a/lib/clients/shop/lib/line_client_shop/configuration.rb b/lib/clients/shop/lib/line_client_shop/configuration.rb new file mode 100644 index 00000000..1e204fc7 --- /dev/null +++ b/lib/clients/shop/lib/line_client_shop/configuration.rb @@ -0,0 +1,297 @@ +=begin +#Mission Stickers API + +#This document describes LINE Mission Stickers API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::Shop + class Configuration + # Defines url scheme + attr_accessor :scheme + + # Defines url host + attr_accessor :host + + # Defines url base path + attr_accessor :base_path + + # Define server configuration index + attr_accessor :server_index + + # Define server operation configuration index + attr_accessor :server_operation_index + + # Default server variables + attr_accessor :server_variables + + # Default server operation variables + attr_accessor :server_operation_variables + + # Defines API keys used with API Key authentications. + # + # @return [Hash] key: parameter name, value: parameter value (API key) + # + # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string) + # config.api_key['api_key'] = 'xxx' + attr_accessor :api_key + + # Defines API key prefixes used with API Key authentications. + # + # @return [Hash] key: parameter name, value: API key prefix + # + # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers) + # config.api_key_prefix['api_key'] = 'Token' + attr_accessor :api_key_prefix + + # Defines the username used with HTTP basic authentication. + # + # @return [String] + attr_accessor :username + + # Defines the password used with HTTP basic authentication. + # + # @return [String] + attr_accessor :password + + # Defines the access token (Bearer) used with OAuth2. + attr_accessor :access_token + + # Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2. + # Overrides the access_token if set + # @return [Proc] + attr_accessor :access_token_getter + + # Set this to return data as binary instead of downloading a temp file. When enabled (set to true) + # HTTP responses with return type `File` will be returned as a stream of binary data. + # Default to false. + attr_accessor :return_binary_data + + # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response + # details will be logged with `logger.debug` (see the `logger` attribute). + # Default to false. + # + # @return [true, false] + attr_accessor :debugging + + # Defines the logger used for debugging. + # Default to `Rails.logger` (when in Rails) or logging to STDOUT. + # + # @return [#debug] + attr_accessor :logger + + # Defines the temporary folder to store downloaded files + # (for API endpoints that have file response). + # Default to use `Tempfile`. + # + # @return [String] + attr_accessor :temp_folder_path + + # The time limit for HTTP request in seconds. + # Default to 0 (never times out). + attr_accessor :timeout + + # Set this to false to skip client side validation in the operation. + # Default to true. + # @return [true, false] + attr_accessor :client_side_validation + + ### TLS/SSL setting + # Set this to false to skip verifying SSL certificate when calling API from https server. + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl + + ### TLS/SSL setting + # Set this to false to skip verifying SSL host name + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl_host + + ### TLS/SSL setting + # Set this to customize the certificate file to verify the peer. + # + # @return [String] the path to the certificate file + # + # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code: + # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145 + attr_accessor :ssl_ca_cert + + ### TLS/SSL setting + # Client certificate file (for client certificate) + attr_accessor :cert_file + + ### TLS/SSL setting + # Client private key file (for client certificate) + attr_accessor :key_file + + # Set this to customize parameters encoding of array parameter with multi collectionFormat. + # Default to nil. + # + # @see The params_encoding option of Ethon. Related source code: + # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 + attr_accessor :params_encoding + + + attr_accessor :inject_format + + attr_accessor :force_ending_format + + def initialize + @scheme = 'https' + @host = 'api.line.me' + @base_path = '' + @server_index = nil + @server_operation_index = {} + @server_variables = {} + @server_operation_variables = {} + @api_key = {} + @api_key_prefix = {} + @client_side_validation = true + @verify_ssl = true + @verify_ssl_host = true + @cert_file = nil + @key_file = nil + @timeout = 0 + @params_encoding = nil + @debugging = false + @inject_format = false + @force_ending_format = false + @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) + + yield(self) if block_given? + end + + # The default Configuration object. + def self.default + @@default ||= Configuration.new + end + + def configure + yield(self) if block_given? + end + + def scheme=(scheme) + # remove :// from scheme + @scheme = scheme.sub(/:\/\//, '') + end + + def host=(host) + # remove http(s):// and anything after a slash + @host = host.sub(/https?:\/\//, '').split('/').first + end + + def base_path=(base_path) + # Add leading and trailing slashes to base_path + @base_path = "/#{base_path}".gsub(/\/+/, '/') + @base_path = '' if @base_path == '/' + end + + # Returns base URL for specified operation based on server settings + def base_url(operation = nil) + if operation_server_settings.key?(operation) then + index = server_operation_index.fetch(operation, server_index) + server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) + else + server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil) + end + end + + # Gets API key (with prefix if set). + # @param [String] param_name the parameter name of API key auth + def api_key_with_prefix(param_name, param_alias = nil) + key = @api_key[param_name] + key = @api_key.fetch(param_alias, key) unless param_alias.nil? + if @api_key_prefix[param_name] + "#{@api_key_prefix[param_name]} #{key}" + else + key + end + end + + # Gets access_token using access_token_getter or uses the static access_token + def access_token_with_refresh + return access_token if access_token_getter.nil? + access_token_getter.call + end + + # Gets Basic Auth token string + def basic_auth_token + 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") + end + + # Returns Auth Settings hash for api client. + def auth_settings + { + 'Bearer' => + { + type: 'bearer', + in: 'header', + key: 'Authorization', + value: "Bearer #{access_token_with_refresh}" + }, + } + end + + # Returns an array of Server setting + def server_settings + [ + { + url: "https://api.line.me", + description: "No description provided", + } + ] + end + + def operation_server_settings + { + } + end + + # Returns URL based on server settings + # + # @param index array index of the server settings + # @param variables hash of variable and the corresponding value + def server_url(index, variables = {}, servers = nil) + servers = server_settings if servers == nil + + # check array index out of bound + if (index.nil? || index < 0 || index >= servers.size) + fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}" + end + + server = servers[index] + url = server[:url] + + return url unless server.key? :variables + + # go through variable and assign a value + server[:variables].each do |name, variable| + if variables.key?(name) + if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name])) + url.gsub! "{" + name.to_s + "}", variables[name] + else + fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}." + end + else + # use default value + url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] + end + end + + url + end + + end +end diff --git a/lib/clients/shop/lib/line_client_shop/models/error_response.rb b/lib/clients/shop/lib/line_client_shop/models/error_response.rb new file mode 100644 index 00000000..0b09b61a --- /dev/null +++ b/lib/clients/shop/lib/line_client_shop/models/error_response.rb @@ -0,0 +1,227 @@ +=begin +#Mission Stickers API + +#This document describes LINE Mission Stickers API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Shop + class ErrorResponse + # Message containing information about the error. + attr_accessor :message + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'message' => :'message' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'message' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Shop::ErrorResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Shop::ErrorResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'message') + self.message = attributes[:'message'] + else + self.message = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @message.nil? + invalid_properties.push('invalid value for "message", message cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @message.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + message == o.message + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [message].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Shop.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/shop/lib/line_client_shop/models/mission_sticker_request.rb b/lib/clients/shop/lib/line_client_shop/models/mission_sticker_request.rb new file mode 100644 index 00000000..ad31ad25 --- /dev/null +++ b/lib/clients/shop/lib/line_client_shop/models/mission_sticker_request.rb @@ -0,0 +1,279 @@ +=begin +#Mission Stickers API + +#This document describes LINE Mission Stickers API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Shop + # Send mission stickers (v3) + class MissionStickerRequest + # Destination user ID + attr_accessor :to + + # Package ID for a set of stickers + attr_accessor :product_id + + # `STICKER` + attr_accessor :product_type + + # `false` + attr_accessor :send_present_message + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'to' => :'to', + :'product_id' => :'productId', + :'product_type' => :'productType', + :'send_present_message' => :'sendPresentMessage' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'to' => :'String', + :'product_id' => :'String', + :'product_type' => :'String', + :'send_present_message' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Shop::MissionStickerRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Shop::MissionStickerRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'to') + self.to = attributes[:'to'] + else + self.to = nil + end + + if attributes.key?(:'product_id') + self.product_id = attributes[:'product_id'] + else + self.product_id = nil + end + + if attributes.key?(:'product_type') + self.product_type = attributes[:'product_type'] + else + self.product_type = nil + end + + if attributes.key?(:'send_present_message') + self.send_present_message = attributes[:'send_present_message'] + else + self.send_present_message = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @to.nil? + invalid_properties.push('invalid value for "to", to cannot be nil.') + end + + if @product_id.nil? + invalid_properties.push('invalid value for "product_id", product_id cannot be nil.') + end + + if @product_type.nil? + invalid_properties.push('invalid value for "product_type", product_type cannot be nil.') + end + + if @send_present_message.nil? + invalid_properties.push('invalid value for "send_present_message", send_present_message cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @to.nil? + return false if @product_id.nil? + return false if @product_type.nil? + return false if @send_present_message.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + to == o.to && + product_id == o.product_id && + product_type == o.product_type && + send_present_message == o.send_present_message + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [to, product_id, product_type, send_present_message].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Shop.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/shop/lib/line_client_shop/version.rb b/lib/clients/shop/lib/line_client_shop/version.rb new file mode 100644 index 00000000..187289cf --- /dev/null +++ b/lib/clients/shop/lib/line_client_shop/version.rb @@ -0,0 +1,15 @@ +=begin +#Mission Stickers API + +#This document describes LINE Mission Stickers API. + +The version of the OpenAPI document: 0.0.1 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::Shop + VERSION = '2.0.0' +end diff --git a/lib/clients/webhook/.gitignore b/lib/clients/webhook/.gitignore new file mode 100644 index 00000000..05a17cb8 --- /dev/null +++ b/lib/clients/webhook/.gitignore @@ -0,0 +1,39 @@ +# Generated by: https://openapi-generator.tech +# + +*.gem +*.rbc +/.config +/coverage/ +/InstalledFiles +/pkg/ +/spec/reports/ +/spec/examples.txt +/test/tmp/ +/test/version_tmp/ +/tmp/ + +## Specific to RubyMotion: +.dat* +.repl_history +build/ + +## Documentation cache and generated files: +/.yardoc/ +/_yardoc/ +/doc/ +/rdoc/ + +## Environment normalization: +/.bundle/ +/vendor/bundle +/lib/bundler/man/ + +# for a library or gem, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# Gemfile.lock +# .ruby-version +# .ruby-gemset + +# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: +.rvmrc diff --git a/lib/clients/webhook/.openapi-generator/FILES b/lib/clients/webhook/.openapi-generator/FILES new file mode 100644 index 00000000..b2097c26 --- /dev/null +++ b/lib/clients/webhook/.openapi-generator/FILES @@ -0,0 +1,136 @@ +.gitignore +.gitlab-ci.yml +.rspec +.rubocop.yml +.travis.yml +Gemfile +README.md +Rakefile +docs/AccountLinkEvent.md +docs/ActionResult.md +docs/ActivatedEvent.md +docs/AllMentionee.md +docs/AttachedModuleContent.md +docs/AudioMessageContent.md +docs/BeaconContent.md +docs/BeaconEvent.md +docs/BotResumedEvent.md +docs/BotSuspendedEvent.md +docs/CallbackRequest.md +docs/ChatControl.md +docs/ContentProvider.md +docs/DeactivatedEvent.md +docs/DeliveryContext.md +docs/DetachedModuleContent.md +docs/DummyApi.md +docs/Emoji.md +docs/Event.md +docs/EventMode.md +docs/FileMessageContent.md +docs/FollowEvent.md +docs/GroupSource.md +docs/ImageMessageContent.md +docs/ImageSet.md +docs/JoinEvent.md +docs/JoinedMembers.md +docs/LeaveEvent.md +docs/LeftMembers.md +docs/LinkContent.md +docs/LinkThingsContent.md +docs/LocationMessageContent.md +docs/MemberJoinedEvent.md +docs/MemberLeftEvent.md +docs/Mention.md +docs/Mentionee.md +docs/MessageContent.md +docs/MessageEvent.md +docs/ModuleContent.md +docs/ModuleEvent.md +docs/PostbackContent.md +docs/PostbackEvent.md +docs/RoomSource.md +docs/ScenarioResult.md +docs/ScenarioResultThingsContent.md +docs/Source.md +docs/StickerMessageContent.md +docs/TextMessageContent.md +docs/ThingsContent.md +docs/ThingsEvent.md +docs/UnfollowEvent.md +docs/UnlinkThingsContent.md +docs/UnsendDetail.md +docs/UnsendEvent.md +docs/UserMentionee.md +docs/UserSource.md +docs/VideoMessageContent.md +docs/VideoPlayComplete.md +docs/VideoPlayCompleteEvent.md +git_push.sh +lib/line_client_webhook.rb +lib/line_client_webhook/api/dummy_api.rb +lib/line_client_webhook/api_client.rb +lib/line_client_webhook/api_error.rb +lib/line_client_webhook/configuration.rb +lib/line_client_webhook/models/account_link_event.rb +lib/line_client_webhook/models/action_result.rb +lib/line_client_webhook/models/activated_event.rb +lib/line_client_webhook/models/all_mentionee.rb +lib/line_client_webhook/models/attached_module_content.rb +lib/line_client_webhook/models/audio_message_content.rb +lib/line_client_webhook/models/beacon_content.rb +lib/line_client_webhook/models/beacon_event.rb +lib/line_client_webhook/models/bot_resumed_event.rb +lib/line_client_webhook/models/bot_suspended_event.rb +lib/line_client_webhook/models/callback_request.rb +lib/line_client_webhook/models/chat_control.rb +lib/line_client_webhook/models/content_provider.rb +lib/line_client_webhook/models/deactivated_event.rb +lib/line_client_webhook/models/delivery_context.rb +lib/line_client_webhook/models/detached_module_content.rb +lib/line_client_webhook/models/emoji.rb +lib/line_client_webhook/models/event.rb +lib/line_client_webhook/models/event_mode.rb +lib/line_client_webhook/models/file_message_content.rb +lib/line_client_webhook/models/follow_event.rb +lib/line_client_webhook/models/group_source.rb +lib/line_client_webhook/models/image_message_content.rb +lib/line_client_webhook/models/image_set.rb +lib/line_client_webhook/models/join_event.rb +lib/line_client_webhook/models/joined_members.rb +lib/line_client_webhook/models/leave_event.rb +lib/line_client_webhook/models/left_members.rb +lib/line_client_webhook/models/link_content.rb +lib/line_client_webhook/models/link_things_content.rb +lib/line_client_webhook/models/location_message_content.rb +lib/line_client_webhook/models/member_joined_event.rb +lib/line_client_webhook/models/member_left_event.rb +lib/line_client_webhook/models/mention.rb +lib/line_client_webhook/models/mentionee.rb +lib/line_client_webhook/models/message_content.rb +lib/line_client_webhook/models/message_event.rb +lib/line_client_webhook/models/module_content.rb +lib/line_client_webhook/models/module_event.rb +lib/line_client_webhook/models/postback_content.rb +lib/line_client_webhook/models/postback_event.rb +lib/line_client_webhook/models/room_source.rb +lib/line_client_webhook/models/scenario_result.rb +lib/line_client_webhook/models/scenario_result_things_content.rb +lib/line_client_webhook/models/source.rb +lib/line_client_webhook/models/sticker_message_content.rb +lib/line_client_webhook/models/text_message_content.rb +lib/line_client_webhook/models/things_content.rb +lib/line_client_webhook/models/things_event.rb +lib/line_client_webhook/models/unfollow_event.rb +lib/line_client_webhook/models/unlink_things_content.rb +lib/line_client_webhook/models/unsend_detail.rb +lib/line_client_webhook/models/unsend_event.rb +lib/line_client_webhook/models/user_mentionee.rb +lib/line_client_webhook/models/user_source.rb +lib/line_client_webhook/models/video_message_content.rb +lib/line_client_webhook/models/video_play_complete.rb +lib/line_client_webhook/models/video_play_complete_event.rb +lib/line_client_webhook/version.rb +line_client_webhook.gemspec +spec/api_client_spec.rb +spec/configuration_spec.rb +spec/spec_helper.rb diff --git a/lib/clients/webhook/.openapi-generator/VERSION b/lib/clients/webhook/.openapi-generator/VERSION new file mode 100644 index 00000000..41225218 --- /dev/null +++ b/lib/clients/webhook/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.0.0 \ No newline at end of file diff --git a/lib/clients/webhook/README.md b/lib/clients/webhook/README.md new file mode 100644 index 00000000..8dc73c86 --- /dev/null +++ b/lib/clients/webhook/README.md @@ -0,0 +1,143 @@ +# LINE::Client::Webhook + +Webhook event definition of the LINE Messaging API + +This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 1.0.0 +- Package version: 2.0.0 +- Build package: org.openapitools.codegen.languages.RubyClientCodegen + +## Installation + +### Build a gem + +To build the Ruby code into a gem: + +```shell +gem build line-bot-api.gemspec +``` + +Then either install the gem locally: + +```shell +gem install ./line-bot-api-2.0.0.gem +``` + +(for development, run `gem install --dev ./line-bot-api-2.0.0.gem` to install the development dependencies) + +or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/). + +Finally add this to the Gemfile: + + gem 'line-bot-api', '~> 2.0.0' + +### Install from Git + +If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile: + + gem 'line-bot-api', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git' + +### Include the Ruby code directly + +Include the Ruby code directly using `-I` as follows: + +```shell +ruby -Ilib script.rb +``` + +## Getting Started + +Please follow the [installation](#installation) procedure and then run the following code: + +```ruby +# Load the gem +require 'line-bot-api' + +api_instance = LINE::Client::Webhook::DummyApi.new +callback_request = LINE::Client::Webhook::CallbackRequest.new # CallbackRequest | + +begin + result = api_instance.callback(callback_request) + p result +rescue LINE::Client::Webhook::ApiError => e + puts "Exception when calling DummyApi->callback: #{e}" +end + +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://example.com* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*LINE::Client::Webhook::DummyApi* | [**callback**](docs/DummyApi.md#callback) | **POST** /callback | + + +## Documentation for Models + + - [LINE::Client::Webhook::AccountLinkEvent](docs/AccountLinkEvent.md) + - [LINE::Client::Webhook::ActionResult](docs/ActionResult.md) + - [LINE::Client::Webhook::ActivatedEvent](docs/ActivatedEvent.md) + - [LINE::Client::Webhook::AllMentionee](docs/AllMentionee.md) + - [LINE::Client::Webhook::AttachedModuleContent](docs/AttachedModuleContent.md) + - [LINE::Client::Webhook::AudioMessageContent](docs/AudioMessageContent.md) + - [LINE::Client::Webhook::BeaconContent](docs/BeaconContent.md) + - [LINE::Client::Webhook::BeaconEvent](docs/BeaconEvent.md) + - [LINE::Client::Webhook::BotResumedEvent](docs/BotResumedEvent.md) + - [LINE::Client::Webhook::BotSuspendedEvent](docs/BotSuspendedEvent.md) + - [LINE::Client::Webhook::CallbackRequest](docs/CallbackRequest.md) + - [LINE::Client::Webhook::ChatControl](docs/ChatControl.md) + - [LINE::Client::Webhook::ContentProvider](docs/ContentProvider.md) + - [LINE::Client::Webhook::DeactivatedEvent](docs/DeactivatedEvent.md) + - [LINE::Client::Webhook::DeliveryContext](docs/DeliveryContext.md) + - [LINE::Client::Webhook::DetachedModuleContent](docs/DetachedModuleContent.md) + - [LINE::Client::Webhook::Emoji](docs/Emoji.md) + - [LINE::Client::Webhook::Event](docs/Event.md) + - [LINE::Client::Webhook::EventMode](docs/EventMode.md) + - [LINE::Client::Webhook::FileMessageContent](docs/FileMessageContent.md) + - [LINE::Client::Webhook::FollowEvent](docs/FollowEvent.md) + - [LINE::Client::Webhook::GroupSource](docs/GroupSource.md) + - [LINE::Client::Webhook::ImageMessageContent](docs/ImageMessageContent.md) + - [LINE::Client::Webhook::ImageSet](docs/ImageSet.md) + - [LINE::Client::Webhook::JoinEvent](docs/JoinEvent.md) + - [LINE::Client::Webhook::JoinedMembers](docs/JoinedMembers.md) + - [LINE::Client::Webhook::LeaveEvent](docs/LeaveEvent.md) + - [LINE::Client::Webhook::LeftMembers](docs/LeftMembers.md) + - [LINE::Client::Webhook::LinkContent](docs/LinkContent.md) + - [LINE::Client::Webhook::LinkThingsContent](docs/LinkThingsContent.md) + - [LINE::Client::Webhook::LocationMessageContent](docs/LocationMessageContent.md) + - [LINE::Client::Webhook::MemberJoinedEvent](docs/MemberJoinedEvent.md) + - [LINE::Client::Webhook::MemberLeftEvent](docs/MemberLeftEvent.md) + - [LINE::Client::Webhook::Mention](docs/Mention.md) + - [LINE::Client::Webhook::Mentionee](docs/Mentionee.md) + - [LINE::Client::Webhook::MessageContent](docs/MessageContent.md) + - [LINE::Client::Webhook::MessageEvent](docs/MessageEvent.md) + - [LINE::Client::Webhook::ModuleContent](docs/ModuleContent.md) + - [LINE::Client::Webhook::ModuleEvent](docs/ModuleEvent.md) + - [LINE::Client::Webhook::PostbackContent](docs/PostbackContent.md) + - [LINE::Client::Webhook::PostbackEvent](docs/PostbackEvent.md) + - [LINE::Client::Webhook::RoomSource](docs/RoomSource.md) + - [LINE::Client::Webhook::ScenarioResult](docs/ScenarioResult.md) + - [LINE::Client::Webhook::ScenarioResultThingsContent](docs/ScenarioResultThingsContent.md) + - [LINE::Client::Webhook::Source](docs/Source.md) + - [LINE::Client::Webhook::StickerMessageContent](docs/StickerMessageContent.md) + - [LINE::Client::Webhook::TextMessageContent](docs/TextMessageContent.md) + - [LINE::Client::Webhook::ThingsContent](docs/ThingsContent.md) + - [LINE::Client::Webhook::ThingsEvent](docs/ThingsEvent.md) + - [LINE::Client::Webhook::UnfollowEvent](docs/UnfollowEvent.md) + - [LINE::Client::Webhook::UnlinkThingsContent](docs/UnlinkThingsContent.md) + - [LINE::Client::Webhook::UnsendDetail](docs/UnsendDetail.md) + - [LINE::Client::Webhook::UnsendEvent](docs/UnsendEvent.md) + - [LINE::Client::Webhook::UserMentionee](docs/UserMentionee.md) + - [LINE::Client::Webhook::UserSource](docs/UserSource.md) + - [LINE::Client::Webhook::VideoMessageContent](docs/VideoMessageContent.md) + - [LINE::Client::Webhook::VideoPlayComplete](docs/VideoPlayComplete.md) + - [LINE::Client::Webhook::VideoPlayCompleteEvent](docs/VideoPlayCompleteEvent.md) + + +## Documentation for Authorization + +Endpoints do not require authorization. + diff --git a/lib/clients/webhook/docs/AccountLinkEvent.md b/lib/clients/webhook/docs/AccountLinkEvent.md new file mode 100644 index 00000000..566e79b8 --- /dev/null +++ b/lib/clients/webhook/docs/AccountLinkEvent.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::AccountLinkEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **reply_token** | **String** | Reply token used to send reply message to this event. This property won't be included if linking the account has failed. | [optional] | +| **link** | [**LinkContent**](LinkContent.md) | | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::AccountLinkEvent.new( + reply_token: null, + link: null +) +``` + diff --git a/lib/clients/webhook/docs/AccountLinkEventAllOf.md b/lib/clients/webhook/docs/AccountLinkEventAllOf.md new file mode 100644 index 00000000..a5c3376e --- /dev/null +++ b/lib/clients/webhook/docs/AccountLinkEventAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::AccountLinkEventAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **reply_token** | **String** | Reply token used to send reply message to this event. This property won't be included if linking the account has failed. | [optional] | +| **link** | [**LinkContent**](LinkContent.md) | | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::AccountLinkEventAllOf.new( + reply_token: null, + link: null +) +``` + diff --git a/lib/clients/webhook/docs/ActionResult.md b/lib/clients/webhook/docs/ActionResult.md new file mode 100644 index 00000000..b4a0c627 --- /dev/null +++ b/lib/clients/webhook/docs/ActionResult.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::ActionResult + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | | | +| **data** | **String** | Base64-encoded binary data | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::ActionResult.new( + type: null, + data: null +) +``` + diff --git a/lib/clients/webhook/docs/ActivatedEvent.md b/lib/clients/webhook/docs/ActivatedEvent.md new file mode 100644 index 00000000..c03c2aeb --- /dev/null +++ b/lib/clients/webhook/docs/ActivatedEvent.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::ActivatedEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **chat_control** | [**ChatControl**](ChatControl.md) | | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::ActivatedEvent.new( + chat_control: null +) +``` + diff --git a/lib/clients/webhook/docs/ActivatedEventAllOf.md b/lib/clients/webhook/docs/ActivatedEventAllOf.md new file mode 100644 index 00000000..c1c119a1 --- /dev/null +++ b/lib/clients/webhook/docs/ActivatedEventAllOf.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::ActivatedEventAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **chat_control** | [**ChatControl**](ChatControl.md) | | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::ActivatedEventAllOf.new( + chat_control: null +) +``` + diff --git a/lib/clients/webhook/docs/AllMentionee.md b/lib/clients/webhook/docs/AllMentionee.md new file mode 100644 index 00000000..08860ac0 --- /dev/null +++ b/lib/clients/webhook/docs/AllMentionee.md @@ -0,0 +1,15 @@ +# LINE::Client::Webhook::AllMentionee + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::AllMentionee.new() +``` + diff --git a/lib/clients/webhook/docs/AttachedModuleContent.md b/lib/clients/webhook/docs/AttachedModuleContent.md new file mode 100644 index 00000000..515b6002 --- /dev/null +++ b/lib/clients/webhook/docs/AttachedModuleContent.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::AttachedModuleContent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **bot_id** | **String** | User ID of the bot on the attached LINE Official Account | | +| **scopes** | **Array<String>** | An array of strings indicating the scope permitted by the admin of the LINE Official Account. | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::AttachedModuleContent.new( + bot_id: null, + scopes: null +) +``` + diff --git a/lib/clients/webhook/docs/AttachedModuleContentAllOf.md b/lib/clients/webhook/docs/AttachedModuleContentAllOf.md new file mode 100644 index 00000000..b3e1c834 --- /dev/null +++ b/lib/clients/webhook/docs/AttachedModuleContentAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::AttachedModuleContentAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **bot_id** | **String** | User ID of the bot on the attached LINE Official Account | | +| **scopes** | **Array<String>** | An array of strings indicating the scope permitted by the admin of the LINE Official Account. | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::AttachedModuleContentAllOf.new( + bot_id: null, + scopes: null +) +``` + diff --git a/lib/clients/webhook/docs/AudioMessageContent.md b/lib/clients/webhook/docs/AudioMessageContent.md new file mode 100644 index 00000000..af685afc --- /dev/null +++ b/lib/clients/webhook/docs/AudioMessageContent.md @@ -0,0 +1,22 @@ +# LINE::Client::Webhook::AudioMessageContent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Message ID | | +| **content_provider** | [**ContentProvider**](ContentProvider.md) | | | +| **duration** | **Integer** | Length of audio file (milliseconds) | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::AudioMessageContent.new( + id: null, + content_provider: null, + duration: null +) +``` + diff --git a/lib/clients/webhook/docs/AudioMessageContentAllOf.md b/lib/clients/webhook/docs/AudioMessageContentAllOf.md new file mode 100644 index 00000000..a8079f33 --- /dev/null +++ b/lib/clients/webhook/docs/AudioMessageContentAllOf.md @@ -0,0 +1,22 @@ +# LINE::Client::Webhook::AudioMessageContentAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Message ID | | +| **content_provider** | [**ContentProvider**](ContentProvider.md) | | | +| **duration** | **Integer** | Length of audio file (milliseconds) | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::AudioMessageContentAllOf.new( + id: null, + content_provider: null, + duration: null +) +``` + diff --git a/lib/clients/webhook/docs/BeaconContent.md b/lib/clients/webhook/docs/BeaconContent.md new file mode 100644 index 00000000..b8347c84 --- /dev/null +++ b/lib/clients/webhook/docs/BeaconContent.md @@ -0,0 +1,22 @@ +# LINE::Client::Webhook::BeaconContent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **hwid** | **String** | Hardware ID of the beacon that was detected | | +| **type** | **String** | Type of beacon event. | | +| **dm** | **String** | Device message of beacon that was detected. | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::BeaconContent.new( + hwid: null, + type: null, + dm: null +) +``` + diff --git a/lib/clients/webhook/docs/BeaconEvent.md b/lib/clients/webhook/docs/BeaconEvent.md new file mode 100644 index 00000000..7f9e70b4 --- /dev/null +++ b/lib/clients/webhook/docs/BeaconEvent.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::BeaconEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **reply_token** | **String** | Reply token used to send reply message to this event | | +| **beacon** | [**BeaconContent**](BeaconContent.md) | | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::BeaconEvent.new( + reply_token: null, + beacon: null +) +``` + diff --git a/lib/clients/webhook/docs/BeaconEventAllOf.md b/lib/clients/webhook/docs/BeaconEventAllOf.md new file mode 100644 index 00000000..b9fd1532 --- /dev/null +++ b/lib/clients/webhook/docs/BeaconEventAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::BeaconEventAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **reply_token** | **String** | Reply token used to send reply message to this event | | +| **beacon** | [**BeaconContent**](BeaconContent.md) | | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::BeaconEventAllOf.new( + reply_token: null, + beacon: null +) +``` + diff --git a/lib/clients/webhook/docs/BotResumedEvent.md b/lib/clients/webhook/docs/BotResumedEvent.md new file mode 100644 index 00000000..2a10bdeb --- /dev/null +++ b/lib/clients/webhook/docs/BotResumedEvent.md @@ -0,0 +1,15 @@ +# LINE::Client::Webhook::BotResumedEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::BotResumedEvent.new() +``` + diff --git a/lib/clients/webhook/docs/BotSuspendedEvent.md b/lib/clients/webhook/docs/BotSuspendedEvent.md new file mode 100644 index 00000000..b617ab7d --- /dev/null +++ b/lib/clients/webhook/docs/BotSuspendedEvent.md @@ -0,0 +1,15 @@ +# LINE::Client::Webhook::BotSuspendedEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::BotSuspendedEvent.new() +``` + diff --git a/lib/clients/webhook/docs/CallbackRequest.md b/lib/clients/webhook/docs/CallbackRequest.md new file mode 100644 index 00000000..eb9af951 --- /dev/null +++ b/lib/clients/webhook/docs/CallbackRequest.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::CallbackRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **destination** | **String** | User ID of a bot that should receive webhook events. The user ID value is a string that matches the regular expression, `U[0-9a-f]{32}`. | [optional] | +| **events** | [**Array<Event>**](Event.md) | Array of webhook event objects. The LINE Platform may send an empty array that doesn't include a webhook event object to confirm communication. | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::CallbackRequest.new( + destination: null, + events: null +) +``` + diff --git a/lib/clients/webhook/docs/ChatControl.md b/lib/clients/webhook/docs/ChatControl.md new file mode 100644 index 00000000..76b1e8c8 --- /dev/null +++ b/lib/clients/webhook/docs/ChatControl.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::ChatControl + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **expire_at** | **Integer** | | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::ChatControl.new( + expire_at: null +) +``` + diff --git a/lib/clients/webhook/docs/ContentProvider.md b/lib/clients/webhook/docs/ContentProvider.md new file mode 100644 index 00000000..d6fda97f --- /dev/null +++ b/lib/clients/webhook/docs/ContentProvider.md @@ -0,0 +1,22 @@ +# LINE::Client::Webhook::ContentProvider + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | Provider of the image file. | | +| **original_content_url** | **String** | URL of the image file. Only included when contentProvider.type is external. | [optional] | +| **preview_image_url** | **String** | URL of the preview image. Only included when contentProvider.type is external. | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::ContentProvider.new( + type: null, + original_content_url: null, + preview_image_url: null +) +``` + diff --git a/lib/clients/webhook/docs/DeactivatedEvent.md b/lib/clients/webhook/docs/DeactivatedEvent.md new file mode 100644 index 00000000..cbc20559 --- /dev/null +++ b/lib/clients/webhook/docs/DeactivatedEvent.md @@ -0,0 +1,15 @@ +# LINE::Client::Webhook::DeactivatedEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::DeactivatedEvent.new() +``` + diff --git a/lib/clients/webhook/docs/DeliveryContext.md b/lib/clients/webhook/docs/DeliveryContext.md new file mode 100644 index 00000000..e26faac6 --- /dev/null +++ b/lib/clients/webhook/docs/DeliveryContext.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::DeliveryContext + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **is_redelivery** | **Boolean** | Whether the webhook event is a redelivered one or not. | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::DeliveryContext.new( + is_redelivery: null +) +``` + diff --git a/lib/clients/webhook/docs/DetachedModuleContent.md b/lib/clients/webhook/docs/DetachedModuleContent.md new file mode 100644 index 00000000..dde5524a --- /dev/null +++ b/lib/clients/webhook/docs/DetachedModuleContent.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::DetachedModuleContent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **bot_id** | **String** | Detached LINE Official Account bot user ID | | +| **reason** | **String** | Reason for detaching | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::DetachedModuleContent.new( + bot_id: null, + reason: null +) +``` + diff --git a/lib/clients/webhook/docs/DetachedModuleContentAllOf.md b/lib/clients/webhook/docs/DetachedModuleContentAllOf.md new file mode 100644 index 00000000..cca77961 --- /dev/null +++ b/lib/clients/webhook/docs/DetachedModuleContentAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::DetachedModuleContentAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **bot_id** | **String** | Detached LINE Official Account bot user ID | | +| **reason** | **String** | Reason for detaching | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::DetachedModuleContentAllOf.new( + bot_id: null, + reason: null +) +``` + diff --git a/lib/clients/webhook/docs/DummyApi.md b/lib/clients/webhook/docs/DummyApi.md new file mode 100644 index 00000000..2ad8be1a --- /dev/null +++ b/lib/clients/webhook/docs/DummyApi.md @@ -0,0 +1,72 @@ +# LINE::Client::Webhook::DummyApi + +All URIs are relative to *https://example.com* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**callback**](DummyApi.md#callback) | **POST** /callback | | + + +## callback + +> String callback(callback_request) + + + +This is the dummy endpoint to generate the model classes + +### Examples + +```ruby +require 'time' +require 'line_client_webhook' + +api_instance = LINE::Client::Webhook::DummyApi.new +callback_request = LINE::Client::Webhook::CallbackRequest.new # CallbackRequest | + +begin + + result = api_instance.callback(callback_request) + p result +rescue LINE::Client::Webhook::ApiError => e + puts "Error when calling DummyApi->callback: #{e}" +end +``` + +#### Using the callback_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> callback_with_http_info(callback_request) + +```ruby +begin + + data, status_code, headers = api_instance.callback_with_http_info(callback_request) + p status_code # => 2xx + p headers # => { ... } + p data # => String +rescue LINE::Client::Webhook::ApiError => e + puts "Error when calling DummyApi->callback_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **callback_request** | [**CallbackRequest**](CallbackRequest.md) | | | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + diff --git a/lib/clients/webhook/docs/Emoji.md b/lib/clients/webhook/docs/Emoji.md new file mode 100644 index 00000000..e4536c91 --- /dev/null +++ b/lib/clients/webhook/docs/Emoji.md @@ -0,0 +1,24 @@ +# LINE::Client::Webhook::Emoji + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **index** | **Integer** | Index position for a character in text, with the first character being at position 0. | | +| **length** | **Integer** | The length of the LINE emoji string. For LINE emoji (hello), 7 is the length. | | +| **product_id** | **String** | Product ID for a LINE emoji set. | | +| **emoji_id** | **String** | ID for a LINE emoji inside a set. | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::Emoji.new( + index: null, + length: null, + product_id: null, + emoji_id: null +) +``` + diff --git a/lib/clients/webhook/docs/Event.md b/lib/clients/webhook/docs/Event.md new file mode 100644 index 00000000..36f0d7e2 --- /dev/null +++ b/lib/clients/webhook/docs/Event.md @@ -0,0 +1,28 @@ +# LINE::Client::Webhook::Event + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | Type of the event | [optional] | +| **source** | [**Source**](Source.md) | | [optional] | +| **timestamp** | **Integer** | Time of the event in milliseconds. | | +| **mode** | [**EventMode**](EventMode.md) | | | +| **webhook_event_id** | **String** | Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format. | | +| **delivery_context** | [**DeliveryContext**](DeliveryContext.md) | | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::Event.new( + type: null, + source: null, + timestamp: null, + mode: null, + webhook_event_id: null, + delivery_context: null +) +``` + diff --git a/lib/clients/webhook/docs/EventMode.md b/lib/clients/webhook/docs/EventMode.md new file mode 100644 index 00000000..9b16898f --- /dev/null +++ b/lib/clients/webhook/docs/EventMode.md @@ -0,0 +1,15 @@ +# LINE::Client::Webhook::EventMode + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::EventMode.new() +``` + diff --git a/lib/clients/webhook/docs/FileMessageContent.md b/lib/clients/webhook/docs/FileMessageContent.md new file mode 100644 index 00000000..c9e588a4 --- /dev/null +++ b/lib/clients/webhook/docs/FileMessageContent.md @@ -0,0 +1,22 @@ +# LINE::Client::Webhook::FileMessageContent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Message ID | | +| **file_name** | **String** | File name | | +| **file_size** | **Integer** | File size in bytes | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::FileMessageContent.new( + id: null, + file_name: null, + file_size: null +) +``` + diff --git a/lib/clients/webhook/docs/FileMessageContentAllOf.md b/lib/clients/webhook/docs/FileMessageContentAllOf.md new file mode 100644 index 00000000..0713e6e4 --- /dev/null +++ b/lib/clients/webhook/docs/FileMessageContentAllOf.md @@ -0,0 +1,22 @@ +# LINE::Client::Webhook::FileMessageContentAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Message ID | | +| **file_name** | **String** | File name | | +| **file_size** | **Integer** | File size in bytes | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::FileMessageContentAllOf.new( + id: null, + file_name: null, + file_size: null +) +``` + diff --git a/lib/clients/webhook/docs/FollowEvent.md b/lib/clients/webhook/docs/FollowEvent.md new file mode 100644 index 00000000..89b3123a --- /dev/null +++ b/lib/clients/webhook/docs/FollowEvent.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::FollowEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **reply_token** | **String** | Reply token used to send reply message to this event | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::FollowEvent.new( + reply_token: null +) +``` + diff --git a/lib/clients/webhook/docs/FollowEventAllOf.md b/lib/clients/webhook/docs/FollowEventAllOf.md new file mode 100644 index 00000000..60baabe1 --- /dev/null +++ b/lib/clients/webhook/docs/FollowEventAllOf.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::FollowEventAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **reply_token** | **String** | Reply token used to send reply message to this event | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::FollowEventAllOf.new( + reply_token: null +) +``` + diff --git a/lib/clients/webhook/docs/GroupSource.md b/lib/clients/webhook/docs/GroupSource.md new file mode 100644 index 00000000..2852ec2e --- /dev/null +++ b/lib/clients/webhook/docs/GroupSource.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::GroupSource + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **group_id** | **String** | Group ID of the source group chat | | +| **user_id** | **String** | ID of the source user. Only included in message events. Only users of LINE for iOS and LINE for Android are included in userId. | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::GroupSource.new( + group_id: null, + user_id: null +) +``` + diff --git a/lib/clients/webhook/docs/GroupSourceAllOf.md b/lib/clients/webhook/docs/GroupSourceAllOf.md new file mode 100644 index 00000000..7fad67d5 --- /dev/null +++ b/lib/clients/webhook/docs/GroupSourceAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::GroupSourceAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **group_id** | **String** | Group ID of the source group chat | | +| **user_id** | **String** | ID of the source user. Only included in message events. Only users of LINE for iOS and LINE for Android are included in userId. | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::GroupSourceAllOf.new( + group_id: null, + user_id: null +) +``` + diff --git a/lib/clients/webhook/docs/ImageMessageContent.md b/lib/clients/webhook/docs/ImageMessageContent.md new file mode 100644 index 00000000..357fb64a --- /dev/null +++ b/lib/clients/webhook/docs/ImageMessageContent.md @@ -0,0 +1,24 @@ +# LINE::Client::Webhook::ImageMessageContent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Message ID | | +| **content_provider** | [**ContentProvider**](ContentProvider.md) | | | +| **image_set** | [**ImageSet**](ImageSet.md) | | [optional] | +| **quote_token** | **String** | Quote token to quote this message. | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::ImageMessageContent.new( + id: null, + content_provider: null, + image_set: null, + quote_token: null +) +``` + diff --git a/lib/clients/webhook/docs/ImageMessageContentAllOf.md b/lib/clients/webhook/docs/ImageMessageContentAllOf.md new file mode 100644 index 00000000..01390b70 --- /dev/null +++ b/lib/clients/webhook/docs/ImageMessageContentAllOf.md @@ -0,0 +1,22 @@ +# LINE::Client::Webhook::ImageMessageContentAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Message ID | | +| **content_provider** | [**ContentProvider**](ContentProvider.md) | | | +| **image_set** | [**ImageSet**](ImageSet.md) | | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::ImageMessageContentAllOf.new( + id: null, + content_provider: null, + image_set: null +) +``` + diff --git a/lib/clients/webhook/docs/ImageSet.md b/lib/clients/webhook/docs/ImageSet.md new file mode 100644 index 00000000..828061b1 --- /dev/null +++ b/lib/clients/webhook/docs/ImageSet.md @@ -0,0 +1,22 @@ +# LINE::Client::Webhook::ImageSet + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Image set ID. Only included when multiple images are sent simultaneously. | [optional] | +| **index** | **Integer** | An index starting from 1, indicating the image number in a set of images sent simultaneously. Only included when multiple images are sent simultaneously. However, it won't be included if the sender is using LINE 11.15 or earlier for Android. | [optional] | +| **total** | **Integer** | The total number of images sent simultaneously. | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::ImageSet.new( + id: null, + index: null, + total: null +) +``` + diff --git a/lib/clients/webhook/docs/JoinEvent.md b/lib/clients/webhook/docs/JoinEvent.md new file mode 100644 index 00000000..d3640e6e --- /dev/null +++ b/lib/clients/webhook/docs/JoinEvent.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::JoinEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **reply_token** | **String** | Reply token used to send reply message to this event | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::JoinEvent.new( + reply_token: null +) +``` + diff --git a/lib/clients/webhook/docs/JoinedMembers.md b/lib/clients/webhook/docs/JoinedMembers.md new file mode 100644 index 00000000..b7a36154 --- /dev/null +++ b/lib/clients/webhook/docs/JoinedMembers.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::JoinedMembers + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **members** | [**Array<UserSource>**](UserSource.md) | Users who joined. Array of source user objects. | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::JoinedMembers.new( + members: null +) +``` + diff --git a/lib/clients/webhook/docs/LeaveEvent.md b/lib/clients/webhook/docs/LeaveEvent.md new file mode 100644 index 00000000..54e5409d --- /dev/null +++ b/lib/clients/webhook/docs/LeaveEvent.md @@ -0,0 +1,15 @@ +# LINE::Client::Webhook::LeaveEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::LeaveEvent.new() +``` + diff --git a/lib/clients/webhook/docs/LeftMembers.md b/lib/clients/webhook/docs/LeftMembers.md new file mode 100644 index 00000000..8e0a714e --- /dev/null +++ b/lib/clients/webhook/docs/LeftMembers.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::LeftMembers + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **members** | [**Array<UserSource>**](UserSource.md) | Users who left. Array of source user objects. | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::LeftMembers.new( + members: null +) +``` + diff --git a/lib/clients/webhook/docs/LinkContent.md b/lib/clients/webhook/docs/LinkContent.md new file mode 100644 index 00000000..24a17f8e --- /dev/null +++ b/lib/clients/webhook/docs/LinkContent.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::LinkContent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **result** | **String** | One of the following values to indicate whether linking the account was successful or not | | +| **nonce** | **String** | Specified nonce (number used once) when verifying the user ID. | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::LinkContent.new( + result: null, + nonce: null +) +``` + diff --git a/lib/clients/webhook/docs/LinkThingsContent.md b/lib/clients/webhook/docs/LinkThingsContent.md new file mode 100644 index 00000000..0c7be95e --- /dev/null +++ b/lib/clients/webhook/docs/LinkThingsContent.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::LinkThingsContent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **device_id** | **String** | Device ID of the device that has been linked with LINE. | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::LinkThingsContent.new( + device_id: null +) +``` + diff --git a/lib/clients/webhook/docs/LinkThingsContentAllOf.md b/lib/clients/webhook/docs/LinkThingsContentAllOf.md new file mode 100644 index 00000000..9c258052 --- /dev/null +++ b/lib/clients/webhook/docs/LinkThingsContentAllOf.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::LinkThingsContentAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **device_id** | **String** | Device ID of the device that has been linked with LINE. | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::LinkThingsContentAllOf.new( + device_id: null +) +``` + diff --git a/lib/clients/webhook/docs/LocationMessageContent.md b/lib/clients/webhook/docs/LocationMessageContent.md new file mode 100644 index 00000000..bda60310 --- /dev/null +++ b/lib/clients/webhook/docs/LocationMessageContent.md @@ -0,0 +1,26 @@ +# LINE::Client::Webhook::LocationMessageContent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Message ID | | +| **title** | **String** | Title | [optional] | +| **address** | **String** | Address | [optional] | +| **latitude** | **Float** | Latitude | | +| **longitude** | **Float** | Longitude | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::LocationMessageContent.new( + id: null, + title: null, + address: null, + latitude: null, + longitude: null +) +``` + diff --git a/lib/clients/webhook/docs/LocationMessageContentAllOf.md b/lib/clients/webhook/docs/LocationMessageContentAllOf.md new file mode 100644 index 00000000..3a477803 --- /dev/null +++ b/lib/clients/webhook/docs/LocationMessageContentAllOf.md @@ -0,0 +1,26 @@ +# LINE::Client::Webhook::LocationMessageContentAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Message ID | | +| **title** | **String** | Title | [optional] | +| **address** | **String** | Address | [optional] | +| **latitude** | **Float** | Latitude | | +| **longitude** | **Float** | Longitude | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::LocationMessageContentAllOf.new( + id: null, + title: null, + address: null, + latitude: null, + longitude: null +) +``` + diff --git a/lib/clients/webhook/docs/MemberJoinedEvent.md b/lib/clients/webhook/docs/MemberJoinedEvent.md new file mode 100644 index 00000000..bba23058 --- /dev/null +++ b/lib/clients/webhook/docs/MemberJoinedEvent.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::MemberJoinedEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **reply_token** | **String** | Reply token used to send reply message to this event | | +| **joined** | [**JoinedMembers**](JoinedMembers.md) | | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::MemberJoinedEvent.new( + reply_token: null, + joined: null +) +``` + diff --git a/lib/clients/webhook/docs/MemberJoinedEventAllOf.md b/lib/clients/webhook/docs/MemberJoinedEventAllOf.md new file mode 100644 index 00000000..9c941fd6 --- /dev/null +++ b/lib/clients/webhook/docs/MemberJoinedEventAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::MemberJoinedEventAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **reply_token** | **String** | Reply token used to send reply message to this event | | +| **joined** | [**JoinedMembers**](JoinedMembers.md) | | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::MemberJoinedEventAllOf.new( + reply_token: null, + joined: null +) +``` + diff --git a/lib/clients/webhook/docs/MemberLeftEvent.md b/lib/clients/webhook/docs/MemberLeftEvent.md new file mode 100644 index 00000000..9cd2f0b7 --- /dev/null +++ b/lib/clients/webhook/docs/MemberLeftEvent.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::MemberLeftEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **left** | [**LeftMembers**](LeftMembers.md) | | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::MemberLeftEvent.new( + left: null +) +``` + diff --git a/lib/clients/webhook/docs/MemberLeftEventAllOf.md b/lib/clients/webhook/docs/MemberLeftEventAllOf.md new file mode 100644 index 00000000..7c0beaac --- /dev/null +++ b/lib/clients/webhook/docs/MemberLeftEventAllOf.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::MemberLeftEventAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **left** | [**LeftMembers**](LeftMembers.md) | | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::MemberLeftEventAllOf.new( + left: null +) +``` + diff --git a/lib/clients/webhook/docs/Mention.md b/lib/clients/webhook/docs/Mention.md new file mode 100644 index 00000000..bcaf3fef --- /dev/null +++ b/lib/clients/webhook/docs/Mention.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::Mention + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **mentionees** | [**Array<Mentionee>**](Mentionee.md) | Array of one or more mention objects. Max: 20 mentions | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::Mention.new( + mentionees: null +) +``` + diff --git a/lib/clients/webhook/docs/Mentionee.md b/lib/clients/webhook/docs/Mentionee.md new file mode 100644 index 00000000..ae883907 --- /dev/null +++ b/lib/clients/webhook/docs/Mentionee.md @@ -0,0 +1,22 @@ +# LINE::Client::Webhook::Mentionee + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | Mentioned target. | [optional] | +| **index** | **Integer** | Index position of the user mention for a character in text, with the first character being at position 0. | | +| **length** | **Integer** | The length of the text of the mentioned user. For a mention @example, 8 is the length. | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::Mentionee.new( + type: null, + index: null, + length: null +) +``` + diff --git a/lib/clients/webhook/docs/MessageContent.md b/lib/clients/webhook/docs/MessageContent.md new file mode 100644 index 00000000..3cfe13aa --- /dev/null +++ b/lib/clients/webhook/docs/MessageContent.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::MessageContent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | Type | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::MessageContent.new( + type: null +) +``` + diff --git a/lib/clients/webhook/docs/MessageEvent.md b/lib/clients/webhook/docs/MessageEvent.md new file mode 100644 index 00000000..058aa595 --- /dev/null +++ b/lib/clients/webhook/docs/MessageEvent.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::MessageEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **reply_token** | **String** | | [optional] | +| **message** | [**MessageContent**](MessageContent.md) | | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::MessageEvent.new( + reply_token: null, + message: null +) +``` + diff --git a/lib/clients/webhook/docs/MessageEventAllOf.md b/lib/clients/webhook/docs/MessageEventAllOf.md new file mode 100644 index 00000000..9eb45fa0 --- /dev/null +++ b/lib/clients/webhook/docs/MessageEventAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::MessageEventAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **reply_token** | **String** | | [optional] | +| **message** | [**MessageContent**](MessageContent.md) | | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::MessageEventAllOf.new( + reply_token: null, + message: null +) +``` + diff --git a/lib/clients/webhook/docs/ModuleContent.md b/lib/clients/webhook/docs/ModuleContent.md new file mode 100644 index 00000000..553f8b43 --- /dev/null +++ b/lib/clients/webhook/docs/ModuleContent.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::ModuleContent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | Type | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::ModuleContent.new( + type: null +) +``` + diff --git a/lib/clients/webhook/docs/ModuleEvent.md b/lib/clients/webhook/docs/ModuleEvent.md new file mode 100644 index 00000000..93b8b3f1 --- /dev/null +++ b/lib/clients/webhook/docs/ModuleEvent.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::ModuleEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **_module** | [**ModuleContent**](ModuleContent.md) | | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::ModuleEvent.new( + _module: null +) +``` + diff --git a/lib/clients/webhook/docs/ModuleEventAllOf.md b/lib/clients/webhook/docs/ModuleEventAllOf.md new file mode 100644 index 00000000..8081da47 --- /dev/null +++ b/lib/clients/webhook/docs/ModuleEventAllOf.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::ModuleEventAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **_module** | [**ModuleContent**](ModuleContent.md) | | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::ModuleEventAllOf.new( + _module: null +) +``` + diff --git a/lib/clients/webhook/docs/PostbackContent.md b/lib/clients/webhook/docs/PostbackContent.md new file mode 100644 index 00000000..5947c6f4 --- /dev/null +++ b/lib/clients/webhook/docs/PostbackContent.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::PostbackContent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **data** | **String** | Postback data | | +| **params** | **Hash<String, String>** | | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::PostbackContent.new( + data: null, + params: null +) +``` + diff --git a/lib/clients/webhook/docs/PostbackEvent.md b/lib/clients/webhook/docs/PostbackEvent.md new file mode 100644 index 00000000..2994a2f4 --- /dev/null +++ b/lib/clients/webhook/docs/PostbackEvent.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::PostbackEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **reply_token** | **String** | Reply token used to send reply message to this event | [optional] | +| **postback** | [**PostbackContent**](PostbackContent.md) | | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::PostbackEvent.new( + reply_token: null, + postback: null +) +``` + diff --git a/lib/clients/webhook/docs/PostbackEventAllOf.md b/lib/clients/webhook/docs/PostbackEventAllOf.md new file mode 100644 index 00000000..e548fc23 --- /dev/null +++ b/lib/clients/webhook/docs/PostbackEventAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::PostbackEventAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **reply_token** | **String** | Reply token used to send reply message to this event | [optional] | +| **postback** | [**PostbackContent**](PostbackContent.md) | | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::PostbackEventAllOf.new( + reply_token: null, + postback: null +) +``` + diff --git a/lib/clients/webhook/docs/RoomSource.md b/lib/clients/webhook/docs/RoomSource.md new file mode 100644 index 00000000..36e06a6d --- /dev/null +++ b/lib/clients/webhook/docs/RoomSource.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::RoomSource + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **user_id** | **String** | ID of the source user. Only included in message events. Only users of LINE for iOS and LINE for Android are included in userId. | [optional] | +| **room_id** | **String** | Room ID of the source multi-person chat | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::RoomSource.new( + user_id: null, + room_id: null +) +``` + diff --git a/lib/clients/webhook/docs/RoomSourceAllOf.md b/lib/clients/webhook/docs/RoomSourceAllOf.md new file mode 100644 index 00000000..c432b66e --- /dev/null +++ b/lib/clients/webhook/docs/RoomSourceAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::RoomSourceAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **user_id** | **String** | ID of the source user. Only included in message events. Only users of LINE for iOS and LINE for Android are included in userId. | [optional] | +| **room_id** | **String** | Room ID of the source multi-person chat | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::RoomSourceAllOf.new( + user_id: null, + room_id: null +) +``` + diff --git a/lib/clients/webhook/docs/ScenarioResult.md b/lib/clients/webhook/docs/ScenarioResult.md new file mode 100644 index 00000000..7ca523c6 --- /dev/null +++ b/lib/clients/webhook/docs/ScenarioResult.md @@ -0,0 +1,32 @@ +# LINE::Client::Webhook::ScenarioResult + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **scenario_id** | **String** | Scenario ID executed | [optional] | +| **revision** | **Integer** | Revision number of the scenario set containing the executed scenario | [optional] | +| **start_time** | **Integer** | Timestamp for when execution of scenario action started (milliseconds, LINE app time) | | +| **end_time** | **Integer** | Timestamp for when execution of scenario was completed (milliseconds, LINE app time) | | +| **result_code** | **String** | Scenario execution completion status | | +| **action_results** | [**Array<ActionResult>**](ActionResult.md) | Execution result of individual operations specified in action. Only included when things.result.resultCode is success. | [optional] | +| **ble_notification_payload** | **String** | Data contained in notification. | [optional] | +| **error_reason** | **String** | Error reason. | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::ScenarioResult.new( + scenario_id: null, + revision: null, + start_time: null, + end_time: null, + result_code: null, + action_results: null, + ble_notification_payload: null, + error_reason: null +) +``` + diff --git a/lib/clients/webhook/docs/ScenarioResultThingsContent.md b/lib/clients/webhook/docs/ScenarioResultThingsContent.md new file mode 100644 index 00000000..778e51de --- /dev/null +++ b/lib/clients/webhook/docs/ScenarioResultThingsContent.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::ScenarioResultThingsContent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **device_id** | **String** | Device ID of the device that has been linked with LINE. | | +| **result** | [**ScenarioResult**](ScenarioResult.md) | | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::ScenarioResultThingsContent.new( + device_id: null, + result: null +) +``` + diff --git a/lib/clients/webhook/docs/ScenarioResultThingsContentAllOf.md b/lib/clients/webhook/docs/ScenarioResultThingsContentAllOf.md new file mode 100644 index 00000000..13265271 --- /dev/null +++ b/lib/clients/webhook/docs/ScenarioResultThingsContentAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::ScenarioResultThingsContentAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **device_id** | **String** | Device ID of the device that has been linked with LINE. | | +| **result** | [**ScenarioResult**](ScenarioResult.md) | | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::ScenarioResultThingsContentAllOf.new( + device_id: null, + result: null +) +``` + diff --git a/lib/clients/webhook/docs/Source.md b/lib/clients/webhook/docs/Source.md new file mode 100644 index 00000000..b8503a3c --- /dev/null +++ b/lib/clients/webhook/docs/Source.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::Source + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | source type | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::Source.new( + type: null +) +``` + diff --git a/lib/clients/webhook/docs/StickerMessageContent.md b/lib/clients/webhook/docs/StickerMessageContent.md new file mode 100644 index 00000000..134f98ce --- /dev/null +++ b/lib/clients/webhook/docs/StickerMessageContent.md @@ -0,0 +1,32 @@ +# LINE::Client::Webhook::StickerMessageContent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Message ID | | +| **package_id** | **String** | Package ID | | +| **sticker_id** | **String** | Sticker ID | | +| **sticker_resource_type** | **String** | | | +| **keywords** | **Array<String>** | Array of up to 15 keywords describing the sticker. If a sticker has 16 or more keywords, a random selection of 15 keywords will be returned. The keyword selection is random for each event, so different keywords may be returned for the same sticker. | [optional] | +| **text** | **String** | Any text entered by the user. This property is only included for message stickers. Max character limit: 100 | [optional] | +| **quote_token** | **String** | Quote token to quote this message. | | +| **quoted_message_id** | **String** | Message ID of a quoted message. Only included when the received message quotes a past message. | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::StickerMessageContent.new( + id: null, + package_id: null, + sticker_id: null, + sticker_resource_type: null, + keywords: null, + text: null, + quote_token: null, + quoted_message_id: null +) +``` + diff --git a/lib/clients/webhook/docs/StickerMessageContentAllOf.md b/lib/clients/webhook/docs/StickerMessageContentAllOf.md new file mode 100644 index 00000000..2f743744 --- /dev/null +++ b/lib/clients/webhook/docs/StickerMessageContentAllOf.md @@ -0,0 +1,28 @@ +# LINE::Client::Webhook::StickerMessageContentAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Message ID | | +| **package_id** | **String** | Package ID | | +| **sticker_id** | **String** | Sticker ID | | +| **sticker_resource_type** | **String** | | | +| **keywords** | **Array<String>** | Array of up to 15 keywords describing the sticker. If a sticker has 16 or more keywords, a random selection of 15 keywords will be returned. The keyword selection is random for each event, so different keywords may be returned for the same sticker. | [optional] | +| **text** | **String** | Any text entered by the user. This property is only included for message stickers. Max character limit: 100 | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::StickerMessageContentAllOf.new( + id: null, + package_id: null, + sticker_id: null, + sticker_resource_type: null, + keywords: null, + text: null +) +``` + diff --git a/lib/clients/webhook/docs/TextMessageContent.md b/lib/clients/webhook/docs/TextMessageContent.md new file mode 100644 index 00000000..bfd424b7 --- /dev/null +++ b/lib/clients/webhook/docs/TextMessageContent.md @@ -0,0 +1,28 @@ +# LINE::Client::Webhook::TextMessageContent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Message ID | | +| **text** | **String** | Message text. | | +| **emojis** | [**Array<Emoji>**](Emoji.md) | Array of one or more LINE emoji objects. Only included in the message event when the text property contains a LINE emoji. | [optional] | +| **mention** | [**Mention**](Mention.md) | | [optional] | +| **quote_token** | **String** | Quote token to quote this message. | | +| **quoted_message_id** | **String** | Message ID of a quoted message. Only included when the received message quotes a past message. | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::TextMessageContent.new( + id: null, + text: null, + emojis: null, + mention: null, + quote_token: null, + quoted_message_id: null +) +``` + diff --git a/lib/clients/webhook/docs/TextMessageContentAllOf.md b/lib/clients/webhook/docs/TextMessageContentAllOf.md new file mode 100644 index 00000000..0ba0b48a --- /dev/null +++ b/lib/clients/webhook/docs/TextMessageContentAllOf.md @@ -0,0 +1,24 @@ +# LINE::Client::Webhook::TextMessageContentAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Message ID | | +| **text** | **String** | Message text. | | +| **emojis** | [**Array<Emoji>**](Emoji.md) | Array of one or more LINE emoji objects. Only included in the message event when the text property contains a LINE emoji. | [optional] | +| **mention** | [**Mention**](Mention.md) | | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::TextMessageContentAllOf.new( + id: null, + text: null, + emojis: null, + mention: null +) +``` + diff --git a/lib/clients/webhook/docs/ThingsContent.md b/lib/clients/webhook/docs/ThingsContent.md new file mode 100644 index 00000000..5ee2f9ca --- /dev/null +++ b/lib/clients/webhook/docs/ThingsContent.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::ThingsContent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | Type | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::ThingsContent.new( + type: null +) +``` + diff --git a/lib/clients/webhook/docs/ThingsEvent.md b/lib/clients/webhook/docs/ThingsEvent.md new file mode 100644 index 00000000..6f4220fe --- /dev/null +++ b/lib/clients/webhook/docs/ThingsEvent.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::ThingsEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **reply_token** | **String** | Reply token used to send reply message to this event | | +| **things** | [**ThingsContent**](ThingsContent.md) | | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::ThingsEvent.new( + reply_token: null, + things: null +) +``` + diff --git a/lib/clients/webhook/docs/ThingsEventAllOf.md b/lib/clients/webhook/docs/ThingsEventAllOf.md new file mode 100644 index 00000000..b50e4818 --- /dev/null +++ b/lib/clients/webhook/docs/ThingsEventAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::ThingsEventAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **reply_token** | **String** | Reply token used to send reply message to this event | | +| **things** | [**ThingsContent**](ThingsContent.md) | | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::ThingsEventAllOf.new( + reply_token: null, + things: null +) +``` + diff --git a/lib/clients/webhook/docs/UnfollowEvent.md b/lib/clients/webhook/docs/UnfollowEvent.md new file mode 100644 index 00000000..c7cc2982 --- /dev/null +++ b/lib/clients/webhook/docs/UnfollowEvent.md @@ -0,0 +1,15 @@ +# LINE::Client::Webhook::UnfollowEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::UnfollowEvent.new() +``` + diff --git a/lib/clients/webhook/docs/UnlinkThingsContent.md b/lib/clients/webhook/docs/UnlinkThingsContent.md new file mode 100644 index 00000000..167be487 --- /dev/null +++ b/lib/clients/webhook/docs/UnlinkThingsContent.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::UnlinkThingsContent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **device_id** | **String** | Device ID of the device that has been linked with LINE. | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::UnlinkThingsContent.new( + device_id: null +) +``` + diff --git a/lib/clients/webhook/docs/UnlinkThingsContentAllOf.md b/lib/clients/webhook/docs/UnlinkThingsContentAllOf.md new file mode 100644 index 00000000..8adfa629 --- /dev/null +++ b/lib/clients/webhook/docs/UnlinkThingsContentAllOf.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::UnlinkThingsContentAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **device_id** | **String** | Device ID of the device that has been linked with LINE. | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::UnlinkThingsContentAllOf.new( + device_id: null +) +``` + diff --git a/lib/clients/webhook/docs/UnsendDetail.md b/lib/clients/webhook/docs/UnsendDetail.md new file mode 100644 index 00000000..f6494800 --- /dev/null +++ b/lib/clients/webhook/docs/UnsendDetail.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::UnsendDetail + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **message_id** | **String** | The message ID of the unsent message | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::UnsendDetail.new( + message_id: null +) +``` + diff --git a/lib/clients/webhook/docs/UnsendEvent.md b/lib/clients/webhook/docs/UnsendEvent.md new file mode 100644 index 00000000..f9aa39cc --- /dev/null +++ b/lib/clients/webhook/docs/UnsendEvent.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::UnsendEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **unsend** | [**UnsendDetail**](UnsendDetail.md) | | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::UnsendEvent.new( + unsend: null +) +``` + diff --git a/lib/clients/webhook/docs/UnsendEventAllOf.md b/lib/clients/webhook/docs/UnsendEventAllOf.md new file mode 100644 index 00000000..1b1ab7e4 --- /dev/null +++ b/lib/clients/webhook/docs/UnsendEventAllOf.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::UnsendEventAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **unsend** | [**UnsendDetail**](UnsendDetail.md) | | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::UnsendEventAllOf.new( + unsend: null +) +``` + diff --git a/lib/clients/webhook/docs/UserMentionee.md b/lib/clients/webhook/docs/UserMentionee.md new file mode 100644 index 00000000..365a8d36 --- /dev/null +++ b/lib/clients/webhook/docs/UserMentionee.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::UserMentionee + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **user_id** | **String** | User ID of the mentioned user. Only included if mention.mentions[].type is user and the user consents to the LINE Official Account obtaining their user profile information. | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::UserMentionee.new( + user_id: null +) +``` + diff --git a/lib/clients/webhook/docs/UserMentioneeAllOf.md b/lib/clients/webhook/docs/UserMentioneeAllOf.md new file mode 100644 index 00000000..92419445 --- /dev/null +++ b/lib/clients/webhook/docs/UserMentioneeAllOf.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::UserMentioneeAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **user_id** | **String** | User ID of the mentioned user. Only included if mention.mentions[].type is user and the user consents to the LINE Official Account obtaining their user profile information. | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::UserMentioneeAllOf.new( + user_id: null +) +``` + diff --git a/lib/clients/webhook/docs/UserSource.md b/lib/clients/webhook/docs/UserSource.md new file mode 100644 index 00000000..d4ba958d --- /dev/null +++ b/lib/clients/webhook/docs/UserSource.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::UserSource + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **user_id** | **String** | ID of the source user | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::UserSource.new( + user_id: null +) +``` + diff --git a/lib/clients/webhook/docs/UserSourceAllOf.md b/lib/clients/webhook/docs/UserSourceAllOf.md new file mode 100644 index 00000000..996f2698 --- /dev/null +++ b/lib/clients/webhook/docs/UserSourceAllOf.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::UserSourceAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **user_id** | **String** | ID of the source user | [optional] | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::UserSourceAllOf.new( + user_id: null +) +``` + diff --git a/lib/clients/webhook/docs/VideoMessageContent.md b/lib/clients/webhook/docs/VideoMessageContent.md new file mode 100644 index 00000000..20db1f25 --- /dev/null +++ b/lib/clients/webhook/docs/VideoMessageContent.md @@ -0,0 +1,24 @@ +# LINE::Client::Webhook::VideoMessageContent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Message ID | | +| **duration** | **Integer** | Length of video file (milliseconds) | [optional] | +| **content_provider** | [**ContentProvider**](ContentProvider.md) | | | +| **quote_token** | **String** | Quote token to quote this message. | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::VideoMessageContent.new( + id: null, + duration: null, + content_provider: null, + quote_token: null +) +``` + diff --git a/lib/clients/webhook/docs/VideoMessageContentAllOf.md b/lib/clients/webhook/docs/VideoMessageContentAllOf.md new file mode 100644 index 00000000..c1882943 --- /dev/null +++ b/lib/clients/webhook/docs/VideoMessageContentAllOf.md @@ -0,0 +1,22 @@ +# LINE::Client::Webhook::VideoMessageContentAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Message ID | | +| **duration** | **Integer** | Length of video file (milliseconds) | [optional] | +| **content_provider** | [**ContentProvider**](ContentProvider.md) | | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::VideoMessageContentAllOf.new( + id: null, + duration: null, + content_provider: null +) +``` + diff --git a/lib/clients/webhook/docs/VideoPlayComplete.md b/lib/clients/webhook/docs/VideoPlayComplete.md new file mode 100644 index 00000000..0bab1ddf --- /dev/null +++ b/lib/clients/webhook/docs/VideoPlayComplete.md @@ -0,0 +1,18 @@ +# LINE::Client::Webhook::VideoPlayComplete + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **tracking_id** | **String** | ID used to identify a video. Returns the same value as the trackingId assigned to the video message. | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::VideoPlayComplete.new( + tracking_id: null +) +``` + diff --git a/lib/clients/webhook/docs/VideoPlayCompleteEvent.md b/lib/clients/webhook/docs/VideoPlayCompleteEvent.md new file mode 100644 index 00000000..c4adb922 --- /dev/null +++ b/lib/clients/webhook/docs/VideoPlayCompleteEvent.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::VideoPlayCompleteEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **reply_token** | **String** | Reply token used to send reply message to this event | | +| **video_play_complete** | [**VideoPlayComplete**](VideoPlayComplete.md) | | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::VideoPlayCompleteEvent.new( + reply_token: null, + video_play_complete: null +) +``` + diff --git a/lib/clients/webhook/docs/VideoPlayCompleteEventAllOf.md b/lib/clients/webhook/docs/VideoPlayCompleteEventAllOf.md new file mode 100644 index 00000000..4fcf10ca --- /dev/null +++ b/lib/clients/webhook/docs/VideoPlayCompleteEventAllOf.md @@ -0,0 +1,20 @@ +# LINE::Client::Webhook::VideoPlayCompleteEventAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **reply_token** | **String** | Reply token used to send reply message to this event | | +| **video_play_complete** | [**VideoPlayComplete**](VideoPlayComplete.md) | | | + +## Example + +```ruby +require 'line_client_webhook' + +instance = LINE::Client::Webhook::VideoPlayCompleteEventAllOf.new( + reply_token: null, + video_play_complete: null +) +``` + diff --git a/lib/clients/webhook/lib/line_client_webhook.rb b/lib/clients/webhook/lib/line_client_webhook.rb new file mode 100644 index 00000000..6a0ad560 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook.rb @@ -0,0 +1,98 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +# Common files +require 'line_client_webhook/api_client' +require 'line_client_webhook/api_error' +require 'line_client_webhook/version' +require 'line_client_webhook/configuration' + +# Models +require 'line_client_webhook/models/action_result' +require 'line_client_webhook/models/beacon_content' +require 'line_client_webhook/models/callback_request' +require 'line_client_webhook/models/chat_control' +require 'line_client_webhook/models/content_provider' +require 'line_client_webhook/models/delivery_context' +require 'line_client_webhook/models/emoji' +require 'line_client_webhook/models/event' +require 'line_client_webhook/models/event_mode' +require 'line_client_webhook/models/image_set' +require 'line_client_webhook/models/joined_members' +require 'line_client_webhook/models/left_members' +require 'line_client_webhook/models/link_content' +require 'line_client_webhook/models/mention' +require 'line_client_webhook/models/mentionee' +require 'line_client_webhook/models/message_content' +require 'line_client_webhook/models/module_content' +require 'line_client_webhook/models/postback_content' +require 'line_client_webhook/models/scenario_result' +require 'line_client_webhook/models/source' +require 'line_client_webhook/models/things_content' +require 'line_client_webhook/models/unsend_detail' +require 'line_client_webhook/models/video_play_complete' +require 'line_client_webhook/models/account_link_event' +require 'line_client_webhook/models/activated_event' +require 'line_client_webhook/models/all_mentionee' +require 'line_client_webhook/models/attached_module_content' +require 'line_client_webhook/models/audio_message_content' +require 'line_client_webhook/models/beacon_event' +require 'line_client_webhook/models/bot_resumed_event' +require 'line_client_webhook/models/bot_suspended_event' +require 'line_client_webhook/models/deactivated_event' +require 'line_client_webhook/models/detached_module_content' +require 'line_client_webhook/models/file_message_content' +require 'line_client_webhook/models/follow_event' +require 'line_client_webhook/models/group_source' +require 'line_client_webhook/models/image_message_content' +require 'line_client_webhook/models/join_event' +require 'line_client_webhook/models/leave_event' +require 'line_client_webhook/models/link_things_content' +require 'line_client_webhook/models/location_message_content' +require 'line_client_webhook/models/member_joined_event' +require 'line_client_webhook/models/member_left_event' +require 'line_client_webhook/models/message_event' +require 'line_client_webhook/models/module_event' +require 'line_client_webhook/models/postback_event' +require 'line_client_webhook/models/room_source' +require 'line_client_webhook/models/scenario_result_things_content' +require 'line_client_webhook/models/sticker_message_content' +require 'line_client_webhook/models/text_message_content' +require 'line_client_webhook/models/things_event' +require 'line_client_webhook/models/unfollow_event' +require 'line_client_webhook/models/unlink_things_content' +require 'line_client_webhook/models/unsend_event' +require 'line_client_webhook/models/user_mentionee' +require 'line_client_webhook/models/user_source' +require 'line_client_webhook/models/video_message_content' +require 'line_client_webhook/models/video_play_complete_event' + +# APIs +require 'line_client_webhook/api/dummy_api' + +module LINE::Client::Webhook + class << self + # Customize default settings for the SDK using block. + # LINE::Client::Webhook.configure do |config| + # config.username = "xxx" + # config.password = "xxx" + # end + # If no block given, return the default Configuration object. + def configure + if block_given? + yield(Configuration.default) + else + Configuration.default + end + end + end +end diff --git a/lib/clients/webhook/lib/line_client_webhook/api/dummy_api.rb b/lib/clients/webhook/lib/line_client_webhook/api/dummy_api.rb new file mode 100644 index 00000000..cff02143 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/api/dummy_api.rb @@ -0,0 +1,88 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'cgi' + +module LINE::Client::Webhook + class DummyApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # This is the dummy endpoint to generate the model classes + # @param callback_request [CallbackRequest] + # @param [Hash] opts the optional parameters + # @return [String] + def callback(callback_request, opts = {}) + data, _status_code, _headers = callback_with_http_info(callback_request, opts) + data + end + + # This is the dummy endpoint to generate the model classes + # @param callback_request [CallbackRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def callback_with_http_info(callback_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DummyApi.callback ...' + end + # verify the required parameter 'callback_request' is set + if @api_client.config.client_side_validation && callback_request.nil? + fail ArgumentError, "Missing the required parameter 'callback_request' when calling DummyApi.callback" + end + # resource path + local_var_path = '/callback' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(callback_request) + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"DummyApi.callback", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DummyApi#callback\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/clients/webhook/lib/line_client_webhook/api_client.rb b/lib/clients/webhook/lib/line_client_webhook/api_client.rb new file mode 100644 index 00000000..1b9e1e1c --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/api_client.rb @@ -0,0 +1,391 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'json' +require 'logger' +require 'tempfile' +require 'time' +require 'typhoeus' + +module LINE::Client::Webhook + class ApiClient + # The Configuration object holding settings to be used in the API client. + attr_accessor :config + + # Defines the headers to be used in HTTP requests of all API calls by default. + # + # @return [Hash] + attr_accessor :default_headers + + # Initializes the ApiClient + # @option config [Configuration] Configuration for initializing the object, default to Configuration.default + def initialize(config = Configuration.default) + @config = config + @user_agent = "LINE-BotSDK-Ruby/2.0.0" + @default_headers = { + 'Content-Type' => 'application/json', + 'User-Agent' => @user_agent + } + end + + def self.default + @@default ||= ApiClient.new + end + + # Call an API with given options. + # + # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: + # the data deserialized from response body (could be nil), response status code and response headers. + def call_api(http_method, path, opts = {}) + request = build_request(http_method, path, opts) + response = request.run + + if @config.debugging + @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" + end + + unless response.success? + if response.timed_out? + fail ApiError.new('Connection timed out') + elsif response.code == 0 + # Errors from libcurl will be made visible here + fail ApiError.new(:code => 0, + :message => response.return_message) + else + fail ApiError.new(:code => response.code, + :response_headers => response.headers, + :response_body => response.body), + response.status_message + end + end + + if opts[:return_type] + data = deserialize(response, opts[:return_type]) + else + data = nil + end + return data, response.code, response.headers + end + + # Builds the HTTP request + # + # @param [String] http_method HTTP method/verb (e.g. POST) + # @param [String] path URL path (e.g. /account/new) + # @option opts [Hash] :header_params Header parameters + # @option opts [Hash] :query_params Query parameters + # @option opts [Hash] :form_params Query parameters + # @option opts [Object] :body HTTP body (JSON/XML) + # @return [Typhoeus::Request] A Typhoeus Request + def build_request(http_method, path, opts = {}) + url = build_request_url(path, opts) + http_method = http_method.to_sym.downcase + + header_params = @default_headers.merge(opts[:header_params] || {}) + query_params = opts[:query_params] || {} + form_params = opts[:form_params] || {} + follow_location = opts[:follow_location] || true + + + # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false) + _verify_ssl_host = @config.verify_ssl_host ? 2 : 0 + + req_opts = { + :method => http_method, + :headers => header_params, + :params => query_params, + :params_encoding => @config.params_encoding, + :timeout => @config.timeout, + :ssl_verifypeer => @config.verify_ssl, + :ssl_verifyhost => _verify_ssl_host, + :sslcert => @config.cert_file, + :sslkey => @config.key_file, + :verbose => @config.debugging, + :followlocation => follow_location + } + + # set custom cert, if provided + req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert + + if [:post, :patch, :put, :delete].include?(http_method) + req_body = build_request_body(header_params, form_params, opts[:body]) + req_opts.update :body => req_body + if @config.debugging + @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n" + end + end + + request = Typhoeus::Request.new(url, req_opts) + download_file(request) if opts[:return_type] == 'File' + request + end + + # Builds the HTTP request body + # + # @param [Hash] header_params Header parameters + # @param [Hash] form_params Query parameters + # @param [Object] body HTTP body (JSON/XML) + # @return [String] HTTP body data in the form of string + def build_request_body(header_params, form_params, body) + # http form + if header_params['Content-Type'] == 'application/x-www-form-urlencoded' || + header_params['Content-Type'] == 'multipart/form-data' + data = {} + form_params.each do |key, value| + case value + when ::File, ::Array, nil + # let typhoeus handle File, Array and nil parameters + data[key] = value + else + data[key] = value.to_s + end + end + elsif body + data = body.is_a?(String) ? body : body.to_json + else + data = nil + end + data + end + + # Save response body into a file in (the defined) temporary folder, using the filename + # from the "Content-Disposition" header if provided, otherwise a random filename. + # The response body is written to the file in chunks in order to handle files which + # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby + # process can use. + # + # @see Configuration#temp_folder_path + def download_file(request) + tempfile = nil + encoding = nil + request.on_headers do |response| + content_disposition = response.headers['Content-Disposition'] + if content_disposition && content_disposition =~ /filename=/i + filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1] + prefix = sanitize_filename(filename) + else + prefix = 'download-' + end + prefix = prefix + '-' unless prefix.end_with?('-') + encoding = response.body.encoding + tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) + @tempfile = tempfile + end + request.on_body do |chunk| + chunk.force_encoding(encoding) + tempfile.write(chunk) + end + request.on_complete do |response| + if tempfile + tempfile.close + @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ + "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ + "will be deleted automatically with GC. It's also recommended to delete the temp file "\ + "explicitly with `tempfile.delete`" + end + end + end + + # Check if the given MIME is a JSON MIME. + # JSON MIME examples: + # application/json + # application/json; charset=UTF8 + # APPLICATION/JSON + # */* + # @param [String] mime MIME + # @return [Boolean] True if the MIME is application/json + def json_mime?(mime) + (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + end + + # Deserialize the response to the given return type. + # + # @param [Response] response HTTP response + # @param [String] return_type some examples: "User", "Array", "Hash" + def deserialize(response, return_type) + body = response.body + + # handle file downloading - return the File instance processed in request callbacks + # note that response body is empty when the file is written in chunks in request on_body callback + return @tempfile if return_type == 'File' + + return nil if body.nil? || body.empty? + + # return response body directly for String return type + return body if return_type == 'String' + + # ensuring a default content type + content_type = response.headers['Content-Type'] || 'application/json' + + fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type) + + begin + data = JSON.parse("[#{body}]", :symbolize_names => true)[0] + rescue JSON::ParserError => e + if %w(String Date Time).include?(return_type) + data = body + else + raise e + end + end + + convert_to_type data, return_type + end + + # Convert data to the given return type. + # @param [Object] data Data to be converted + # @param [String] return_type Return type + # @return [Mixed] Data in a particular type + def convert_to_type(data, return_type) + return nil if data.nil? + case return_type + when 'String' + data.to_s + when 'Integer' + data.to_i + when 'Float' + data.to_f + when 'Boolean' + data == true + when 'Time' + # parse date time (expecting ISO 8601 format) + Time.parse data + when 'Date' + # parse date time (expecting ISO 8601 format) + Date.parse data + when 'Object' + # generic object (usually a Hash), return directly + data + when /\AArray<(.+)>\z/ + # e.g. Array + sub_type = $1 + data.map { |item| convert_to_type(item, sub_type) } + when /\AHash\\z/ + # e.g. Hash + sub_type = $1 + {}.tap do |hash| + data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } + end + else + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(return_type) + klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + end + end + + # Sanitize filename by removing path. + # e.g. ../../sun.gif becomes sun.gif + # + # @param [String] filename the filename to be sanitized + # @return [String] the sanitized filename + def sanitize_filename(filename) + filename.gsub(/.*[\/\\]/, '') + end + + def build_request_url(path, opts = {}) + # Add leading and trailing slashes to path + path = "/#{path}".gsub(/\/+/, '/') + @config.base_url(opts[:operation]) + path + end + + # Update header and query params based on authentication settings. + # + # @param [Hash] header_params Header parameters + # @param [Hash] query_params Query parameters + # @param [String] auth_names Authentication scheme name + def update_params_for_auth!(header_params, query_params, auth_names) + Array(auth_names).each do |auth_name| + auth_setting = @config.auth_settings[auth_name] + next unless auth_setting + case auth_setting[:in] + when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] + when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] + else fail ArgumentError, 'Authentication token must be in `query` or `header`' + end + end + end + + # Sets user agent in HTTP header + # + # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0) + def user_agent=(user_agent) + @user_agent = user_agent + @default_headers['User-Agent'] = @user_agent + end + + # Return Accept header based on an array of accepts provided. + # @param [Array] accepts array for Accept + # @return [String] the Accept header (e.g. application/json) + def select_header_accept(accepts) + return nil if accepts.nil? || accepts.empty? + # use JSON when present, otherwise use all of the provided + json_accept = accepts.find { |s| json_mime?(s) } + json_accept || accepts.join(',') + end + + # Return Content-Type header based on an array of content types provided. + # @param [Array] content_types array for Content-Type + # @return [String] the Content-Type header (e.g. application/json) + def select_header_content_type(content_types) + # return nil by default + return if content_types.nil? || content_types.empty? + # use JSON when present, otherwise use the first one + json_content_type = content_types.find { |s| json_mime?(s) } + json_content_type || content_types.first + end + + # Convert object (array, hash, object, etc) to JSON string. + # @param [Object] model object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_http_body(model) + return model if model.nil? || model.is_a?(String) + local_body = nil + if model.is_a?(Array) + local_body = model.map { |m| object_to_hash(m) } + else + local_body = object_to_hash(model) + end + local_body.to_json + end + + # Convert object(non-array) to hash. + # @param [Object] obj object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_hash(obj) + if obj.respond_to?(:to_hash) + obj.to_hash + else + obj + end + end + + # Build parameter value according to the given collection format. + # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi + def build_collection_param(param, collection_format) + case collection_format + when :csv + param.join(',') + when :ssv + param.join(' ') + when :tsv + param.join("\t") + when :pipes + param.join('|') + when :multi + # return the array directly as typhoeus will handle it as expected + param + else + fail "unknown collection format: #{collection_format.inspect}" + end + end + end +end diff --git a/lib/clients/webhook/lib/line_client_webhook/api_error.rb b/lib/clients/webhook/lib/line_client_webhook/api_error.rb new file mode 100644 index 00000000..8cb0d4c7 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/api_error.rb @@ -0,0 +1,58 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::Webhook + class ApiError < StandardError + attr_reader :code, :response_headers, :response_body + + # Usage examples: + # ApiError.new + # ApiError.new("message") + # ApiError.new(:code => 500, :response_headers => {}, :response_body => "") + # ApiError.new(:code => 404, :message => "Not Found") + def initialize(arg = nil) + if arg.is_a? Hash + if arg.key?(:message) || arg.key?('message') + super(arg[:message] || arg['message']) + else + super arg + end + + arg.each do |k, v| + instance_variable_set "@#{k}", v + end + else + super arg + @message = arg + end + end + + # Override to_s to display a friendly error message + def to_s + message + end + + def message + if @message.nil? + msg = "Error message: the server returns an error" + else + msg = @message + end + + msg += "\nHTTP status code: #{code}" if code + msg += "\nResponse headers: #{response_headers}" if response_headers + msg += "\nResponse body: #{response_body}" if response_body + + msg + end + end +end diff --git a/lib/clients/webhook/lib/line_client_webhook/configuration.rb b/lib/clients/webhook/lib/line_client_webhook/configuration.rb new file mode 100644 index 00000000..bd7cb2c3 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/configuration.rb @@ -0,0 +1,290 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::Webhook + class Configuration + # Defines url scheme + attr_accessor :scheme + + # Defines url host + attr_accessor :host + + # Defines url base path + attr_accessor :base_path + + # Define server configuration index + attr_accessor :server_index + + # Define server operation configuration index + attr_accessor :server_operation_index + + # Default server variables + attr_accessor :server_variables + + # Default server operation variables + attr_accessor :server_operation_variables + + # Defines API keys used with API Key authentications. + # + # @return [Hash] key: parameter name, value: parameter value (API key) + # + # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string) + # config.api_key['api_key'] = 'xxx' + attr_accessor :api_key + + # Defines API key prefixes used with API Key authentications. + # + # @return [Hash] key: parameter name, value: API key prefix + # + # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers) + # config.api_key_prefix['api_key'] = 'Token' + attr_accessor :api_key_prefix + + # Defines the username used with HTTP basic authentication. + # + # @return [String] + attr_accessor :username + + # Defines the password used with HTTP basic authentication. + # + # @return [String] + attr_accessor :password + + # Defines the access token (Bearer) used with OAuth2. + attr_accessor :access_token + + # Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2. + # Overrides the access_token if set + # @return [Proc] + attr_accessor :access_token_getter + + # Set this to return data as binary instead of downloading a temp file. When enabled (set to true) + # HTTP responses with return type `File` will be returned as a stream of binary data. + # Default to false. + attr_accessor :return_binary_data + + # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response + # details will be logged with `logger.debug` (see the `logger` attribute). + # Default to false. + # + # @return [true, false] + attr_accessor :debugging + + # Defines the logger used for debugging. + # Default to `Rails.logger` (when in Rails) or logging to STDOUT. + # + # @return [#debug] + attr_accessor :logger + + # Defines the temporary folder to store downloaded files + # (for API endpoints that have file response). + # Default to use `Tempfile`. + # + # @return [String] + attr_accessor :temp_folder_path + + # The time limit for HTTP request in seconds. + # Default to 0 (never times out). + attr_accessor :timeout + + # Set this to false to skip client side validation in the operation. + # Default to true. + # @return [true, false] + attr_accessor :client_side_validation + + ### TLS/SSL setting + # Set this to false to skip verifying SSL certificate when calling API from https server. + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl + + ### TLS/SSL setting + # Set this to false to skip verifying SSL host name + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl_host + + ### TLS/SSL setting + # Set this to customize the certificate file to verify the peer. + # + # @return [String] the path to the certificate file + # + # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code: + # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145 + attr_accessor :ssl_ca_cert + + ### TLS/SSL setting + # Client certificate file (for client certificate) + attr_accessor :cert_file + + ### TLS/SSL setting + # Client private key file (for client certificate) + attr_accessor :key_file + + # Set this to customize parameters encoding of array parameter with multi collectionFormat. + # Default to nil. + # + # @see The params_encoding option of Ethon. Related source code: + # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 + attr_accessor :params_encoding + + + attr_accessor :inject_format + + attr_accessor :force_ending_format + + def initialize + @scheme = 'https' + @host = 'example.com' + @base_path = '' + @server_index = nil + @server_operation_index = {} + @server_variables = {} + @server_operation_variables = {} + @api_key = {} + @api_key_prefix = {} + @client_side_validation = true + @verify_ssl = true + @verify_ssl_host = true + @cert_file = nil + @key_file = nil + @timeout = 0 + @params_encoding = nil + @debugging = false + @inject_format = false + @force_ending_format = false + @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) + + yield(self) if block_given? + end + + # The default Configuration object. + def self.default + @@default ||= Configuration.new + end + + def configure + yield(self) if block_given? + end + + def scheme=(scheme) + # remove :// from scheme + @scheme = scheme.sub(/:\/\//, '') + end + + def host=(host) + # remove http(s):// and anything after a slash + @host = host.sub(/https?:\/\//, '').split('/').first + end + + def base_path=(base_path) + # Add leading and trailing slashes to base_path + @base_path = "/#{base_path}".gsub(/\/+/, '/') + @base_path = '' if @base_path == '/' + end + + # Returns base URL for specified operation based on server settings + def base_url(operation = nil) + if operation_server_settings.key?(operation) then + index = server_operation_index.fetch(operation, server_index) + server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) + else + server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil) + end + end + + # Gets API key (with prefix if set). + # @param [String] param_name the parameter name of API key auth + def api_key_with_prefix(param_name, param_alias = nil) + key = @api_key[param_name] + key = @api_key.fetch(param_alias, key) unless param_alias.nil? + if @api_key_prefix[param_name] + "#{@api_key_prefix[param_name]} #{key}" + else + key + end + end + + # Gets access_token using access_token_getter or uses the static access_token + def access_token_with_refresh + return access_token if access_token_getter.nil? + access_token_getter.call + end + + # Gets Basic Auth token string + def basic_auth_token + 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") + end + + # Returns Auth Settings hash for api client. + def auth_settings + { + } + end + + # Returns an array of Server setting + def server_settings + [ + { + url: "https://example.com", + description: "No description provided", + } + ] + end + + def operation_server_settings + { + } + end + + # Returns URL based on server settings + # + # @param index array index of the server settings + # @param variables hash of variable and the corresponding value + def server_url(index, variables = {}, servers = nil) + servers = server_settings if servers == nil + + # check array index out of bound + if (index.nil? || index < 0 || index >= servers.size) + fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}" + end + + server = servers[index] + url = server[:url] + + return url unless server.key? :variables + + # go through variable and assign a value + server[:variables].each do |name, variable| + if variables.key?(name) + if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name])) + url.gsub! "{" + name.to_s + "}", variables[name] + else + fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}." + end + else + # use default value + url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] + end + end + + url + end + + end +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/account_link_event.rb b/lib/clients/webhook/lib/line_client_webhook/models/account_link_event.rb new file mode 100644 index 00000000..bfa307df --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/account_link_event.rb @@ -0,0 +1,270 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # Event object for when a user has linked their LINE account with a provider's service account. You can reply to account link events. + class AccountLinkEvent < Event + # Reply token used to send reply message to this event. This property won't be included if linking the account has failed. + attr_accessor :reply_token + + attr_accessor :link + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'reply_token' => :'replyToken', + :'link' => :'link' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'reply_token' => :'String', + :'link' => :'LinkContent' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Event' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::AccountLinkEvent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::AccountLinkEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'reply_token') + self.reply_token = attributes[:'reply_token'] + end + + if attributes.key?(:'link') + self.link = attributes[:'link'] + else + self.link = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @link.nil? + invalid_properties.push('invalid value for "link", link cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @link.nil? + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + reply_token == o.reply_token && + link == o.link && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [reply_token, link].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/account_link_event_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/account_link_event_all_of.rb new file mode 100644 index 00000000..449f69a0 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/account_link_event_all_of.rb @@ -0,0 +1,234 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class AccountLinkEventAllOf + # Reply token used to send reply message to this event. This property won't be included if linking the account has failed. + attr_accessor :reply_token + + attr_accessor :link + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'reply_token' => :'replyToken', + :'link' => :'link' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'reply_token' => :'String', + :'link' => :'LinkContent' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::AccountLinkEventAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::AccountLinkEventAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'reply_token') + self.reply_token = attributes[:'reply_token'] + end + + if attributes.key?(:'link') + self.link = attributes[:'link'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @link.nil? + invalid_properties.push('invalid value for "link", link cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @link.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + reply_token == o.reply_token && + link == o.link + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [reply_token, link].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/action_result.rb b/lib/clients/webhook/lib/line_client_webhook/models/action_result.rb new file mode 100644 index 00000000..f1339040 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/action_result.rb @@ -0,0 +1,270 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class ActionResult + attr_accessor :type + + # Base64-encoded binary data + attr_accessor :data + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'data' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::ActionResult` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::ActionResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = nil + end + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @type.nil? + type_validator = EnumAttributeValidator.new('String', ["void", "binary"]) + return false unless type_validator.valid?(@type) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] type Object to be assigned + def type=(type) + validator = EnumAttributeValidator.new('String', ["void", "binary"]) + unless validator.valid?(type) + fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/activated_event.rb b/lib/clients/webhook/lib/line_client_webhook/models/activated_event.rb new file mode 100644 index 00000000..6caf2328 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/activated_event.rb @@ -0,0 +1,260 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # This event indicates that the module channel has been switched to Active Channel by calling the Acquire Control API. Sent to the webhook URL server of the module channel. + class ActivatedEvent < Event + attr_accessor :chat_control + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'chat_control' => :'chatControl' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'chat_control' => :'ChatControl' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Event' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::ActivatedEvent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::ActivatedEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'chat_control') + self.chat_control = attributes[:'chat_control'] + else + self.chat_control = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @chat_control.nil? + invalid_properties.push('invalid value for "chat_control", chat_control cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @chat_control.nil? + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + chat_control == o.chat_control && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [chat_control].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/activated_event_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/activated_event_all_of.rb new file mode 100644 index 00000000..d7dfa9e5 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/activated_event_all_of.rb @@ -0,0 +1,224 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class ActivatedEventAllOf + attr_accessor :chat_control + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'chat_control' => :'chatControl' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'chat_control' => :'ChatControl' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::ActivatedEventAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::ActivatedEventAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'chat_control') + self.chat_control = attributes[:'chat_control'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @chat_control.nil? + invalid_properties.push('invalid value for "chat_control", chat_control cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @chat_control.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + chat_control == o.chat_control + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [chat_control].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/all_mentionee.rb b/lib/clients/webhook/lib/line_client_webhook/models/all_mentionee.rb new file mode 100644 index 00000000..892bebb1 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/all_mentionee.rb @@ -0,0 +1,222 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # Mentioned target is entire group + class AllMentionee < Mentionee + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Mentionee' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::AllMentionee` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::AllMentionee`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/attached_module_content.rb b/lib/clients/webhook/lib/line_client_webhook/models/attached_module_content.rb new file mode 100644 index 00000000..a0d2e7e8 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/attached_module_content.rb @@ -0,0 +1,257 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class AttachedModuleContent < ModuleContent + # User ID of the bot on the attached LINE Official Account + attr_accessor :bot_id + + # An array of strings indicating the scope permitted by the admin of the LINE Official Account. + attr_accessor :scopes + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'bot_id' => :'botId', + :'scopes' => :'scopes' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'bot_id' => :'String', + :'scopes' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ModuleContent' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::AttachedModuleContent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::AttachedModuleContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'bot_id') + self.bot_id = attributes[:'bot_id'] + else + self.bot_id = nil + end + + if attributes.key?(:'scopes') + if (value = attributes[:'scopes']).is_a?(Array) + self.scopes = value + end + else + self.scopes = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @bot_id.nil? + invalid_properties.push('invalid value for "bot_id", bot_id cannot be nil.') + end + + if @scopes.nil? + invalid_properties.push('invalid value for "scopes", scopes cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @bot_id.nil? + return false if @scopes.nil? + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + bot_id == o.bot_id && + scopes == o.scopes && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [bot_id, scopes].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/attached_module_content_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/attached_module_content_all_of.rb new file mode 100644 index 00000000..2f757348 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/attached_module_content_all_of.rb @@ -0,0 +1,242 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class AttachedModuleContentAllOf + # User ID of the bot on the attached LINE Official Account + attr_accessor :bot_id + + # An array of strings indicating the scope permitted by the admin of the LINE Official Account. + attr_accessor :scopes + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'bot_id' => :'botId', + :'scopes' => :'scopes' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'bot_id' => :'String', + :'scopes' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::AttachedModuleContentAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::AttachedModuleContentAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'bot_id') + self.bot_id = attributes[:'bot_id'] + end + + if attributes.key?(:'scopes') + if (value = attributes[:'scopes']).is_a?(Array) + self.scopes = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @bot_id.nil? + invalid_properties.push('invalid value for "bot_id", bot_id cannot be nil.') + end + + if @scopes.nil? + invalid_properties.push('invalid value for "scopes", scopes cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @bot_id.nil? + return false if @scopes.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + bot_id == o.bot_id && + scopes == o.scopes + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [bot_id, scopes].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/audio_message_content.rb b/lib/clients/webhook/lib/line_client_webhook/models/audio_message_content.rb new file mode 100644 index 00000000..8eabaa0d --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/audio_message_content.rb @@ -0,0 +1,264 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class AudioMessageContent < MessageContent + # Message ID + attr_accessor :id + + attr_accessor :content_provider + + # Length of audio file (milliseconds) + attr_accessor :duration + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'content_provider' => :'contentProvider', + :'duration' => :'duration' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'content_provider' => :'ContentProvider', + :'duration' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'MessageContent' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::AudioMessageContent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::AudioMessageContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'content_provider') + self.content_provider = attributes[:'content_provider'] + else + self.content_provider = nil + end + + if attributes.key?(:'duration') + self.duration = attributes[:'duration'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @content_provider.nil? + invalid_properties.push('invalid value for "content_provider", content_provider cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @content_provider.nil? + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + content_provider == o.content_provider && + duration == o.duration && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, content_provider, duration].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/audio_message_content_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/audio_message_content_all_of.rb new file mode 100644 index 00000000..6223ee28 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/audio_message_content_all_of.rb @@ -0,0 +1,250 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # Message object which contains the audio content sent from the source. + class AudioMessageContentAllOf + # Message ID + attr_accessor :id + + attr_accessor :content_provider + + # Length of audio file (milliseconds) + attr_accessor :duration + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'content_provider' => :'contentProvider', + :'duration' => :'duration' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'content_provider' => :'ContentProvider', + :'duration' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::AudioMessageContentAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::AudioMessageContentAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'content_provider') + self.content_provider = attributes[:'content_provider'] + end + + if attributes.key?(:'duration') + self.duration = attributes[:'duration'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @content_provider.nil? + invalid_properties.push('invalid value for "content_provider", content_provider cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @content_provider.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + content_provider == o.content_provider && + duration == o.duration + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, content_provider, duration].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/beacon_content.rb b/lib/clients/webhook/lib/line_client_webhook/models/beacon_content.rb new file mode 100644 index 00000000..7f4a0889 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/beacon_content.rb @@ -0,0 +1,288 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class BeaconContent + # Hardware ID of the beacon that was detected + attr_accessor :hwid + + # Type of beacon event. + attr_accessor :type + + # Device message of beacon that was detected. + attr_accessor :dm + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'hwid' => :'hwid', + :'type' => :'type', + :'dm' => :'dm' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'hwid' => :'String', + :'type' => :'String', + :'dm' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::BeaconContent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::BeaconContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'hwid') + self.hwid = attributes[:'hwid'] + else + self.hwid = nil + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = nil + end + + if attributes.key?(:'dm') + self.dm = attributes[:'dm'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @hwid.nil? + invalid_properties.push('invalid value for "hwid", hwid cannot be nil.') + end + + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @hwid.nil? + return false if @type.nil? + type_validator = EnumAttributeValidator.new('String', ["enter", "banner", "stay"]) + return false unless type_validator.valid?(@type) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] type Object to be assigned + def type=(type) + validator = EnumAttributeValidator.new('String', ["enter", "banner", "stay"]) + unless validator.valid?(type) + fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + hwid == o.hwid && + type == o.type && + dm == o.dm + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [hwid, type, dm].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/beacon_event.rb b/lib/clients/webhook/lib/line_client_webhook/models/beacon_event.rb new file mode 100644 index 00000000..1fd49324 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/beacon_event.rb @@ -0,0 +1,277 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # Event object for when a user enters the range of a LINE Beacon. You can reply to beacon events. + class BeaconEvent < Event + # Reply token used to send reply message to this event + attr_accessor :reply_token + + attr_accessor :beacon + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'reply_token' => :'replyToken', + :'beacon' => :'beacon' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'reply_token' => :'String', + :'beacon' => :'BeaconContent' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Event' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::BeaconEvent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::BeaconEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'reply_token') + self.reply_token = attributes[:'reply_token'] + else + self.reply_token = nil + end + + if attributes.key?(:'beacon') + self.beacon = attributes[:'beacon'] + else + self.beacon = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @reply_token.nil? + invalid_properties.push('invalid value for "reply_token", reply_token cannot be nil.') + end + + if @beacon.nil? + invalid_properties.push('invalid value for "beacon", beacon cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @reply_token.nil? + return false if @beacon.nil? + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + reply_token == o.reply_token && + beacon == o.beacon && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [reply_token, beacon].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/beacon_event_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/beacon_event_all_of.rb new file mode 100644 index 00000000..61ed466c --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/beacon_event_all_of.rb @@ -0,0 +1,239 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class BeaconEventAllOf + # Reply token used to send reply message to this event + attr_accessor :reply_token + + attr_accessor :beacon + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'reply_token' => :'replyToken', + :'beacon' => :'beacon' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'reply_token' => :'String', + :'beacon' => :'BeaconContent' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::BeaconEventAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::BeaconEventAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'reply_token') + self.reply_token = attributes[:'reply_token'] + end + + if attributes.key?(:'beacon') + self.beacon = attributes[:'beacon'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @reply_token.nil? + invalid_properties.push('invalid value for "reply_token", reply_token cannot be nil.') + end + + if @beacon.nil? + invalid_properties.push('invalid value for "beacon", beacon cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @reply_token.nil? + return false if @beacon.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + reply_token == o.reply_token && + beacon == o.beacon + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [reply_token, beacon].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/bot_resumed_event.rb b/lib/clients/webhook/lib/line_client_webhook/models/bot_resumed_event.rb new file mode 100644 index 00000000..ac75d580 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/bot_resumed_event.rb @@ -0,0 +1,244 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # This event indicates that the LINE Official Account has returned from the suspended state. Sent to the webhook URL server of the module channel. + class BotResumedEvent < Event + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Event' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::BotResumedEvent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::BotResumedEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/bot_suspended_event.rb b/lib/clients/webhook/lib/line_client_webhook/models/bot_suspended_event.rb new file mode 100644 index 00000000..361f67f1 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/bot_suspended_event.rb @@ -0,0 +1,244 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # This event indicates that the LINE Official Account has been suspended (Suspend). Sent to the webhook URL server of the module channel. + class BotSuspendedEvent < Event + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Event' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::BotSuspendedEvent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::BotSuspendedEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/callback_request.rb b/lib/clients/webhook/lib/line_client_webhook/models/callback_request.rb new file mode 100644 index 00000000..4ca6fb4e --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/callback_request.rb @@ -0,0 +1,272 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # The request body contains a JSON object with the user ID of a bot that should receive webhook events and an array of webhook event objects. + class CallbackRequest + # User ID of a bot that should receive webhook events. The user ID value is a string that matches the regular expression, `U[0-9a-f]{32}`. + attr_accessor :destination + + # Array of webhook event objects. The LINE Platform may send an empty array that doesn't include a webhook event object to confirm communication. + attr_accessor :events + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'destination' => :'destination', + :'events' => :'events' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'destination' => :'String', + :'events' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::CallbackRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::CallbackRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'destination') + self.destination = attributes[:'destination'] + end + + if attributes.key?(:'events') + if (value = attributes[:'events']).is_a?(Array) + self.events = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@destination.nil? && @destination.to_s.length > 33 + invalid_properties.push('invalid value for "destination", the character length must be smaller than or equal to 33.') + end + + if !@destination.nil? && @destination.to_s.length < 33 + invalid_properties.push('invalid value for "destination", the character length must be great than or equal to 33.') + end + + pattern = Regexp.new(/^U[0-9a-f]{32}$/) + if !@destination.nil? && @destination !~ pattern + invalid_properties.push("invalid value for \"destination\", must conform to the pattern #{pattern}.") + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@destination.nil? && @destination.to_s.length > 33 + return false if !@destination.nil? && @destination.to_s.length < 33 + return false if !@destination.nil? && @destination !~ Regexp.new(/^U[0-9a-f]{32}$/) + true + end + + # Custom attribute writer method with validation + # @param [Object] destination Value to be assigned + def destination=(destination) + if destination.nil? + fail ArgumentError, 'destination cannot be nil' + end + + if destination.to_s.length > 33 + fail ArgumentError, 'invalid value for "destination", the character length must be smaller than or equal to 33.' + end + + if destination.to_s.length < 33 + fail ArgumentError, 'invalid value for "destination", the character length must be great than or equal to 33.' + end + + pattern = Regexp.new(/^U[0-9a-f]{32}$/) + if destination !~ pattern + fail ArgumentError, "invalid value for \"destination\", must conform to the pattern #{pattern}." + end + + @destination = destination + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + destination == o.destination && + events == o.events + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [destination, events].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/chat_control.rb b/lib/clients/webhook/lib/line_client_webhook/models/chat_control.rb new file mode 100644 index 00000000..c0bebed5 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/chat_control.rb @@ -0,0 +1,226 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class ChatControl + attr_accessor :expire_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'expire_at' => :'expireAt' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'expire_at' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::ChatControl` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::ChatControl`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'expire_at') + self.expire_at = attributes[:'expire_at'] + else + self.expire_at = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @expire_at.nil? + invalid_properties.push('invalid value for "expire_at", expire_at cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @expire_at.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + expire_at == o.expire_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [expire_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/content_provider.rb b/lib/clients/webhook/lib/line_client_webhook/models/content_provider.rb new file mode 100644 index 00000000..cc478801 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/content_provider.rb @@ -0,0 +1,282 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # Provider of the media file. + class ContentProvider + # Provider of the image file. + attr_accessor :type + + # URL of the image file. Only included when contentProvider.type is external. + attr_accessor :original_content_url + + # URL of the preview image. Only included when contentProvider.type is external. + attr_accessor :preview_image_url + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'original_content_url' => :'originalContentUrl', + :'preview_image_url' => :'previewImageUrl' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'original_content_url' => :'String', + :'preview_image_url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::ContentProvider` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::ContentProvider`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + else + self.type = nil + end + + if attributes.key?(:'original_content_url') + self.original_content_url = attributes[:'original_content_url'] + end + + if attributes.key?(:'preview_image_url') + self.preview_image_url = attributes[:'preview_image_url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @type.nil? + type_validator = EnumAttributeValidator.new('String', ["line", "external"]) + return false unless type_validator.valid?(@type) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] type Object to be assigned + def type=(type) + validator = EnumAttributeValidator.new('String', ["line", "external"]) + unless validator.valid?(type) + fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + original_content_url == o.original_content_url && + preview_image_url == o.preview_image_url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, original_content_url, preview_image_url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/deactivated_event.rb b/lib/clients/webhook/lib/line_client_webhook/models/deactivated_event.rb new file mode 100644 index 00000000..2587ecbb --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/deactivated_event.rb @@ -0,0 +1,244 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # This event indicates that the module channel has been switched to Standby Channel by calling Acquire Control API or Release Control API. Sent to the webhook URL server of the module channel. + class DeactivatedEvent < Event + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Event' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::DeactivatedEvent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::DeactivatedEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/delivery_context.rb b/lib/clients/webhook/lib/line_client_webhook/models/delivery_context.rb new file mode 100644 index 00000000..0dda6914 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/delivery_context.rb @@ -0,0 +1,228 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # webhook's delivery context information + class DeliveryContext + # Whether the webhook event is a redelivered one or not. + attr_accessor :is_redelivery + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'is_redelivery' => :'isRedelivery' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'is_redelivery' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::DeliveryContext` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::DeliveryContext`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'is_redelivery') + self.is_redelivery = attributes[:'is_redelivery'] + else + self.is_redelivery = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @is_redelivery.nil? + invalid_properties.push('invalid value for "is_redelivery", is_redelivery cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @is_redelivery.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + is_redelivery == o.is_redelivery + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [is_redelivery].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/detached_module_content.rb b/lib/clients/webhook/lib/line_client_webhook/models/detached_module_content.rb new file mode 100644 index 00000000..a32385e7 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/detached_module_content.rb @@ -0,0 +1,289 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class DetachedModuleContent < ModuleContent + # Detached LINE Official Account bot user ID + attr_accessor :bot_id + + # Reason for detaching + attr_accessor :reason + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'bot_id' => :'botId', + :'reason' => :'reason' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'bot_id' => :'String', + :'reason' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ModuleContent' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::DetachedModuleContent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::DetachedModuleContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'bot_id') + self.bot_id = attributes[:'bot_id'] + else + self.bot_id = nil + end + + if attributes.key?(:'reason') + self.reason = attributes[:'reason'] + else + self.reason = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @bot_id.nil? + invalid_properties.push('invalid value for "bot_id", bot_id cannot be nil.') + end + + if @reason.nil? + invalid_properties.push('invalid value for "reason", reason cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @bot_id.nil? + return false if @reason.nil? + reason_validator = EnumAttributeValidator.new('String', ["bot_deleted"]) + return false unless reason_validator.valid?(@reason) + true && super + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] reason Object to be assigned + def reason=(reason) + validator = EnumAttributeValidator.new('String', ["bot_deleted"]) + unless validator.valid?(reason) + fail ArgumentError, "invalid value for \"reason\", must be one of #{validator.allowable_values}." + end + @reason = reason + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + bot_id == o.bot_id && + reason == o.reason && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [bot_id, reason].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/detached_module_content_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/detached_module_content_all_of.rb new file mode 100644 index 00000000..6210c625 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/detached_module_content_all_of.rb @@ -0,0 +1,274 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class DetachedModuleContentAllOf + # Detached LINE Official Account bot user ID + attr_accessor :bot_id + + # Reason for detaching + attr_accessor :reason + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'bot_id' => :'botId', + :'reason' => :'reason' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'bot_id' => :'String', + :'reason' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::DetachedModuleContentAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::DetachedModuleContentAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'bot_id') + self.bot_id = attributes[:'bot_id'] + end + + if attributes.key?(:'reason') + self.reason = attributes[:'reason'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @bot_id.nil? + invalid_properties.push('invalid value for "bot_id", bot_id cannot be nil.') + end + + if @reason.nil? + invalid_properties.push('invalid value for "reason", reason cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @bot_id.nil? + return false if @reason.nil? + reason_validator = EnumAttributeValidator.new('String', ["bot_deleted"]) + return false unless reason_validator.valid?(@reason) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] reason Object to be assigned + def reason=(reason) + validator = EnumAttributeValidator.new('String', ["bot_deleted"]) + unless validator.valid?(reason) + fail ArgumentError, "invalid value for \"reason\", must be one of #{validator.allowable_values}." + end + @reason = reason + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + bot_id == o.bot_id && + reason == o.reason + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [bot_id, reason].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/emoji.rb b/lib/clients/webhook/lib/line_client_webhook/models/emoji.rb new file mode 100644 index 00000000..854ea741 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/emoji.rb @@ -0,0 +1,278 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class Emoji + # Index position for a character in text, with the first character being at position 0. + attr_accessor :index + + # The length of the LINE emoji string. For LINE emoji (hello), 7 is the length. + attr_accessor :length + + # Product ID for a LINE emoji set. + attr_accessor :product_id + + # ID for a LINE emoji inside a set. + attr_accessor :emoji_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'index' => :'index', + :'length' => :'length', + :'product_id' => :'productId', + :'emoji_id' => :'emojiId' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'index' => :'Integer', + :'length' => :'Integer', + :'product_id' => :'String', + :'emoji_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::Emoji` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::Emoji`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'index') + self.index = attributes[:'index'] + else + self.index = nil + end + + if attributes.key?(:'length') + self.length = attributes[:'length'] + else + self.length = nil + end + + if attributes.key?(:'product_id') + self.product_id = attributes[:'product_id'] + else + self.product_id = nil + end + + if attributes.key?(:'emoji_id') + self.emoji_id = attributes[:'emoji_id'] + else + self.emoji_id = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @index.nil? + invalid_properties.push('invalid value for "index", index cannot be nil.') + end + + if @length.nil? + invalid_properties.push('invalid value for "length", length cannot be nil.') + end + + if @product_id.nil? + invalid_properties.push('invalid value for "product_id", product_id cannot be nil.') + end + + if @emoji_id.nil? + invalid_properties.push('invalid value for "emoji_id", emoji_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @index.nil? + return false if @length.nil? + return false if @product_id.nil? + return false if @emoji_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + index == o.index && + length == o.length && + product_id == o.product_id && + emoji_id == o.emoji_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [index, length, product_id, emoji_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/event.rb b/lib/clients/webhook/lib/line_client_webhook/models/event.rb new file mode 100644 index 00000000..f1748a08 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/event.rb @@ -0,0 +1,323 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # Webhook event + class Event + # Type of the event + attr_accessor :type + + attr_accessor :source + + # Time of the event in milliseconds. + attr_accessor :timestamp + + attr_accessor :mode + + # Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format. + attr_accessor :webhook_event_id + + attr_accessor :delivery_context + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'source' => :'source', + :'timestamp' => :'timestamp', + :'mode' => :'mode', + :'webhook_event_id' => :'webhookEventId', + :'delivery_context' => :'deliveryContext' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'source' => :'Source', + :'timestamp' => :'Integer', + :'mode' => :'EventMode', + :'webhook_event_id' => :'String', + :'delivery_context' => :'DeliveryContext' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # discriminator's property name in OpenAPI v3 + def self.openapi_discriminator_name + :'type' + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::Event` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::Event`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'source') + self.source = attributes[:'source'] + end + + if attributes.key?(:'timestamp') + self.timestamp = attributes[:'timestamp'] + else + self.timestamp = nil + end + + if attributes.key?(:'mode') + self.mode = attributes[:'mode'] + else + self.mode = nil + end + + if attributes.key?(:'webhook_event_id') + self.webhook_event_id = attributes[:'webhook_event_id'] + else + self.webhook_event_id = nil + end + + if attributes.key?(:'delivery_context') + self.delivery_context = attributes[:'delivery_context'] + else + self.delivery_context = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @timestamp.nil? + invalid_properties.push('invalid value for "timestamp", timestamp cannot be nil.') + end + + if @mode.nil? + invalid_properties.push('invalid value for "mode", mode cannot be nil.') + end + + if @webhook_event_id.nil? + invalid_properties.push('invalid value for "webhook_event_id", webhook_event_id cannot be nil.') + end + + if @delivery_context.nil? + invalid_properties.push('invalid value for "delivery_context", delivery_context cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @timestamp.nil? + return false if @mode.nil? + return false if @webhook_event_id.nil? + return false if @delivery_context.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + source == o.source && + timestamp == o.timestamp && + mode == o.mode && + webhook_event_id == o.webhook_event_id && + delivery_context == o.delivery_context + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, source, timestamp, mode, webhook_event_id, delivery_context].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/event_mode.rb b/lib/clients/webhook/lib/line_client_webhook/models/event_mode.rb new file mode 100644 index 00000000..a07cd6f0 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/event_mode.rb @@ -0,0 +1,40 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class EventMode + ACTIVE = "active".freeze + STANDBY = "standby".freeze + + def self.all_vars + @all_vars ||= [ACTIVE, STANDBY].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if EventMode.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #EventMode" + end + end +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/file_message_content.rb b/lib/clients/webhook/lib/line_client_webhook/models/file_message_content.rb new file mode 100644 index 00000000..243603e1 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/file_message_content.rb @@ -0,0 +1,272 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class FileMessageContent < MessageContent + # Message ID + attr_accessor :id + + # File name + attr_accessor :file_name + + # File size in bytes + attr_accessor :file_size + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'file_name' => :'fileName', + :'file_size' => :'fileSize' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'file_name' => :'String', + :'file_size' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'MessageContent' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::FileMessageContent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::FileMessageContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'file_name') + self.file_name = attributes[:'file_name'] + else + self.file_name = nil + end + + if attributes.key?(:'file_size') + self.file_size = attributes[:'file_size'] + else + self.file_size = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @file_name.nil? + invalid_properties.push('invalid value for "file_name", file_name cannot be nil.') + end + + if @file_size.nil? + invalid_properties.push('invalid value for "file_size", file_size cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @file_name.nil? + return false if @file_size.nil? + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + file_name == o.file_name && + file_size == o.file_size && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, file_name, file_size].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/file_message_content_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/file_message_content_all_of.rb new file mode 100644 index 00000000..64383461 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/file_message_content_all_of.rb @@ -0,0 +1,256 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # Message object which contains the file sent from the source. + class FileMessageContentAllOf + # Message ID + attr_accessor :id + + # File name + attr_accessor :file_name + + # File size in bytes + attr_accessor :file_size + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'file_name' => :'fileName', + :'file_size' => :'fileSize' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'file_name' => :'String', + :'file_size' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::FileMessageContentAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::FileMessageContentAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'file_name') + self.file_name = attributes[:'file_name'] + end + + if attributes.key?(:'file_size') + self.file_size = attributes[:'file_size'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @file_name.nil? + invalid_properties.push('invalid value for "file_name", file_name cannot be nil.') + end + + if @file_size.nil? + invalid_properties.push('invalid value for "file_size", file_size cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @file_name.nil? + return false if @file_size.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + file_name == o.file_name && + file_size == o.file_size + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, file_name, file_size].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/follow_event.rb b/lib/clients/webhook/lib/line_client_webhook/models/follow_event.rb new file mode 100644 index 00000000..988f29e8 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/follow_event.rb @@ -0,0 +1,261 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # Event object for when your LINE Official Account is added as a friend (or unblocked). You can reply to follow events. + class FollowEvent < Event + # Reply token used to send reply message to this event + attr_accessor :reply_token + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'reply_token' => :'replyToken' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'reply_token' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Event' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::FollowEvent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::FollowEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'reply_token') + self.reply_token = attributes[:'reply_token'] + else + self.reply_token = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @reply_token.nil? + invalid_properties.push('invalid value for "reply_token", reply_token cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @reply_token.nil? + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + reply_token == o.reply_token && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [reply_token].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/follow_event_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/follow_event_all_of.rb new file mode 100644 index 00000000..eee93f87 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/follow_event_all_of.rb @@ -0,0 +1,225 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class FollowEventAllOf + # Reply token used to send reply message to this event + attr_accessor :reply_token + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'reply_token' => :'replyToken' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'reply_token' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::FollowEventAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::FollowEventAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'reply_token') + self.reply_token = attributes[:'reply_token'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @reply_token.nil? + invalid_properties.push('invalid value for "reply_token", reply_token cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @reply_token.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + reply_token == o.reply_token + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [reply_token].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/group_source.rb b/lib/clients/webhook/lib/line_client_webhook/models/group_source.rb new file mode 100644 index 00000000..a334cfc6 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/group_source.rb @@ -0,0 +1,248 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class GroupSource < Source + # Group ID of the source group chat + attr_accessor :group_id + + # ID of the source user. Only included in message events. Only users of LINE for iOS and LINE for Android are included in userId. + attr_accessor :user_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'group_id' => :'groupId', + :'user_id' => :'userId' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'group_id' => :'String', + :'user_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Source' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::GroupSource` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::GroupSource`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'group_id') + self.group_id = attributes[:'group_id'] + else + self.group_id = nil + end + + if attributes.key?(:'user_id') + self.user_id = attributes[:'user_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @group_id.nil? + invalid_properties.push('invalid value for "group_id", group_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @group_id.nil? + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + group_id == o.group_id && + user_id == o.user_id && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [group_id, user_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/group_source_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/group_source_all_of.rb new file mode 100644 index 00000000..d3354b06 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/group_source_all_of.rb @@ -0,0 +1,235 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class GroupSourceAllOf + # Group ID of the source group chat + attr_accessor :group_id + + # ID of the source user. Only included in message events. Only users of LINE for iOS and LINE for Android are included in userId. + attr_accessor :user_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'group_id' => :'groupId', + :'user_id' => :'userId' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'group_id' => :'String', + :'user_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::GroupSourceAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::GroupSourceAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'group_id') + self.group_id = attributes[:'group_id'] + end + + if attributes.key?(:'user_id') + self.user_id = attributes[:'user_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @group_id.nil? + invalid_properties.push('invalid value for "group_id", group_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @group_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + group_id == o.group_id && + user_id == o.user_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [group_id, user_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/image_message_content.rb b/lib/clients/webhook/lib/line_client_webhook/models/image_message_content.rb new file mode 100644 index 00000000..b5424922 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/image_message_content.rb @@ -0,0 +1,280 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class ImageMessageContent < MessageContent + # Message ID + attr_accessor :id + + attr_accessor :content_provider + + attr_accessor :image_set + + # Quote token to quote this message. + attr_accessor :quote_token + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'content_provider' => :'contentProvider', + :'image_set' => :'imageSet', + :'quote_token' => :'quoteToken' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'content_provider' => :'ContentProvider', + :'image_set' => :'ImageSet', + :'quote_token' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'MessageContent' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::ImageMessageContent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::ImageMessageContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'content_provider') + self.content_provider = attributes[:'content_provider'] + else + self.content_provider = nil + end + + if attributes.key?(:'image_set') + self.image_set = attributes[:'image_set'] + end + + if attributes.key?(:'quote_token') + self.quote_token = attributes[:'quote_token'] + else + self.quote_token = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @content_provider.nil? + invalid_properties.push('invalid value for "content_provider", content_provider cannot be nil.') + end + + if @quote_token.nil? + invalid_properties.push('invalid value for "quote_token", quote_token cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @content_provider.nil? + return false if @quote_token.nil? + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + content_provider == o.content_provider && + image_set == o.image_set && + quote_token == o.quote_token && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, content_provider, image_set, quote_token].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/image_message_content_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/image_message_content_all_of.rb new file mode 100644 index 00000000..349b2897 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/image_message_content_all_of.rb @@ -0,0 +1,248 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class ImageMessageContentAllOf + # Message ID + attr_accessor :id + + attr_accessor :content_provider + + attr_accessor :image_set + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'content_provider' => :'contentProvider', + :'image_set' => :'imageSet' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'content_provider' => :'ContentProvider', + :'image_set' => :'ImageSet' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::ImageMessageContentAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::ImageMessageContentAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'content_provider') + self.content_provider = attributes[:'content_provider'] + end + + if attributes.key?(:'image_set') + self.image_set = attributes[:'image_set'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @content_provider.nil? + invalid_properties.push('invalid value for "content_provider", content_provider cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @content_provider.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + content_provider == o.content_provider && + image_set == o.image_set + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, content_provider, image_set].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/image_set.rb b/lib/clients/webhook/lib/line_client_webhook/models/image_set.rb new file mode 100644 index 00000000..09d65cdb --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/image_set.rb @@ -0,0 +1,240 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class ImageSet + # Image set ID. Only included when multiple images are sent simultaneously. + attr_accessor :id + + # An index starting from 1, indicating the image number in a set of images sent simultaneously. Only included when multiple images are sent simultaneously. However, it won't be included if the sender is using LINE 11.15 or earlier for Android. + attr_accessor :index + + # The total number of images sent simultaneously. + attr_accessor :total + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'index' => :'index', + :'total' => :'total' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'index' => :'Integer', + :'total' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::ImageSet` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::ImageSet`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'index') + self.index = attributes[:'index'] + end + + if attributes.key?(:'total') + self.total = attributes[:'total'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + index == o.index && + total == o.total + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, index, total].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/join_event.rb b/lib/clients/webhook/lib/line_client_webhook/models/join_event.rb new file mode 100644 index 00000000..3a09bc74 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/join_event.rb @@ -0,0 +1,261 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # Event object for when your LINE Official Account joins a group chat or multi-person chat. You can reply to join events. + class JoinEvent < Event + # Reply token used to send reply message to this event + attr_accessor :reply_token + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'reply_token' => :'replyToken' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'reply_token' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Event' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::JoinEvent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::JoinEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'reply_token') + self.reply_token = attributes[:'reply_token'] + else + self.reply_token = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @reply_token.nil? + invalid_properties.push('invalid value for "reply_token", reply_token cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @reply_token.nil? + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + reply_token == o.reply_token && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [reply_token].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/joined_members.rb b/lib/clients/webhook/lib/line_client_webhook/models/joined_members.rb new file mode 100644 index 00000000..f022fa84 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/joined_members.rb @@ -0,0 +1,229 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class JoinedMembers + # Users who joined. Array of source user objects. + attr_accessor :members + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'members' => :'members' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'members' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::JoinedMembers` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::JoinedMembers`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'members') + if (value = attributes[:'members']).is_a?(Array) + self.members = value + end + else + self.members = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @members.nil? + invalid_properties.push('invalid value for "members", members cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @members.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + members == o.members + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [members].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/leave_event.rb b/lib/clients/webhook/lib/line_client_webhook/models/leave_event.rb new file mode 100644 index 00000000..702c9753 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/leave_event.rb @@ -0,0 +1,244 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # Event object for when a user removes your LINE Official Account from a group chat or when your LINE Official Account leaves a group chat or multi-person chat. + class LeaveEvent < Event + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Event' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::LeaveEvent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::LeaveEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/left_members.rb b/lib/clients/webhook/lib/line_client_webhook/models/left_members.rb new file mode 100644 index 00000000..95d950d4 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/left_members.rb @@ -0,0 +1,229 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class LeftMembers + # Users who left. Array of source user objects. + attr_accessor :members + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'members' => :'members' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'members' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::LeftMembers` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::LeftMembers`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'members') + if (value = attributes[:'members']).is_a?(Array) + self.members = value + end + else + self.members = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @members.nil? + invalid_properties.push('invalid value for "members", members cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @members.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + members == o.members + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [members].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/link_content.rb b/lib/clients/webhook/lib/line_client_webhook/models/link_content.rb new file mode 100644 index 00000000..2dc032c7 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/link_content.rb @@ -0,0 +1,279 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # Content of the account link event. + class LinkContent + # One of the following values to indicate whether linking the account was successful or not + attr_accessor :result + + # Specified nonce (number used once) when verifying the user ID. + attr_accessor :nonce + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'result' => :'result', + :'nonce' => :'nonce' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'result' => :'String', + :'nonce' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::LinkContent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::LinkContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'result') + self.result = attributes[:'result'] + else + self.result = nil + end + + if attributes.key?(:'nonce') + self.nonce = attributes[:'nonce'] + else + self.nonce = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @result.nil? + invalid_properties.push('invalid value for "result", result cannot be nil.') + end + + if @nonce.nil? + invalid_properties.push('invalid value for "nonce", nonce cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @result.nil? + result_validator = EnumAttributeValidator.new('String', ["ok", "failed"]) + return false unless result_validator.valid?(@result) + return false if @nonce.nil? + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] result Object to be assigned + def result=(result) + validator = EnumAttributeValidator.new('String', ["ok", "failed"]) + unless validator.valid?(result) + fail ArgumentError, "invalid value for \"result\", must be one of #{validator.allowable_values}." + end + @result = result + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + result == o.result && + nonce == o.nonce + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [result, nonce].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/link_things_content.rb b/lib/clients/webhook/lib/line_client_webhook/models/link_things_content.rb new file mode 100644 index 00000000..1663890c --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/link_things_content.rb @@ -0,0 +1,238 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class LinkThingsContent < ThingsContent + # Device ID of the device that has been linked with LINE. + attr_accessor :device_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'device_id' => :'deviceId' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'device_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ThingsContent' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::LinkThingsContent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::LinkThingsContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'device_id') + self.device_id = attributes[:'device_id'] + else + self.device_id = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @device_id.nil? + invalid_properties.push('invalid value for "device_id", device_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @device_id.nil? + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + device_id == o.device_id && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [device_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/link_things_content_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/link_things_content_all_of.rb new file mode 100644 index 00000000..63c0b2fa --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/link_things_content_all_of.rb @@ -0,0 +1,226 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # Indicates that a user linked a device with LINE. + class LinkThingsContentAllOf + # Device ID of the device that has been linked with LINE. + attr_accessor :device_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'device_id' => :'deviceId' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'device_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::LinkThingsContentAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::LinkThingsContentAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'device_id') + self.device_id = attributes[:'device_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @device_id.nil? + invalid_properties.push('invalid value for "device_id", device_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @device_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + device_id == o.device_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [device_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/location_message_content.rb b/lib/clients/webhook/lib/line_client_webhook/models/location_message_content.rb new file mode 100644 index 00000000..287168b2 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/location_message_content.rb @@ -0,0 +1,292 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class LocationMessageContent < MessageContent + # Message ID + attr_accessor :id + + # Title + attr_accessor :title + + # Address + attr_accessor :address + + # Latitude + attr_accessor :latitude + + # Longitude + attr_accessor :longitude + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'title' => :'title', + :'address' => :'address', + :'latitude' => :'latitude', + :'longitude' => :'longitude' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'title' => :'String', + :'address' => :'String', + :'latitude' => :'Float', + :'longitude' => :'Float' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'MessageContent' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::LocationMessageContent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::LocationMessageContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'latitude') + self.latitude = attributes[:'latitude'] + else + self.latitude = nil + end + + if attributes.key?(:'longitude') + self.longitude = attributes[:'longitude'] + else + self.longitude = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @latitude.nil? + invalid_properties.push('invalid value for "latitude", latitude cannot be nil.') + end + + if @longitude.nil? + invalid_properties.push('invalid value for "longitude", longitude cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @latitude.nil? + return false if @longitude.nil? + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + title == o.title && + address == o.address && + latitude == o.latitude && + longitude == o.longitude && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, title, address, latitude, longitude].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/location_message_content_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/location_message_content_all_of.rb new file mode 100644 index 00000000..e93d9239 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/location_message_content_all_of.rb @@ -0,0 +1,276 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # Message object which contains the location data sent from the source. + class LocationMessageContentAllOf + # Message ID + attr_accessor :id + + # Title + attr_accessor :title + + # Address + attr_accessor :address + + # Latitude + attr_accessor :latitude + + # Longitude + attr_accessor :longitude + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'title' => :'title', + :'address' => :'address', + :'latitude' => :'latitude', + :'longitude' => :'longitude' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'title' => :'String', + :'address' => :'String', + :'latitude' => :'Float', + :'longitude' => :'Float' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::LocationMessageContentAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::LocationMessageContentAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + + if attributes.key?(:'address') + self.address = attributes[:'address'] + end + + if attributes.key?(:'latitude') + self.latitude = attributes[:'latitude'] + end + + if attributes.key?(:'longitude') + self.longitude = attributes[:'longitude'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @latitude.nil? + invalid_properties.push('invalid value for "latitude", latitude cannot be nil.') + end + + if @longitude.nil? + invalid_properties.push('invalid value for "longitude", longitude cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @latitude.nil? + return false if @longitude.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + title == o.title && + address == o.address && + latitude == o.latitude && + longitude == o.longitude + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, title, address, latitude, longitude].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/member_joined_event.rb b/lib/clients/webhook/lib/line_client_webhook/models/member_joined_event.rb new file mode 100644 index 00000000..29f4fc2a --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/member_joined_event.rb @@ -0,0 +1,277 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # Event object for when a user joins a group chat or multi-person chat that the LINE Official Account is in. + class MemberJoinedEvent < Event + # Reply token used to send reply message to this event + attr_accessor :reply_token + + attr_accessor :joined + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'reply_token' => :'replyToken', + :'joined' => :'joined' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'reply_token' => :'String', + :'joined' => :'JoinedMembers' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Event' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::MemberJoinedEvent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::MemberJoinedEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'reply_token') + self.reply_token = attributes[:'reply_token'] + else + self.reply_token = nil + end + + if attributes.key?(:'joined') + self.joined = attributes[:'joined'] + else + self.joined = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @reply_token.nil? + invalid_properties.push('invalid value for "reply_token", reply_token cannot be nil.') + end + + if @joined.nil? + invalid_properties.push('invalid value for "joined", joined cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @reply_token.nil? + return false if @joined.nil? + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + reply_token == o.reply_token && + joined == o.joined && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [reply_token, joined].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/member_joined_event_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/member_joined_event_all_of.rb new file mode 100644 index 00000000..4f1d0dc8 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/member_joined_event_all_of.rb @@ -0,0 +1,239 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class MemberJoinedEventAllOf + # Reply token used to send reply message to this event + attr_accessor :reply_token + + attr_accessor :joined + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'reply_token' => :'replyToken', + :'joined' => :'joined' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'reply_token' => :'String', + :'joined' => :'JoinedMembers' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::MemberJoinedEventAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::MemberJoinedEventAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'reply_token') + self.reply_token = attributes[:'reply_token'] + end + + if attributes.key?(:'joined') + self.joined = attributes[:'joined'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @reply_token.nil? + invalid_properties.push('invalid value for "reply_token", reply_token cannot be nil.') + end + + if @joined.nil? + invalid_properties.push('invalid value for "joined", joined cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @reply_token.nil? + return false if @joined.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + reply_token == o.reply_token && + joined == o.joined + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [reply_token, joined].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/member_left_event.rb b/lib/clients/webhook/lib/line_client_webhook/models/member_left_event.rb new file mode 100644 index 00000000..90b9cb30 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/member_left_event.rb @@ -0,0 +1,260 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # Event object for when a user leaves a group chat or multi-person chat that the LINE Official Account is in. + class MemberLeftEvent < Event + attr_accessor :left + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'left' => :'left' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'left' => :'LeftMembers' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Event' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::MemberLeftEvent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::MemberLeftEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'left') + self.left = attributes[:'left'] + else + self.left = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @left.nil? + invalid_properties.push('invalid value for "left", left cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @left.nil? + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + left == o.left && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [left].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/member_left_event_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/member_left_event_all_of.rb new file mode 100644 index 00000000..0c7189bb --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/member_left_event_all_of.rb @@ -0,0 +1,224 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class MemberLeftEventAllOf + attr_accessor :left + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'left' => :'left' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'left' => :'LeftMembers' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::MemberLeftEventAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::MemberLeftEventAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'left') + self.left = attributes[:'left'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @left.nil? + invalid_properties.push('invalid value for "left", left cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @left.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + left == o.left + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [left].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/mention.rb b/lib/clients/webhook/lib/line_client_webhook/models/mention.rb new file mode 100644 index 00000000..d52b28d0 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/mention.rb @@ -0,0 +1,229 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class Mention + # Array of one or more mention objects. Max: 20 mentions + attr_accessor :mentionees + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'mentionees' => :'mentionees' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'mentionees' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::Mention` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::Mention`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'mentionees') + if (value = attributes[:'mentionees']).is_a?(Array) + self.mentionees = value + end + else + self.mentionees = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @mentionees.nil? + invalid_properties.push('invalid value for "mentionees", mentionees cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @mentionees.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + mentionees == o.mentionees + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [mentionees].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/mentionee.rb b/lib/clients/webhook/lib/line_client_webhook/models/mentionee.rb new file mode 100644 index 00000000..81207e48 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/mentionee.rb @@ -0,0 +1,259 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class Mentionee + # Mentioned target. + attr_accessor :type + + # Index position of the user mention for a character in text, with the first character being at position 0. + attr_accessor :index + + # The length of the text of the mentioned user. For a mention @example, 8 is the length. + attr_accessor :length + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'index' => :'index', + :'length' => :'length' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String', + :'index' => :'Integer', + :'length' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # discriminator's property name in OpenAPI v3 + def self.openapi_discriminator_name + :'type' + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::Mentionee` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::Mentionee`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'index') + self.index = attributes[:'index'] + else + self.index = nil + end + + if attributes.key?(:'length') + self.length = attributes[:'length'] + else + self.length = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @index.nil? + invalid_properties.push('invalid value for "index", index cannot be nil.') + end + + if @length.nil? + invalid_properties.push('invalid value for "length", length cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @index.nil? + return false if @length.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + index == o.index && + length == o.length + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, index, length].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/message_content.rb b/lib/clients/webhook/lib/line_client_webhook/models/message_content.rb new file mode 100644 index 00000000..f4c8eefb --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/message_content.rb @@ -0,0 +1,225 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class MessageContent + # Type + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # discriminator's property name in OpenAPI v3 + def self.openapi_discriminator_name + :'type' + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::MessageContent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::MessageContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/message_event.rb b/lib/clients/webhook/lib/line_client_webhook/models/message_event.rb new file mode 100644 index 00000000..390b2e19 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/message_event.rb @@ -0,0 +1,262 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # Webhook event object which contains the sent message. + class MessageEvent < Event + attr_accessor :reply_token + + attr_accessor :message + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'reply_token' => :'replyToken', + :'message' => :'message' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'reply_token' => :'String', + :'message' => :'MessageContent' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Event' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::MessageEvent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::MessageEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'reply_token') + self.reply_token = attributes[:'reply_token'] + end + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + reply_token == o.reply_token && + message == o.message && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [reply_token, message].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/message_event_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/message_event_all_of.rb new file mode 100644 index 00000000..df1fa7f8 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/message_event_all_of.rb @@ -0,0 +1,228 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class MessageEventAllOf + attr_accessor :reply_token + + attr_accessor :message + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'reply_token' => :'replyToken', + :'message' => :'message' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'reply_token' => :'String', + :'message' => :'MessageContent' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::MessageEventAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::MessageEventAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'reply_token') + self.reply_token = attributes[:'reply_token'] + end + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + reply_token == o.reply_token && + message == o.message + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [reply_token, message].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/module_content.rb b/lib/clients/webhook/lib/line_client_webhook/models/module_content.rb new file mode 100644 index 00000000..2e2ff5bc --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/module_content.rb @@ -0,0 +1,225 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class ModuleContent + # Type + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # discriminator's property name in OpenAPI v3 + def self.openapi_discriminator_name + :'type' + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::ModuleContent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::ModuleContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/module_event.rb b/lib/clients/webhook/lib/line_client_webhook/models/module_event.rb new file mode 100644 index 00000000..e479bb99 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/module_event.rb @@ -0,0 +1,260 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # This event indicates that the module channel has been attached to the LINE Official Account. Sent to the webhook URL server of the module channel. + class ModuleEvent < Event + attr_accessor :_module + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'_module' => :'module' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'_module' => :'ModuleContent' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Event' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::ModuleEvent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::ModuleEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'_module') + self._module = attributes[:'_module'] + else + self._module = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @_module.nil? + invalid_properties.push('invalid value for "_module", _module cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @_module.nil? + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + _module == o._module && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [_module].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/module_event_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/module_event_all_of.rb new file mode 100644 index 00000000..4a85b5ff --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/module_event_all_of.rb @@ -0,0 +1,224 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class ModuleEventAllOf + attr_accessor :_module + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'_module' => :'module' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'_module' => :'ModuleContent' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::ModuleEventAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::ModuleEventAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'_module') + self._module = attributes[:'_module'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @_module.nil? + invalid_properties.push('invalid value for "_module", _module cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @_module.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + _module == o._module + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [_module].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/postback_content.rb b/lib/clients/webhook/lib/line_client_webhook/models/postback_content.rb new file mode 100644 index 00000000..664de945 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/postback_content.rb @@ -0,0 +1,238 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class PostbackContent + # Postback data + attr_accessor :data + + attr_accessor :params + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'data' => :'data', + :'params' => :'params' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'data' => :'String', + :'params' => :'Hash' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::PostbackContent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::PostbackContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + else + self.data = nil + end + + if attributes.key?(:'params') + if (value = attributes[:'params']).is_a?(Hash) + self.params = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @data.nil? + invalid_properties.push('invalid value for "data", data cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @data.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + params == o.params + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [data, params].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/postback_event.rb b/lib/clients/webhook/lib/line_client_webhook/models/postback_event.rb new file mode 100644 index 00000000..da481204 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/postback_event.rb @@ -0,0 +1,263 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # Event object for when a user performs a postback action which initiates a postback. You can reply to postback events. + class PostbackEvent < Event + # Reply token used to send reply message to this event + attr_accessor :reply_token + + attr_accessor :postback + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'reply_token' => :'replyToken', + :'postback' => :'postback' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'reply_token' => :'String', + :'postback' => :'PostbackContent' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Event' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::PostbackEvent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::PostbackEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'reply_token') + self.reply_token = attributes[:'reply_token'] + end + + if attributes.key?(:'postback') + self.postback = attributes[:'postback'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + reply_token == o.reply_token && + postback == o.postback && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [reply_token, postback].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/postback_event_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/postback_event_all_of.rb new file mode 100644 index 00000000..d7f79037 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/postback_event_all_of.rb @@ -0,0 +1,229 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class PostbackEventAllOf + # Reply token used to send reply message to this event + attr_accessor :reply_token + + attr_accessor :postback + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'reply_token' => :'replyToken', + :'postback' => :'postback' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'reply_token' => :'String', + :'postback' => :'PostbackContent' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::PostbackEventAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::PostbackEventAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'reply_token') + self.reply_token = attributes[:'reply_token'] + end + + if attributes.key?(:'postback') + self.postback = attributes[:'postback'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + reply_token == o.reply_token && + postback == o.postback + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [reply_token, postback].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/room_source.rb b/lib/clients/webhook/lib/line_client_webhook/models/room_source.rb new file mode 100644 index 00000000..282d92b9 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/room_source.rb @@ -0,0 +1,248 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class RoomSource < Source + # ID of the source user. Only included in message events. Only users of LINE for iOS and LINE for Android are included in userId. + attr_accessor :user_id + + # Room ID of the source multi-person chat + attr_accessor :room_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'user_id' => :'userId', + :'room_id' => :'roomId' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'user_id' => :'String', + :'room_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Source' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::RoomSource` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::RoomSource`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'user_id') + self.user_id = attributes[:'user_id'] + end + + if attributes.key?(:'room_id') + self.room_id = attributes[:'room_id'] + else + self.room_id = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @room_id.nil? + invalid_properties.push('invalid value for "room_id", room_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @room_id.nil? + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + user_id == o.user_id && + room_id == o.room_id && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [user_id, room_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/room_source_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/room_source_all_of.rb new file mode 100644 index 00000000..767a8e8d --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/room_source_all_of.rb @@ -0,0 +1,236 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # Source multi-person chat + class RoomSourceAllOf + # ID of the source user. Only included in message events. Only users of LINE for iOS and LINE for Android are included in userId. + attr_accessor :user_id + + # Room ID of the source multi-person chat + attr_accessor :room_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'user_id' => :'userId', + :'room_id' => :'roomId' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'user_id' => :'String', + :'room_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::RoomSourceAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::RoomSourceAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'user_id') + self.user_id = attributes[:'user_id'] + end + + if attributes.key?(:'room_id') + self.room_id = attributes[:'room_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @room_id.nil? + invalid_properties.push('invalid value for "room_id", room_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @room_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + user_id == o.user_id && + room_id == o.room_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [user_id, room_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/scenario_result.rb b/lib/clients/webhook/lib/line_client_webhook/models/scenario_result.rb new file mode 100644 index 00000000..68af0a74 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/scenario_result.rb @@ -0,0 +1,313 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class ScenarioResult + # Scenario ID executed + attr_accessor :scenario_id + + # Revision number of the scenario set containing the executed scenario + attr_accessor :revision + + # Timestamp for when execution of scenario action started (milliseconds, LINE app time) + attr_accessor :start_time + + # Timestamp for when execution of scenario was completed (milliseconds, LINE app time) + attr_accessor :end_time + + # Scenario execution completion status + attr_accessor :result_code + + # Execution result of individual operations specified in action. Only included when things.result.resultCode is success. + attr_accessor :action_results + + # Data contained in notification. + attr_accessor :ble_notification_payload + + # Error reason. + attr_accessor :error_reason + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'scenario_id' => :'scenarioId', + :'revision' => :'revision', + :'start_time' => :'startTime', + :'end_time' => :'endTime', + :'result_code' => :'resultCode', + :'action_results' => :'actionResults', + :'ble_notification_payload' => :'bleNotificationPayload', + :'error_reason' => :'errorReason' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'scenario_id' => :'String', + :'revision' => :'Integer', + :'start_time' => :'Integer', + :'end_time' => :'Integer', + :'result_code' => :'String', + :'action_results' => :'Array', + :'ble_notification_payload' => :'String', + :'error_reason' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::ScenarioResult` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::ScenarioResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'scenario_id') + self.scenario_id = attributes[:'scenario_id'] + end + + if attributes.key?(:'revision') + self.revision = attributes[:'revision'] + end + + if attributes.key?(:'start_time') + self.start_time = attributes[:'start_time'] + else + self.start_time = nil + end + + if attributes.key?(:'end_time') + self.end_time = attributes[:'end_time'] + else + self.end_time = nil + end + + if attributes.key?(:'result_code') + self.result_code = attributes[:'result_code'] + else + self.result_code = nil + end + + if attributes.key?(:'action_results') + if (value = attributes[:'action_results']).is_a?(Array) + self.action_results = value + end + end + + if attributes.key?(:'ble_notification_payload') + self.ble_notification_payload = attributes[:'ble_notification_payload'] + end + + if attributes.key?(:'error_reason') + self.error_reason = attributes[:'error_reason'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @start_time.nil? + invalid_properties.push('invalid value for "start_time", start_time cannot be nil.') + end + + if @end_time.nil? + invalid_properties.push('invalid value for "end_time", end_time cannot be nil.') + end + + if @result_code.nil? + invalid_properties.push('invalid value for "result_code", result_code cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @start_time.nil? + return false if @end_time.nil? + return false if @result_code.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + scenario_id == o.scenario_id && + revision == o.revision && + start_time == o.start_time && + end_time == o.end_time && + result_code == o.result_code && + action_results == o.action_results && + ble_notification_payload == o.ble_notification_payload && + error_reason == o.error_reason + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [scenario_id, revision, start_time, end_time, result_code, action_results, ble_notification_payload, error_reason].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/scenario_result_things_content.rb b/lib/clients/webhook/lib/line_client_webhook/models/scenario_result_things_content.rb new file mode 100644 index 00000000..5e4c7554 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/scenario_result_things_content.rb @@ -0,0 +1,254 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class ScenarioResultThingsContent < ThingsContent + # Device ID of the device that has been linked with LINE. + attr_accessor :device_id + + attr_accessor :result + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'device_id' => :'deviceId', + :'result' => :'result' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'device_id' => :'String', + :'result' => :'ScenarioResult' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ThingsContent' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::ScenarioResultThingsContent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::ScenarioResultThingsContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'device_id') + self.device_id = attributes[:'device_id'] + else + self.device_id = nil + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + else + self.result = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @device_id.nil? + invalid_properties.push('invalid value for "device_id", device_id cannot be nil.') + end + + if @result.nil? + invalid_properties.push('invalid value for "result", result cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @device_id.nil? + return false if @result.nil? + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + device_id == o.device_id && + result == o.result && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [device_id, result].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/scenario_result_things_content_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/scenario_result_things_content_all_of.rb new file mode 100644 index 00000000..90e32758 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/scenario_result_things_content_all_of.rb @@ -0,0 +1,240 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # This event indicates that an automatic communication scenario has been executed. + class ScenarioResultThingsContentAllOf + # Device ID of the device that has been linked with LINE. + attr_accessor :device_id + + attr_accessor :result + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'device_id' => :'deviceId', + :'result' => :'result' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'device_id' => :'String', + :'result' => :'ScenarioResult' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::ScenarioResultThingsContentAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::ScenarioResultThingsContentAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'device_id') + self.device_id = attributes[:'device_id'] + end + + if attributes.key?(:'result') + self.result = attributes[:'result'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @device_id.nil? + invalid_properties.push('invalid value for "device_id", device_id cannot be nil.') + end + + if @result.nil? + invalid_properties.push('invalid value for "result", result cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @device_id.nil? + return false if @result.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + device_id == o.device_id && + result == o.result + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [device_id, result].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/source.rb b/lib/clients/webhook/lib/line_client_webhook/models/source.rb new file mode 100644 index 00000000..42e5e10b --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/source.rb @@ -0,0 +1,226 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # the source of the event. + class Source + # source type + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # discriminator's property name in OpenAPI v3 + def self.openapi_discriminator_name + :'type' + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::Source` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::Source`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/sticker_message_content.rb b/lib/clients/webhook/lib/line_client_webhook/models/sticker_message_content.rb new file mode 100644 index 00000000..b8334950 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/sticker_message_content.rb @@ -0,0 +1,409 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class StickerMessageContent < MessageContent + # Message ID + attr_accessor :id + + # Package ID + attr_accessor :package_id + + # Sticker ID + attr_accessor :sticker_id + + attr_accessor :sticker_resource_type + + # Array of up to 15 keywords describing the sticker. If a sticker has 16 or more keywords, a random selection of 15 keywords will be returned. The keyword selection is random for each event, so different keywords may be returned for the same sticker. + attr_accessor :keywords + + # Any text entered by the user. This property is only included for message stickers. Max character limit: 100 + attr_accessor :text + + # Quote token to quote this message. + attr_accessor :quote_token + + # Message ID of a quoted message. Only included when the received message quotes a past message. + attr_accessor :quoted_message_id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'package_id' => :'packageId', + :'sticker_id' => :'stickerId', + :'sticker_resource_type' => :'stickerResourceType', + :'keywords' => :'keywords', + :'text' => :'text', + :'quote_token' => :'quoteToken', + :'quoted_message_id' => :'quotedMessageId' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'package_id' => :'String', + :'sticker_id' => :'String', + :'sticker_resource_type' => :'String', + :'keywords' => :'Array', + :'text' => :'String', + :'quote_token' => :'String', + :'quoted_message_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'MessageContent' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::StickerMessageContent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::StickerMessageContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'package_id') + self.package_id = attributes[:'package_id'] + else + self.package_id = nil + end + + if attributes.key?(:'sticker_id') + self.sticker_id = attributes[:'sticker_id'] + else + self.sticker_id = nil + end + + if attributes.key?(:'sticker_resource_type') + self.sticker_resource_type = attributes[:'sticker_resource_type'] + else + self.sticker_resource_type = nil + end + + if attributes.key?(:'keywords') + if (value = attributes[:'keywords']).is_a?(Array) + self.keywords = value + end + end + + if attributes.key?(:'text') + self.text = attributes[:'text'] + end + + if attributes.key?(:'quote_token') + self.quote_token = attributes[:'quote_token'] + else + self.quote_token = nil + end + + if attributes.key?(:'quoted_message_id') + self.quoted_message_id = attributes[:'quoted_message_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @package_id.nil? + invalid_properties.push('invalid value for "package_id", package_id cannot be nil.') + end + + if @sticker_id.nil? + invalid_properties.push('invalid value for "sticker_id", sticker_id cannot be nil.') + end + + if @sticker_resource_type.nil? + invalid_properties.push('invalid value for "sticker_resource_type", sticker_resource_type cannot be nil.') + end + + if !@keywords.nil? && @keywords.length > 15 + invalid_properties.push('invalid value for "keywords", number of items must be less than or equal to 15.') + end + + if !@text.nil? && @text.to_s.length > 100 + invalid_properties.push('invalid value for "text", the character length must be smaller than or equal to 100.') + end + + if @quote_token.nil? + invalid_properties.push('invalid value for "quote_token", quote_token cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @package_id.nil? + return false if @sticker_id.nil? + return false if @sticker_resource_type.nil? + sticker_resource_type_validator = EnumAttributeValidator.new('String', ["STATIC", "ANIMATION", "SOUND", "ANIMATION_SOUND", "POPUP", "POPUP_SOUND", "CUSTOM", "MESSAGE", "NAME_TEXT", "PER_STICKER_TEXT"]) + return false unless sticker_resource_type_validator.valid?(@sticker_resource_type) + return false if !@keywords.nil? && @keywords.length > 15 + return false if !@text.nil? && @text.to_s.length > 100 + return false if @quote_token.nil? + true && super + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] sticker_resource_type Object to be assigned + def sticker_resource_type=(sticker_resource_type) + validator = EnumAttributeValidator.new('String', ["STATIC", "ANIMATION", "SOUND", "ANIMATION_SOUND", "POPUP", "POPUP_SOUND", "CUSTOM", "MESSAGE", "NAME_TEXT", "PER_STICKER_TEXT"]) + unless validator.valid?(sticker_resource_type) + fail ArgumentError, "invalid value for \"sticker_resource_type\", must be one of #{validator.allowable_values}." + end + @sticker_resource_type = sticker_resource_type + end + + # Custom attribute writer method with validation + # @param [Object] keywords Value to be assigned + def keywords=(keywords) + if keywords.nil? + fail ArgumentError, 'keywords cannot be nil' + end + + if keywords.length > 15 + fail ArgumentError, 'invalid value for "keywords", number of items must be less than or equal to 15.' + end + + @keywords = keywords + end + + # Custom attribute writer method with validation + # @param [Object] text Value to be assigned + def text=(text) + if text.nil? + fail ArgumentError, 'text cannot be nil' + end + + if text.to_s.length > 100 + fail ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 100.' + end + + @text = text + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + package_id == o.package_id && + sticker_id == o.sticker_id && + sticker_resource_type == o.sticker_resource_type && + keywords == o.keywords && + text == o.text && + quote_token == o.quote_token && + quoted_message_id == o.quoted_message_id && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, package_id, sticker_id, sticker_resource_type, keywords, text, quote_token, quoted_message_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/sticker_message_content_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/sticker_message_content_all_of.rb new file mode 100644 index 00000000..5c3c9ddd --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/sticker_message_content_all_of.rb @@ -0,0 +1,356 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # Message object which contains the sticker data sent from the source. + class StickerMessageContentAllOf + # Message ID + attr_accessor :id + + # Package ID + attr_accessor :package_id + + # Sticker ID + attr_accessor :sticker_id + + attr_accessor :sticker_resource_type + + # Array of up to 15 keywords describing the sticker. If a sticker has 16 or more keywords, a random selection of 15 keywords will be returned. The keyword selection is random for each event, so different keywords may be returned for the same sticker. + attr_accessor :keywords + + # Any text entered by the user. This property is only included for message stickers. Max character limit: 100 + attr_accessor :text + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'package_id' => :'packageId', + :'sticker_id' => :'stickerId', + :'sticker_resource_type' => :'stickerResourceType', + :'keywords' => :'keywords', + :'text' => :'text' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'package_id' => :'String', + :'sticker_id' => :'String', + :'sticker_resource_type' => :'String', + :'keywords' => :'Array', + :'text' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::StickerMessageContentAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::StickerMessageContentAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'package_id') + self.package_id = attributes[:'package_id'] + end + + if attributes.key?(:'sticker_id') + self.sticker_id = attributes[:'sticker_id'] + end + + if attributes.key?(:'sticker_resource_type') + self.sticker_resource_type = attributes[:'sticker_resource_type'] + end + + if attributes.key?(:'keywords') + if (value = attributes[:'keywords']).is_a?(Array) + self.keywords = value + end + end + + if attributes.key?(:'text') + self.text = attributes[:'text'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @package_id.nil? + invalid_properties.push('invalid value for "package_id", package_id cannot be nil.') + end + + if @sticker_id.nil? + invalid_properties.push('invalid value for "sticker_id", sticker_id cannot be nil.') + end + + if @sticker_resource_type.nil? + invalid_properties.push('invalid value for "sticker_resource_type", sticker_resource_type cannot be nil.') + end + + if !@keywords.nil? && @keywords.length > 15 + invalid_properties.push('invalid value for "keywords", number of items must be less than or equal to 15.') + end + + if !@text.nil? && @text.to_s.length > 100 + invalid_properties.push('invalid value for "text", the character length must be smaller than or equal to 100.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @package_id.nil? + return false if @sticker_id.nil? + return false if @sticker_resource_type.nil? + sticker_resource_type_validator = EnumAttributeValidator.new('String', ["STATIC", "ANIMATION", "SOUND", "ANIMATION_SOUND", "POPUP", "POPUP_SOUND", "CUSTOM", "MESSAGE", "NAME_TEXT", "PER_STICKER_TEXT"]) + return false unless sticker_resource_type_validator.valid?(@sticker_resource_type) + return false if !@keywords.nil? && @keywords.length > 15 + return false if !@text.nil? && @text.to_s.length > 100 + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] sticker_resource_type Object to be assigned + def sticker_resource_type=(sticker_resource_type) + validator = EnumAttributeValidator.new('String', ["STATIC", "ANIMATION", "SOUND", "ANIMATION_SOUND", "POPUP", "POPUP_SOUND", "CUSTOM", "MESSAGE", "NAME_TEXT", "PER_STICKER_TEXT"]) + unless validator.valid?(sticker_resource_type) + fail ArgumentError, "invalid value for \"sticker_resource_type\", must be one of #{validator.allowable_values}." + end + @sticker_resource_type = sticker_resource_type + end + + # Custom attribute writer method with validation + # @param [Object] keywords Value to be assigned + def keywords=(keywords) + if !keywords.nil? && keywords.length > 15 + fail ArgumentError, 'invalid value for "keywords", number of items must be less than or equal to 15.' + end + + @keywords = keywords + end + + # Custom attribute writer method with validation + # @param [Object] text Value to be assigned + def text=(text) + if !text.nil? && text.to_s.length > 100 + fail ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 100.' + end + + @text = text + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + package_id == o.package_id && + sticker_id == o.sticker_id && + sticker_resource_type == o.sticker_resource_type && + keywords == o.keywords && + text == o.text + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, package_id, sticker_id, sticker_resource_type, keywords, text].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/text_message_content.rb b/lib/clients/webhook/lib/line_client_webhook/models/text_message_content.rb new file mode 100644 index 00000000..4a4a36ed --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/text_message_content.rb @@ -0,0 +1,303 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class TextMessageContent < MessageContent + # Message ID + attr_accessor :id + + # Message text. + attr_accessor :text + + # Array of one or more LINE emoji objects. Only included in the message event when the text property contains a LINE emoji. + attr_accessor :emojis + + attr_accessor :mention + + # Quote token to quote this message. + attr_accessor :quote_token + + # Message ID of a quoted message. Only included when the received message quotes a past message. + attr_accessor :quoted_message_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'text' => :'text', + :'emojis' => :'emojis', + :'mention' => :'mention', + :'quote_token' => :'quoteToken', + :'quoted_message_id' => :'quotedMessageId' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'text' => :'String', + :'emojis' => :'Array', + :'mention' => :'Mention', + :'quote_token' => :'String', + :'quoted_message_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'MessageContent' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::TextMessageContent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::TextMessageContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'text') + self.text = attributes[:'text'] + else + self.text = nil + end + + if attributes.key?(:'emojis') + if (value = attributes[:'emojis']).is_a?(Array) + self.emojis = value + end + end + + if attributes.key?(:'mention') + self.mention = attributes[:'mention'] + end + + if attributes.key?(:'quote_token') + self.quote_token = attributes[:'quote_token'] + else + self.quote_token = nil + end + + if attributes.key?(:'quoted_message_id') + self.quoted_message_id = attributes[:'quoted_message_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @text.nil? + invalid_properties.push('invalid value for "text", text cannot be nil.') + end + + if @quote_token.nil? + invalid_properties.push('invalid value for "quote_token", quote_token cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @text.nil? + return false if @quote_token.nil? + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + text == o.text && + emojis == o.emojis && + mention == o.mention && + quote_token == o.quote_token && + quoted_message_id == o.quoted_message_id && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, text, emojis, mention, quote_token, quoted_message_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/text_message_content_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/text_message_content_all_of.rb new file mode 100644 index 00000000..055d4731 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/text_message_content_all_of.rb @@ -0,0 +1,261 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class TextMessageContentAllOf + # Message ID + attr_accessor :id + + # Message text. + attr_accessor :text + + # Array of one or more LINE emoji objects. Only included in the message event when the text property contains a LINE emoji. + attr_accessor :emojis + + attr_accessor :mention + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'text' => :'text', + :'emojis' => :'emojis', + :'mention' => :'mention' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'text' => :'String', + :'emojis' => :'Array', + :'mention' => :'Mention' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::TextMessageContentAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::TextMessageContentAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'text') + self.text = attributes[:'text'] + end + + if attributes.key?(:'emojis') + if (value = attributes[:'emojis']).is_a?(Array) + self.emojis = value + end + end + + if attributes.key?(:'mention') + self.mention = attributes[:'mention'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @text.nil? + invalid_properties.push('invalid value for "text", text cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @text.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + text == o.text && + emojis == o.emojis && + mention == o.mention + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, text, emojis, mention].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/things_content.rb b/lib/clients/webhook/lib/line_client_webhook/models/things_content.rb new file mode 100644 index 00000000..ef37ae96 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/things_content.rb @@ -0,0 +1,225 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class ThingsContent + # Type + attr_accessor :type + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # discriminator's property name in OpenAPI v3 + def self.openapi_discriminator_name + :'type' + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::ThingsContent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::ThingsContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/things_event.rb b/lib/clients/webhook/lib/line_client_webhook/models/things_event.rb new file mode 100644 index 00000000..7f011036 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/things_event.rb @@ -0,0 +1,277 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # Indicates that a user linked a device with LINE. + class ThingsEvent < Event + # Reply token used to send reply message to this event + attr_accessor :reply_token + + attr_accessor :things + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'reply_token' => :'replyToken', + :'things' => :'things' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'reply_token' => :'String', + :'things' => :'ThingsContent' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Event' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::ThingsEvent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::ThingsEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'reply_token') + self.reply_token = attributes[:'reply_token'] + else + self.reply_token = nil + end + + if attributes.key?(:'things') + self.things = attributes[:'things'] + else + self.things = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @reply_token.nil? + invalid_properties.push('invalid value for "reply_token", reply_token cannot be nil.') + end + + if @things.nil? + invalid_properties.push('invalid value for "things", things cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @reply_token.nil? + return false if @things.nil? + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + reply_token == o.reply_token && + things == o.things && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [reply_token, things].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/things_event_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/things_event_all_of.rb new file mode 100644 index 00000000..d12cf7f6 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/things_event_all_of.rb @@ -0,0 +1,239 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class ThingsEventAllOf + # Reply token used to send reply message to this event + attr_accessor :reply_token + + attr_accessor :things + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'reply_token' => :'replyToken', + :'things' => :'things' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'reply_token' => :'String', + :'things' => :'ThingsContent' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::ThingsEventAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::ThingsEventAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'reply_token') + self.reply_token = attributes[:'reply_token'] + end + + if attributes.key?(:'things') + self.things = attributes[:'things'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @reply_token.nil? + invalid_properties.push('invalid value for "reply_token", reply_token cannot be nil.') + end + + if @things.nil? + invalid_properties.push('invalid value for "things", things cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @reply_token.nil? + return false if @things.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + reply_token == o.reply_token && + things == o.things + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [reply_token, things].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/unfollow_event.rb b/lib/clients/webhook/lib/line_client_webhook/models/unfollow_event.rb new file mode 100644 index 00000000..af099b57 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/unfollow_event.rb @@ -0,0 +1,244 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # Event object for when your LINE Official Account is blocked. + class UnfollowEvent < Event + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Event' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::UnfollowEvent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::UnfollowEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/unlink_things_content.rb b/lib/clients/webhook/lib/line_client_webhook/models/unlink_things_content.rb new file mode 100644 index 00000000..9eff96d3 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/unlink_things_content.rb @@ -0,0 +1,238 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class UnlinkThingsContent < ThingsContent + # Device ID of the device that has been linked with LINE. + attr_accessor :device_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'device_id' => :'deviceId' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'device_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ThingsContent' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::UnlinkThingsContent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::UnlinkThingsContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'device_id') + self.device_id = attributes[:'device_id'] + else + self.device_id = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @device_id.nil? + invalid_properties.push('invalid value for "device_id", device_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @device_id.nil? + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + device_id == o.device_id && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [device_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/unlink_things_content_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/unlink_things_content_all_of.rb new file mode 100644 index 00000000..fe62f17a --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/unlink_things_content_all_of.rb @@ -0,0 +1,226 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # Indicates that the user unlinked a device from LINE. + class UnlinkThingsContentAllOf + # Device ID of the device that has been linked with LINE. + attr_accessor :device_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'device_id' => :'deviceId' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'device_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::UnlinkThingsContentAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::UnlinkThingsContentAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'device_id') + self.device_id = attributes[:'device_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @device_id.nil? + invalid_properties.push('invalid value for "device_id", device_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @device_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + device_id == o.device_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [device_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/unsend_detail.rb b/lib/clients/webhook/lib/line_client_webhook/models/unsend_detail.rb new file mode 100644 index 00000000..df406f28 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/unsend_detail.rb @@ -0,0 +1,227 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class UnsendDetail + # The message ID of the unsent message + attr_accessor :message_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'message_id' => :'messageId' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'message_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::UnsendDetail` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::UnsendDetail`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'message_id') + self.message_id = attributes[:'message_id'] + else + self.message_id = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @message_id.nil? + invalid_properties.push('invalid value for "message_id", message_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @message_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + message_id == o.message_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [message_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/unsend_event.rb b/lib/clients/webhook/lib/line_client_webhook/models/unsend_event.rb new file mode 100644 index 00000000..15b1cd9f --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/unsend_event.rb @@ -0,0 +1,253 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # Event object for when the user unsends a message. + class UnsendEvent < Event + attr_accessor :unsend + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'unsend' => :'unsend' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'unsend' => :'UnsendDetail' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Event' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::UnsendEvent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::UnsendEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'unsend') + self.unsend = attributes[:'unsend'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + unsend == o.unsend && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [unsend].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/unsend_event_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/unsend_event_all_of.rb new file mode 100644 index 00000000..5f2fb992 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/unsend_event_all_of.rb @@ -0,0 +1,219 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class UnsendEventAllOf + attr_accessor :unsend + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'unsend' => :'unsend' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'unsend' => :'UnsendDetail' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::UnsendEventAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::UnsendEventAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'unsend') + self.unsend = attributes[:'unsend'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + unsend == o.unsend + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [unsend].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/user_mentionee.rb b/lib/clients/webhook/lib/line_client_webhook/models/user_mentionee.rb new file mode 100644 index 00000000..51c7177f --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/user_mentionee.rb @@ -0,0 +1,232 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # Mentioned target is user + class UserMentionee < Mentionee + # User ID of the mentioned user. Only included if mention.mentions[].type is user and the user consents to the LINE Official Account obtaining their user profile information. + attr_accessor :user_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'user_id' => :'userId' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'user_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Mentionee' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::UserMentionee` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::UserMentionee`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'user_id') + self.user_id = attributes[:'user_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + user_id == o.user_id && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [user_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/user_mentionee_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/user_mentionee_all_of.rb new file mode 100644 index 00000000..9a949864 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/user_mentionee_all_of.rb @@ -0,0 +1,220 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class UserMentioneeAllOf + # User ID of the mentioned user. Only included if mention.mentions[].type is user and the user consents to the LINE Official Account obtaining their user profile information. + attr_accessor :user_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'user_id' => :'userId' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'user_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::UserMentioneeAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::UserMentioneeAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'user_id') + self.user_id = attributes[:'user_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + user_id == o.user_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [user_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/user_source.rb b/lib/clients/webhook/lib/line_client_webhook/models/user_source.rb new file mode 100644 index 00000000..91400261 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/user_source.rb @@ -0,0 +1,231 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class UserSource < Source + # ID of the source user + attr_accessor :user_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'user_id' => :'userId' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'user_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Source' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::UserSource` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::UserSource`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'user_id') + self.user_id = attributes[:'user_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + user_id == o.user_id && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [user_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/user_source_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/user_source_all_of.rb new file mode 100644 index 00000000..284fffa9 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/user_source_all_of.rb @@ -0,0 +1,220 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class UserSourceAllOf + # ID of the source user + attr_accessor :user_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'user_id' => :'userId' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'user_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::UserSourceAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::UserSourceAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'user_id') + self.user_id = attributes[:'user_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + user_id == o.user_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [user_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/video_message_content.rb b/lib/clients/webhook/lib/line_client_webhook/models/video_message_content.rb new file mode 100644 index 00000000..dfde3774 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/video_message_content.rb @@ -0,0 +1,281 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class VideoMessageContent < MessageContent + # Message ID + attr_accessor :id + + # Length of video file (milliseconds) + attr_accessor :duration + + attr_accessor :content_provider + + # Quote token to quote this message. + attr_accessor :quote_token + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'duration' => :'duration', + :'content_provider' => :'contentProvider', + :'quote_token' => :'quoteToken' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'duration' => :'Integer', + :'content_provider' => :'ContentProvider', + :'quote_token' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'MessageContent' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::VideoMessageContent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::VideoMessageContent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'duration') + self.duration = attributes[:'duration'] + end + + if attributes.key?(:'content_provider') + self.content_provider = attributes[:'content_provider'] + else + self.content_provider = nil + end + + if attributes.key?(:'quote_token') + self.quote_token = attributes[:'quote_token'] + else + self.quote_token = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @content_provider.nil? + invalid_properties.push('invalid value for "content_provider", content_provider cannot be nil.') + end + + if @quote_token.nil? + invalid_properties.push('invalid value for "quote_token", quote_token cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @content_provider.nil? + return false if @quote_token.nil? + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + duration == o.duration && + content_provider == o.content_provider && + quote_token == o.quote_token && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, duration, content_provider, quote_token].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/video_message_content_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/video_message_content_all_of.rb new file mode 100644 index 00000000..bfa8f8a0 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/video_message_content_all_of.rb @@ -0,0 +1,250 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # Message object which contains the video content sent from the source. The preview image is displayed in the chat and the video is played when the image is tapped. + class VideoMessageContentAllOf + # Message ID + attr_accessor :id + + # Length of video file (milliseconds) + attr_accessor :duration + + attr_accessor :content_provider + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'duration' => :'duration', + :'content_provider' => :'contentProvider' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'duration' => :'Integer', + :'content_provider' => :'ContentProvider' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::VideoMessageContentAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::VideoMessageContentAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'duration') + self.duration = attributes[:'duration'] + end + + if attributes.key?(:'content_provider') + self.content_provider = attributes[:'content_provider'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @content_provider.nil? + invalid_properties.push('invalid value for "content_provider", content_provider cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @id.nil? + return false if @content_provider.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + duration == o.duration && + content_provider == o.content_provider + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, duration, content_provider].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/video_play_complete.rb b/lib/clients/webhook/lib/line_client_webhook/models/video_play_complete.rb new file mode 100644 index 00000000..8ff6ffd1 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/video_play_complete.rb @@ -0,0 +1,227 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class VideoPlayComplete + # ID used to identify a video. Returns the same value as the trackingId assigned to the video message. + attr_accessor :tracking_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'tracking_id' => :'trackingId' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Returns the key-value map of all the JSON attributes this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Attribute type mapping. + def self.openapi_types + { + :'tracking_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::VideoPlayComplete` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::VideoPlayComplete`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'tracking_id') + self.tracking_id = attributes[:'tracking_id'] + else + self.tracking_id = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @tracking_id.nil? + invalid_properties.push('invalid value for "tracking_id", tracking_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @tracking_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + tracking_id == o.tracking_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [tracking_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/video_play_complete_event.rb b/lib/clients/webhook/lib/line_client_webhook/models/video_play_complete_event.rb new file mode 100644 index 00000000..5438e42a --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/video_play_complete_event.rb @@ -0,0 +1,277 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + # Event for when a user finishes viewing a video at least once with the specified trackingId sent by the LINE Official Account. + class VideoPlayCompleteEvent < Event + # Reply token used to send reply message to this event + attr_accessor :reply_token + + attr_accessor :video_play_complete + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'reply_token' => :'replyToken', + :'video_play_complete' => :'videoPlayComplete' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Returns the key-value map of all the JSON attributes this model knows about, including the ones defined in its parent(s) + def self.acceptable_attribute_map + attribute_map.merge(superclass.acceptable_attribute_map) + end + + # Attribute type mapping. + def self.openapi_types + { + :'reply_token' => :'String', + :'video_play_complete' => :'VideoPlayComplete' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Event' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::VideoPlayCompleteEvent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::VideoPlayCompleteEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'reply_token') + self.reply_token = attributes[:'reply_token'] + else + self.reply_token = nil + end + + if attributes.key?(:'video_play_complete') + self.video_play_complete = attributes[:'video_play_complete'] + else + self.video_play_complete = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + if @reply_token.nil? + invalid_properties.push('invalid value for "reply_token", reply_token cannot be nil.') + end + + if @video_play_complete.nil? + invalid_properties.push('invalid value for "video_play_complete", video_play_complete cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @reply_token.nil? + return false if @video_play_complete.nil? + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + reply_token == o.reply_token && + video_play_complete == o.video_play_complete && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [reply_token, video_play_complete].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/models/video_play_complete_event_all_of.rb b/lib/clients/webhook/lib/line_client_webhook/models/video_play_complete_event_all_of.rb new file mode 100644 index 00000000..2e056cd3 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/models/video_play_complete_event_all_of.rb @@ -0,0 +1,239 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.6.0 + +=end + +require 'date' +require 'time' + +module LINE::Client::Webhook + class VideoPlayCompleteEventAllOf + # Reply token used to send reply message to this event + attr_accessor :reply_token + + attr_accessor :video_play_complete + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'reply_token' => :'replyToken', + :'video_play_complete' => :'videoPlayComplete' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'reply_token' => :'String', + :'video_play_complete' => :'VideoPlayComplete' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `LINE::Client::Webhook::VideoPlayCompleteEventAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `LINE::Client::Webhook::VideoPlayCompleteEventAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'reply_token') + self.reply_token = attributes[:'reply_token'] + end + + if attributes.key?(:'video_play_complete') + self.video_play_complete = attributes[:'video_play_complete'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @reply_token.nil? + invalid_properties.push('invalid value for "reply_token", reply_token cannot be nil.') + end + + if @video_play_complete.nil? + invalid_properties.push('invalid value for "video_play_complete", video_play_complete cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @reply_token.nil? + return false if @video_play_complete.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + reply_token == o.reply_token && + video_play_complete == o.video_play_complete + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [reply_token, video_play_complete].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = LINE::Client::Webhook.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/clients/webhook/lib/line_client_webhook/version.rb b/lib/clients/webhook/lib/line_client_webhook/version.rb new file mode 100644 index 00000000..b596eec2 --- /dev/null +++ b/lib/clients/webhook/lib/line_client_webhook/version.rb @@ -0,0 +1,15 @@ +=begin +#Webhook Type Definition + +#Webhook event definition of the LINE Messaging API + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0 + +=end + +module LINE::Client::Webhook + VERSION = '2.0.0' +end diff --git a/lib/line/bot.rb b/lib/deprecated/line/bot.rb similarity index 72% rename from lib/line/bot.rb rename to lib/deprecated/line/bot.rb index f95874f4..fcdeaf44 100644 --- a/lib/line/bot.rb +++ b/lib/deprecated/line/bot.rb @@ -12,10 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. -require 'line/bot/util' -require 'line/bot/client' -require 'line/bot/event' -require 'line/bot/api/errors' -require 'line/bot/api' -require 'line/bot/httpclient' -require 'line/bot/api/version' +require 'deprecated/line/bot/util' +require 'deprecated/line/bot/client' +require 'deprecated/line/bot/event' +require 'deprecated/line/bot/api/errors' +require 'deprecated/line/bot/api' +require 'deprecated/line/bot/httpclient' diff --git a/lib/line/bot/api.rb b/lib/deprecated/line/bot/api.rb similarity index 90% rename from lib/line/bot/api.rb rename to lib/deprecated/line/bot/api.rb index 4d5ccd61..537ed86e 100644 --- a/lib/line/bot/api.rb +++ b/lib/deprecated/line/bot/api.rb @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -require 'line/bot/api/version' +require 'line/client/version' module Line module Bot @@ -24,7 +24,7 @@ module API DEFAULT_HEADERS = { 'Content-Type' => 'application/json; charset=UTF-8', - 'User-Agent' => "LINE-BotSDK-Ruby/#{VERSION}" + 'User-Agent' => "LINE-BotSDK-Ruby/#{LINE::Client::VERSION}" }.freeze end end diff --git a/lib/line/bot/api/errors.rb b/lib/deprecated/line/bot/api/errors.rb similarity index 100% rename from lib/line/bot/api/errors.rb rename to lib/deprecated/line/bot/api/errors.rb diff --git a/lib/line/bot/client.rb b/lib/deprecated/line/bot/client.rb similarity index 82% rename from lib/line/bot/client.rb rename to lib/deprecated/line/bot/client.rb index f03cd5fb..3b9941e4 100644 --- a/lib/line/bot/client.rb +++ b/lib/deprecated/line/bot/client.rb @@ -16,6 +16,7 @@ require 'net/http' require 'openssl' require 'uri' +require 'deprecated/line/bot/deprecate' module Line module Bot @@ -27,6 +28,8 @@ module Bot # config.channel_token = ENV["LINE_CHANNEL_TOKEN"] # end class Client + extend Line::Bot::Deprecate + # @return [String] attr_accessor :channel_token, :channel_id, :channel_secret, :endpoint, :blob_endpoint @@ -99,6 +102,7 @@ def issue_channel_token(grant_type = 'client_credentials') headers = { 'Content-Type' => 'application/x-www-form-urlencoded' } post(endpoint, endpoint_path, payload, headers) end + deprecate :issue_channel_token, 'LINE::Client::ChannelAccessToken::ChannelAccessTokenApi#issue_channel_token' # Revoke channel access token # @@ -109,6 +113,7 @@ def revoke_channel_token(access_token) headers = { 'Content-Type' => 'application/x-www-form-urlencoded' } post(endpoint, endpoint_path, payload, headers) end + deprecate :revoke_channel_token, 'LINE::Client::ChannelAccessToken::ChannelAccessTokenApi#revoke_channel_token' # Issue channel access token v2.1 # @@ -125,6 +130,7 @@ def issue_channel_access_token_jwt(jwt) headers = { 'Content-Type' => 'application/x-www-form-urlencoded' } post(oauth_endpoint, endpoint_path, payload, headers) end + deprecate :issue_channel_access_token_jwt, 'LINE::Client::ChannelAccessToken::ChannelAccessTokenApi#issue_channel_token_by_jwt' # Revoke channel access token v2.1 # @@ -144,6 +150,7 @@ def revoke_channel_access_token_jwt(access_token) headers = { 'Content-Type' => 'application/x-www-form-urlencoded' } post(oauth_endpoint, endpoint_path, payload, headers) end + deprecate :revoke_channel_access_token_jwt, 'LINE::Client::ChannelAccessToken::ChannelAccessTokenApi#revoke_channel_token_by_jwt' # Verify ID token # @@ -165,6 +172,7 @@ def verify_id_token(id_token, nonce: nil, user_id: nil) headers = { 'Content-Type' => 'application/x-www-form-urlencoded' } post(oauth_endpoint, endpoint_path, payload, headers) end + deprecate :verify_id_token # Verify access token v2.1 # @@ -178,6 +186,7 @@ def verify_access_token(access_token) endpoint_path = "/oauth2/v2.1/verify?#{payload}" get(oauth_endpoint, endpoint_path) end + deprecate :verify_access_token, 'LINE::Client::ChannelAccessToken::ChannelAccessTokenApi#verify_channel_token_by_jwt' # Get all valid channel access token key IDs v2.1 # @@ -194,6 +203,7 @@ def get_channel_access_token_key_ids_jwt(jwt) headers = { 'Content-Type' => 'application/x-www-form-urlencoded' } get(oauth_endpoint, endpoint_path, headers) end + deprecate :get_channel_access_token_key_ids_jwt, 'LINE::Client::ChannelAccessToken::ChannelAccessTokenApi#gets_all_valid_channel_access_token_key_ids' # Get user profile by access token # @@ -207,6 +217,7 @@ def get_profile_by_access_token(access_token) endpoint_path = "/v2/profile" get(oauth_endpoint, endpoint_path, headers) end + deprecate :get_profile_by_access_token # Push messages to a user using user_id. # @@ -224,6 +235,7 @@ def push_message(user_id, messages, headers: {}, payload: {}) payload = payload.merge({ to: user_id, messages: messages }).to_json post(endpoint, endpoint_path, payload, credentials.merge(headers)) end + deprecate :push_message, 'LINE::Client::MessagingApi::MessagingApiApi#push_message' # Reply messages to a user using replyToken. # @@ -254,6 +266,7 @@ def reply_message(token, messages) payload = { replyToken: token, messages: messages }.to_json post(endpoint, endpoint_path, payload, credentials) end + deprecate :reply_message, 'LINE::Client::MessagingApi::MessagingApiApi#reply_message' # Send messages to multiple users using userIds. # @@ -272,6 +285,7 @@ def multicast(to, messages, headers: {}, payload: {}) payload = payload.merge({ to: to, messages: messages }).to_json post(endpoint, endpoint_path, payload, credentials.merge(headers)) end + deprecate :multicast, 'LINE::Client::MessagingApi::MessagingApiApi#multicast' # Send messages to all friends. # @@ -288,6 +302,7 @@ def broadcast(messages, headers: {}) payload = { messages: messages }.to_json post(endpoint, endpoint_path, payload, credentials.merge(headers)) end + deprecate :broadcast, 'LINE::Client::MessagingApi::MessagingApiApi#broadcast' # Narrowcast messages to users # @@ -315,6 +330,7 @@ def narrowcast(messages, recipient: nil, filter: nil, limit: nil, headers: {}) }.to_json post(endpoint, endpoint_path, payload, credentials.merge(headers)) end + deprecate :narrowcast, 'LINE::Client::MessagingApi::MessagingApiApi#narrowcast' def leave_group(group_id) channel_token_required @@ -322,6 +338,7 @@ def leave_group(group_id) endpoint_path = "/bot/group/#{group_id}/leave" post(endpoint, endpoint_path, nil, credentials) end + deprecate :leave_group, 'LINE::Client::MessagingApi::MessagingApiApi#leave_group' def leave_room(room_id) channel_token_required @@ -329,6 +346,7 @@ def leave_room(room_id) endpoint_path = "/bot/room/#{room_id}/leave" post(endpoint, endpoint_path, nil, credentials) end + deprecate :leave_room, 'LINE::Client::MessagingApi::MessagingApiApi#leave_room' # Get message content. # @@ -340,6 +358,7 @@ def get_message_content(identifier) endpoint_path = "/bot/message/#{identifier}/content" get(blob_endpoint, endpoint_path, credentials) end + deprecate :get_message_content, 'LINE::Client::MessagingApi::MessagingApiBlobApi#get_message_content' # Get an user's profile. # @@ -351,6 +370,7 @@ def get_profile(user_id) endpoint_path = "/bot/profile/#{user_id}" get(endpoint, endpoint_path, credentials) end + deprecate :get_profile, 'LINE::Client::MessagingApi::MessagingApiApi#get_profile' # Get an user's profile of a group. # @@ -364,6 +384,7 @@ def get_group_member_profile(group_id, user_id) endpoint_path = "/bot/group/#{group_id}/member/#{user_id}" get(endpoint, endpoint_path, credentials) end + deprecate :get_group_member_profile, 'LINE::Client::MessagingApi::MessagingApiApi#get_group_member_profile' # Get an user's profile of a room. # @@ -377,6 +398,7 @@ def get_room_member_profile(room_id, user_id) endpoint_path = "/bot/room/#{room_id}/member/#{user_id}" get(endpoint, endpoint_path, credentials) end + deprecate :get_room_member_profile, 'LINE::Client::MessagingApi::MessagingApiApi#get_room_member_profile' # Get user IDs of who added your LINE Official Account as a friend # @@ -398,6 +420,7 @@ def get_follower_ids(deprecated_continuation_token = nil, start: nil, limit: nil endpoint_path += "?" + URI.encode_www_form(params) unless params.empty? get(endpoint, endpoint_path, credentials) end + deprecate :get_follower_ids, 'LINE::Client::MessagingApi::MessagingApiApi#get_followers' # Get user IDs of a group # @@ -413,6 +436,7 @@ def get_group_member_ids(group_id, continuation_token = nil) endpoint_path += "?start=#{continuation_token}" if continuation_token get(endpoint, endpoint_path, credentials) end + deprecate :get_group_member_ids, 'LINE::Client::MessagingApi::MessagingApiApi#get_group_members_ids' # Get user IDs of a room # @@ -428,6 +452,7 @@ def get_room_member_ids(room_id, continuation_token = nil) endpoint_path += "?start=#{continuation_token}" if continuation_token get(endpoint, endpoint_path, credentials) end + deprecate :get_room_member_ids, 'LINE::Client::MessagingApi::MessagingApiApi#get_room_members_ids' # Gets the group ID, group name, and group icon URL of a group where the LINE Official Account is a member. # @@ -440,6 +465,7 @@ def get_group_summary(group_id) endpoint_path = "/bot/group/#{group_id}/summary" get(endpoint, endpoint_path, credentials) end + deprecate :get_group_summary, 'LINE::Client::MessagingApi::MessagingApiApi#get_group_summary' # Gets the user IDs of the members of a group that the bot is in. # @@ -452,6 +478,7 @@ def get_group_members_count(group_id) endpoint_path = "/bot/group/#{group_id}/members/count" get(endpoint, endpoint_path, credentials) end + deprecate :get_group_members_count, 'LINE::Client::MessagingApi::MessagingApiApi#get_group_member_count' # Gets the count of members in a room. # @@ -464,6 +491,7 @@ def get_room_members_count(room_id) endpoint_path = "/bot/room/#{room_id}/members/count" get(endpoint, endpoint_path, credentials) end + deprecate :get_room_members_count, 'LINE::Client::MessagingApi::MessagingApiApi#get_room_member_count' # Get a list of all uploaded rich menus # @@ -474,6 +502,7 @@ def get_rich_menus endpoint_path = '/bot/richmenu/list' get(endpoint, endpoint_path, credentials) end + deprecate :get_rich_menus, 'LINE::Client::MessagingApi::MessagingApiApi#get_rich_menu_list' # Get a rich menu via a rich menu ID # @@ -486,6 +515,7 @@ def get_rich_menu(rich_menu_id) endpoint_path = "/bot/richmenu/#{rich_menu_id}" get(endpoint, endpoint_path, credentials) end + deprecate :get_rich_menu, 'LINE::Client::MessagingApi::MessagingApiApi#get_rich_menu' # Gets the number of messages sent with the /bot/message/reply endpoint. # @@ -498,6 +528,7 @@ def get_message_delivery_reply(date) endpoint_path = "/bot/message/delivery/reply?date=#{date}" get(endpoint, endpoint_path, credentials) end + deprecate :get_message_delivery_reply, 'LINE::Client::MessagingApi::MessagingApiApi#get_number_of_sent_reply_messages' # Gets the number of messages sent with the /bot/message/push endpoint. # @@ -510,6 +541,7 @@ def get_message_delivery_push(date) endpoint_path = "/bot/message/delivery/push?date=#{date}" get(endpoint, endpoint_path, credentials) end + deprecate :get_message_delivery_push, 'LINE::Client::MessagingApi::MessagingApiApi#get_number_of_sent_push_messages' # Gets the number of messages sent with the /bot/message/multicast endpoint. # @@ -522,6 +554,7 @@ def get_message_delivery_multicast(date) endpoint_path = "/bot/message/delivery/multicast?date=#{date}" get(endpoint, endpoint_path, credentials) end + deprecate :get_message_delivery_multicast, 'LINE::Client::MessagingApi::MessagingApiApi#get_number_of_sent_multicast_messages' # Gets the number of messages sent with the /bot/message/multicast endpoint. # @@ -534,6 +567,7 @@ def get_message_delivery_broadcast(date) endpoint_path = "/bot/message/delivery/broadcast?date=#{date}" get(endpoint, endpoint_path, credentials) end + deprecate :get_message_delivery_broadcast, 'LINE::Client::MessagingApi::MessagingApiApi#get_number_of_sent_broadcast_messages' # Validate message objects of a reply message # @@ -547,6 +581,7 @@ def validate_reply_message_objects(messages) payload = { messages: messages }.to_json post(endpoint, endpoint_path, payload, credentials) end + deprecate :validate_reply_message_objects, 'LINE::Client::MessagingApi::MessagingApiApi#validate_reply' # Validate message objects of a push message # @@ -560,6 +595,7 @@ def validate_push_message_objects(messages) payload = { messages: messages }.to_json post(endpoint, endpoint_path, payload, credentials) end + deprecate :validate_push_message_objects, 'LINE::Client::MessagingApi::MessagingApiApi#validate_push' # Validate message objects of a multicast message # @@ -573,6 +609,7 @@ def validate_multicast_message_objects(messages) payload = { messages: messages }.to_json post(endpoint, endpoint_path, payload, credentials) end + deprecate :validate_multicast_message_objects, 'LINE::Client::MessagingApi::MessagingApiApi#validate_multicast' # Validate message objects of a narrowcast message # @@ -586,6 +623,7 @@ def validate_narrowcast_message_objects(messages) payload = { messages: messages }.to_json post(endpoint, endpoint_path, payload, credentials) end + deprecate :validate_narrowcast_message_objects, 'LINE::Client::MessagingApi::MessagingApiApi#validate_narrowcast' # Validate message objects of a broadcast message # @@ -599,6 +637,7 @@ def validate_broadcast_message_objects(messages) payload = { messages: messages }.to_json post(endpoint, endpoint_path, payload, credentials) end + deprecate :validate_broadcast_message_objects, 'LINE::Client::MessagingApi::MessagingApiApi#validate_broadcast' # Create a rich menu # @@ -611,6 +650,7 @@ def create_rich_menu(rich_menu) endpoint_path = '/bot/richmenu' post(endpoint, endpoint_path, rich_menu.to_json, credentials) end + deprecate :create_rich_menu, 'LINE::Client::MessagingApi::MessagingApiApi#create_rich_menu' # Validate a rich menu object # @@ -623,6 +663,7 @@ def validate_rich_menu_object(rich_menu) endpoint_path = '/bot/richmenu/validate' post(endpoint, endpoint_path, rich_menu.to_json, credentials) end + deprecate :validate_rich_menu_object, 'LINE::Client::MessagingApi::MessagingApiApi#validate_rich_menu_object' # Delete a rich menu # @@ -635,6 +676,7 @@ def delete_rich_menu(rich_menu_id) endpoint_path = "/bot/richmenu/#{rich_menu_id}" delete(endpoint, endpoint_path, credentials) end + deprecate :delete_rich_menu, 'LINE::Client::MessagingApi::MessagingApiApi#delete_rich_menu' # Get the ID of the rich menu linked to a user # @@ -647,6 +689,7 @@ def get_user_rich_menu(user_id) endpoint_path = "/bot/user/#{user_id}/richmenu" get(endpoint, endpoint_path, credentials) end + deprecate :get_user_rich_menu, 'LINE::Client::MessagingApi::MessagingApiApi#get_rich_menu_id_of_user' # Get default rich menu # @@ -657,6 +700,7 @@ def get_default_rich_menu endpoint_path = '/bot/user/all/richmenu' get(endpoint, endpoint_path, credentials) end + deprecate :get_default_rich_menu, 'LINE::Client::MessagingApi::MessagingApiApi#get_default_rich_menu_id' # Set default rich menu (Link a rich menu to all user) # @@ -669,6 +713,7 @@ def set_default_rich_menu(rich_menu_id) endpoint_path = "/bot/user/all/richmenu/#{rich_menu_id}" post(endpoint, endpoint_path, nil, credentials) end + deprecate :set_default_rich_menu, 'LINE::Client::MessagingApi::MessagingApiApi#set_default_rich_menu' # Unset default rich menu (Unlink a rich menu from all user) # @@ -679,6 +724,7 @@ def unset_default_rich_menu endpoint_path = "/bot/user/all/richmenu" delete(endpoint, endpoint_path, credentials) end + deprecate :unset_default_rich_menu, 'LINE::Client::MessagingApi::MessagingApiApi#cancel_default_rich_menu' # Set rich menu alias # @@ -692,6 +738,7 @@ def set_rich_menus_alias(rich_menu_id, rich_menu_alias_id) endpoint_path = '/bot/richmenu/alias' post(endpoint, endpoint_path, { richMenuId: rich_menu_id, richMenuAliasId: rich_menu_alias_id }.to_json, credentials) end + deprecate :set_rich_menus_alias, 'LINE::Client::MessagingApi::MessagingApiApi#create_rich_menu_alias' # Unset rich menu alias # @@ -704,6 +751,7 @@ def unset_rich_menus_alias(rich_menu_alias_id) endpoint_path = "/bot/richmenu/alias/#{rich_menu_alias_id}" delete(endpoint, endpoint_path, credentials) end + deprecate :unset_rich_menus_alias, 'LINE::Client::MessagingApi::MessagingApiApi#delete_rich_menu_alias' # Update rich menu alias # @@ -717,6 +765,7 @@ def update_rich_menus_alias(rich_menu_id, rich_menu_alias_id) endpoint_path = "/bot/richmenu/alias/#{rich_menu_alias_id}" post(endpoint, endpoint_path, { richMenuId: rich_menu_id }.to_json, credentials) end + deprecate :update_rich_menus_alias, 'LINE::Client::MessagingApi::MessagingApiApi#update_rich_menu_alias' # Get a rich menu alias via a rich menu alias ID # @@ -729,6 +778,7 @@ def get_rich_menus_alias(rich_menu_alias_id) endpoint_path = "/bot/richmenu/alias/#{rich_menu_alias_id}" get(endpoint, endpoint_path, credentials) end + deprecate :get_rich_menus_alias, 'LINE::Client::MessagingApi::MessagingApiApi#get_rich_menu_alias' # Get a list of all uploaded rich menus alias # @@ -739,6 +789,7 @@ def get_rich_menus_alias_list endpoint_path = "/bot/richmenu/alias/list" get(endpoint, endpoint_path, credentials) end + deprecate :get_rich_menus_alias_list, 'LINE::Client::MessagingApi::MessagingApiApi#get_rich_menu_alias_list' # Link a rich menu to a user # @@ -755,6 +806,7 @@ def link_user_rich_menu(user_id, rich_menu_id) endpoint_path = "/bot/user/#{user_id}/richmenu/#{rich_menu_id}" post(endpoint, endpoint_path, nil, credentials) end + deprecate :link_user_rich_menu, 'LINE::Client::MessagingApi::MessagingApiApi#link_rich_menu_id_to_user' # Unlink a rich menu from a user # @@ -767,6 +819,7 @@ def unlink_user_rich_menu(user_id) endpoint_path = "/bot/user/#{user_id}/richmenu" delete(endpoint, endpoint_path, credentials) end + deprecate :unlink_user_rich_menu, 'LINE::Client::MessagingApi::MessagingApiApi#unlink_rich_menu_id_from_user' # To link a rich menu to multiple users at a time # @@ -780,6 +833,7 @@ def bulk_link_rich_menus(user_ids, rich_menu_id) endpoint_path = "/bot/richmenu/bulk/link" post(endpoint, endpoint_path, { richMenuId: rich_menu_id, userIds: user_ids }.to_json, credentials) end + deprecate :bulk_link_rich_menus, 'LINE::Client::MessagingApi::MessagingApiApi#link_rich_menu_id_to_users' # To unlink a rich menu from multiple users at a time # @@ -792,6 +846,7 @@ def bulk_unlink_rich_menus(user_ids) endpoint_path = "/bot/richmenu/bulk/unlink" post(endpoint, endpoint_path, { userIds: user_ids }.to_json, credentials) end + deprecate :bulk_unlink_rich_menus, 'LINE::Client::MessagingApi::MessagingApiApi#unlink_rich_menu_id_from_users' # Download an image associated with a rich menu # @@ -804,6 +859,7 @@ def get_rich_menu_image(rich_menu_id) endpoint_path = "/bot/richmenu/#{rich_menu_id}/content" get(blob_endpoint, endpoint_path, credentials) end + deprecate :get_rich_menu_image, 'LINE::Client::MessagingApi::MessagingApiBlobApi#get_rich_menu_image' # Upload and attaches an image to a rich menu # @@ -818,6 +874,7 @@ def create_rich_menu_image(rich_menu_id, file) headers = credentials.merge('Content-Type' => content_type(file)) post(blob_endpoint, endpoint_path, file.rewind && file.read, headers) end + deprecate :create_rich_menu_image, 'LINE::Client::MessagingApi::MessagingApiBlobApi#set_rich_menu_image' # Issue a link token to a user # @@ -830,6 +887,7 @@ def create_link_token(user_id) endpoint_path = "/bot/user/#{user_id}/linkToken" post(endpoint, endpoint_path, nil, credentials) end + deprecate :create_link_token, 'LINE::Client::MessagingApi::MessagingApiApi#issue_link_token' # Get the target limit for additional messages # @@ -840,6 +898,7 @@ def get_quota endpoint_path = "/bot/message/quota" get(endpoint, endpoint_path, credentials) end + deprecate :get_quota, 'LINE::Client::MessagingApi::MessagingApiApi#get_message_quota' # Get number of messages sent this month # @@ -850,6 +909,7 @@ def get_quota_consumption endpoint_path = "/bot/message/quota/consumption" get(endpoint, endpoint_path, credentials) end + deprecate :get_quota_consumption, 'LINE::Client::MessagingApi::MessagingApiApi#get_message_quota_consumption' # Returns the number of messages sent on a specified day # @@ -862,6 +922,7 @@ def get_number_of_message_deliveries(date) endpoint_path = "/bot/insight/message/delivery?date=#{date}" get(endpoint, endpoint_path, credentials) end + deprecate :get_number_of_message_deliveries, 'LINE::Client::Insight::InsightApi#get_number_of_message_deliveries' # Returns statistics about how users interact with narrowcast messages or broadcast messages sent from your LINE Official Account. # @@ -874,6 +935,7 @@ def get_user_interaction_statistics(request_id) endpoint_path = "/bot/insight/message/event?requestId=#{request_id}" get(endpoint, endpoint_path, credentials) end + deprecate :get_user_interaction_statistics, 'LINE::Client::Insight::InsightApi#get_message_event' # Returns the number of followers # @@ -886,6 +948,7 @@ def get_number_of_followers(date) endpoint_path = "/bot/insight/followers?date=#{date}" get(endpoint, endpoint_path, credentials) end + deprecate :get_number_of_followers, 'LINE::Client::Insight::InsightApi#get_number_of_followers' # Get the demographic attributes for a bot's friends. # @@ -896,6 +959,7 @@ def get_friend_demographics endpoint_path = '/bot/insight/demographic' get(endpoint, endpoint_path, credentials) end + deprecate :get_friend_demographics, 'LINE::Client::Insight::InsightApi#get_friends_demographics' # Gets a bot's basic information. # @@ -906,6 +970,7 @@ def get_bot_info endpoint_path = '/bot/info' get(endpoint, endpoint_path, credentials) end + deprecate :get_bot_info, 'LINE::Client::MessagingApi::MessagingApiApi#get_bot_info' # Gets information on a webhook endpoint. # @@ -916,6 +981,7 @@ def get_webhook_endpoint endpoint_path = '/bot/channel/webhook/endpoint' get(endpoint, endpoint_path, credentials) end + deprecate :get_webhook_endpoint, 'LINE::Client::MessagingApi::MessagingApiApi#get_webhook_endpoint' # Sets the webhook endpoint URL. # @@ -929,6 +995,7 @@ def set_webhook_endpoint(webhook_endpoint) body = {endpoint: webhook_endpoint} put(endpoint, endpoint_path, body.to_json, credentials) end + deprecate :set_webhook_endpoint, 'LINE::Client::MessagingApi::MessagingApiApi#set_webhook_endpoint' # Checks if the configured webhook endpoint can receive a test webhook event. # @@ -946,6 +1013,7 @@ def test_webhook_endpoint(webhook_endpoint = nil) end post(endpoint, endpoint_path, body.to_json, credentials) end + deprecate :test_webhook_endpoint, 'LINE::Client::MessagingApi::MessagingApiApi#test_webhook_endpoint' def get_liff_apps channel_token_required @@ -953,6 +1021,7 @@ def get_liff_apps endpoint_path = '/apps' get(liff_endpoint, endpoint_path, credentials) end + deprecate :get_liff_apps, 'LINE::Client::Liff::LiffApi#get_all_liff_apps' def create_liff_app(app) channel_token_required @@ -960,6 +1029,7 @@ def create_liff_app(app) endpoint_path = '/apps' post(liff_endpoint, endpoint_path, app.to_json, credentials) end + deprecate :create_liff_app, 'LINE::Client::Liff::LiffApi#add_liff_app' def update_liff_app(liff_id, app) channel_token_required @@ -967,6 +1037,7 @@ def update_liff_app(liff_id, app) endpoint_path = "/apps/#{liff_id}" put(liff_endpoint, endpoint_path, app.to_json, credentials) end + deprecate :update_liff_app, 'LINE::Client::Liff::LiffApi#update_liff_app' def delete_liff_app(liff_id) channel_token_required @@ -974,6 +1045,7 @@ def delete_liff_app(liff_id) endpoint_path = "/apps/#{liff_id}" delete(liff_endpoint, endpoint_path, credentials) end + deprecate :delete_liff_app, 'LINE::Client::Liff::LiffApi#delete_liff_app' # Create an audience group by uploading user_ids # @@ -989,6 +1061,7 @@ def create_user_id_audience(params) endpoint_path = '/bot/audienceGroup/upload' post(endpoint, endpoint_path, params.to_json, credentials) end + deprecate :create_user_id_audience, 'LINE::Client::ManageAudience::ManageAudienceApi#create_audience_group' # Update an audience group # @@ -1004,6 +1077,7 @@ def update_user_id_audience(params) endpoint_path = '/bot/audienceGroup/upload' put(endpoint, endpoint_path, params.to_json, credentials) end + deprecate :update_user_id_audience, 'LINE::Client::ManageAudience::ManageAudienceApi#add_audience_to_audience_group' # Create an audience group of users that clicked a URL in a message sent in the past # @@ -1019,6 +1093,7 @@ def create_click_audience(params) endpoint_path = '/bot/audienceGroup/click' post(endpoint, endpoint_path, params.to_json, credentials) end + deprecate :create_click_audience, 'LINE::Client::ManageAudience::ManageAudienceApi#create_click_based_audience_group' # Create an audience group of users that opened a message sent in the past # @@ -1034,6 +1109,7 @@ def create_impression_audience(params) endpoint_path = '/bot/audienceGroup/imp' post(endpoint, endpoint_path, params.to_json, credentials) end + deprecate :create_impression_audience, 'LINE::Client::ManageAudience::ManageAudienceApi#create_imp_based_audience_group' # Rename an existing audience group # @@ -1048,6 +1124,7 @@ def rename_audience(audience_group_id, description) body = {description: description} put(endpoint, endpoint_path, body.to_json, credentials) end + deprecate :rename_audience, 'LINE::Client::ManageAudience::ManageAudienceApi#update_audience_group_description' # Delete an existing audience group # @@ -1063,6 +1140,7 @@ def delete_audience(audience_group_id) endpoint_path = "/bot/audienceGroup/#{audience_group_id}" delete(endpoint, endpoint_path, credentials) end + deprecate :delete_audience, 'LINE::Client::ManageAudience::ManageAudienceApi#delete_audience_group' # Get audience group data # @@ -1078,6 +1156,7 @@ def get_audience(audience_group_id) endpoint_path = "/bot/audienceGroup/#{audience_group_id}" get(endpoint, endpoint_path, credentials) end + deprecate :get_audience, 'LINE::Client::ManageAudience::ManageAudienceApi#get_audience_data' # Get data for more than one audience group # @@ -1093,6 +1172,7 @@ def get_audiences(params) endpoint_path = "/bot/audienceGroup/list?" + URI.encode_www_form(params) get(endpoint, endpoint_path, credentials) end + deprecate :get_audiences, 'LINE::Client::ManageAudience::ManageAudienceApi#get_audience_groups' # Get the authority level of the audience # @@ -1106,6 +1186,7 @@ def get_audience_authority_level endpoint_path = "/bot/audienceGroup/authorityLevel" get(endpoint, endpoint_path, credentials) end + deprecate :get_audience_authority_level, 'LINE::Client::ManageAudience::ManageAudienceApi#get_audience_group_authority_level' # Change the authority level of the audience # @@ -1122,6 +1203,7 @@ def update_audience_authority_level(authority_level) body = {authorityLevel: authority_level} put(endpoint, endpoint_path, body.to_json, credentials) end + deprecate :update_audience_authority_level, 'LINE::Client::ManageAudience::ManageAudienceApi#update_audience_group_authority_level' # Get the per-unit statistics of how users interact with push messages and multicast messages. # @@ -1137,6 +1219,7 @@ def get_statistics_per_unit(unit:, from:, to:) endpoint_path = "/bot/insight/message/event/aggregation?" + URI.encode_www_form(params) get(endpoint, endpoint_path, credentials) end + deprecate :get_statistics_per_unit, 'LINE::Client::Insight::InsightApi#get_statistics_per_unit' # Get the number of aggregation units used this month. # @@ -1147,6 +1230,7 @@ def get_aggregation_info endpoint_path = "/bot/message/aggregation/info" get(endpoint, endpoint_path, credentials) end + deprecate :get_aggregation_info, 'LINE::Client::MessagingApi::MessagingApiApi#get_aggregation_unit_usage' # Get the name list of units used this month for statistics aggregation. # @@ -1161,6 +1245,7 @@ def get_aggregation_list(limit: nil, start: nil) endpoint_path = "/bot/message/aggregation/list?" + URI.encode_www_form(params) get(endpoint, endpoint_path, credentials) end + deprecate :get_aggregation_list, 'LINE::Client::MessagingApi::MessagingApiApi#get_aggregation_unit_name_list' # Gets the status of a narrowcast message. # @@ -1173,6 +1258,7 @@ def get_narrowcast_message_status(request_id) endpoint_path = "/bot/message/progress/narrowcast?requestId=#{request_id}" get(endpoint, endpoint_path, credentials) end + deprecate :get_narrowcast_message_status, 'LINE::Client::MessagingApi::MessagingApiApi#get_narrowcast_progress' # Send messages to multiple users using phone numbers. # @@ -1193,6 +1279,7 @@ def multicast_by_phone_numbers(to, messages, headers: {}, payload: {}) payload = payload.merge({ to: to, messages: messages }).to_json post(oauth_endpoint, endpoint_path, payload, credentials.merge(headers)) end + deprecate :multicast_by_phone_numbers, 'LINE::Client::MessagingApi::MessagingApiApi#audience_match' # Get the delivery result of the message delivered in Send message using phone number. (`#multicast_by_phone_numbers`) # @@ -1206,6 +1293,7 @@ def get_delivery_result_sent_by_phone_numbers(date) endpoint_path = "/bot/message/delivery/ad_phone?date=#{date}" get(endpoint, endpoint_path, credentials) end + deprecate :get_delivery_result_sent_by_phone_numbers, 'LINE::Client::MessagingApi::MessagingApiApi#get_ad_phone_message_statistics' # Fetch data, get content of specified URL. # @@ -1266,12 +1354,10 @@ def parse_events_from(request_body) json = JSON.parse(request_body) json['events'].map do |item| - begin - klass = Event.const_get(Util.camelize(item['type'])) - klass.new(item) - rescue NameError - Event::Base.new(item) - end + klass = Event.const_get(Util.camelize(item['type'])) + klass.new(item) + rescue NameError + Event::Base.new(item) end end diff --git a/lib/deprecated/line/bot/deprecate.rb b/lib/deprecated/line/bot/deprecate.rb new file mode 100644 index 00000000..69e977eb --- /dev/null +++ b/lib/deprecated/line/bot/deprecate.rb @@ -0,0 +1,34 @@ +# Copyright 2016 LINE +# +# 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. + +module Line + module Bot + module Deprecate + def deprecate(name, replacement = nil) + class_eval do + deprecated_name = "_deprecated_#{name}" + alias_method deprecated_name, name + define_method name do |*args, &block| + message = "NOTE: #{self.class}##{name} is deprecated" + message += "; use #{replacement} instead" if replacement + message += "." + warn message + send deprecated_name, *args, &block + end + ruby2_keywords name if respond_to?(:ruby2_keywords, true) + end + end + end + end +end diff --git a/lib/deprecated/line/bot/event.rb b/lib/deprecated/line/bot/event.rb new file mode 100644 index 00000000..ff8a0643 --- /dev/null +++ b/lib/deprecated/line/bot/event.rb @@ -0,0 +1,28 @@ +# Copyright 2016 LINE +# +# 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. + +require 'deprecated/line/bot/event/base' +require 'deprecated/line/bot/event/account_link' +require 'deprecated/line/bot/event/beacon' +require 'deprecated/line/bot/event/follow' +require 'deprecated/line/bot/event/join' +require 'deprecated/line/bot/event/leave' +require 'deprecated/line/bot/event/message' +require 'deprecated/line/bot/event/postback' +require 'deprecated/line/bot/event/unfollow' +require 'deprecated/line/bot/event/unsend' +require 'deprecated/line/bot/event/member_joined' +require 'deprecated/line/bot/event/member_left' +require 'deprecated/line/bot/event/things' +require 'deprecated/line/bot/event/video_play_complete' diff --git a/lib/line/bot/event/account_link.rb b/lib/deprecated/line/bot/event/account_link.rb similarity index 100% rename from lib/line/bot/event/account_link.rb rename to lib/deprecated/line/bot/event/account_link.rb diff --git a/lib/line/bot/event/base.rb b/lib/deprecated/line/bot/event/base.rb similarity index 100% rename from lib/line/bot/event/base.rb rename to lib/deprecated/line/bot/event/base.rb diff --git a/lib/line/bot/event/beacon.rb b/lib/deprecated/line/bot/event/beacon.rb similarity index 100% rename from lib/line/bot/event/beacon.rb rename to lib/deprecated/line/bot/event/beacon.rb diff --git a/lib/line/bot/event/follow.rb b/lib/deprecated/line/bot/event/follow.rb similarity index 100% rename from lib/line/bot/event/follow.rb rename to lib/deprecated/line/bot/event/follow.rb diff --git a/lib/line/bot/event/join.rb b/lib/deprecated/line/bot/event/join.rb similarity index 100% rename from lib/line/bot/event/join.rb rename to lib/deprecated/line/bot/event/join.rb diff --git a/lib/line/bot/event/leave.rb b/lib/deprecated/line/bot/event/leave.rb similarity index 100% rename from lib/line/bot/event/leave.rb rename to lib/deprecated/line/bot/event/leave.rb diff --git a/lib/line/bot/event/member_joined.rb b/lib/deprecated/line/bot/event/member_joined.rb similarity index 100% rename from lib/line/bot/event/member_joined.rb rename to lib/deprecated/line/bot/event/member_joined.rb diff --git a/lib/line/bot/event/member_left.rb b/lib/deprecated/line/bot/event/member_left.rb similarity index 100% rename from lib/line/bot/event/member_left.rb rename to lib/deprecated/line/bot/event/member_left.rb diff --git a/lib/line/bot/event/message.rb b/lib/deprecated/line/bot/event/message.rb similarity index 100% rename from lib/line/bot/event/message.rb rename to lib/deprecated/line/bot/event/message.rb diff --git a/lib/line/bot/event/postback.rb b/lib/deprecated/line/bot/event/postback.rb similarity index 100% rename from lib/line/bot/event/postback.rb rename to lib/deprecated/line/bot/event/postback.rb diff --git a/lib/line/bot/event/things.rb b/lib/deprecated/line/bot/event/things.rb similarity index 100% rename from lib/line/bot/event/things.rb rename to lib/deprecated/line/bot/event/things.rb diff --git a/lib/line/bot/event/unfollow.rb b/lib/deprecated/line/bot/event/unfollow.rb similarity index 100% rename from lib/line/bot/event/unfollow.rb rename to lib/deprecated/line/bot/event/unfollow.rb diff --git a/lib/line/bot/event/unsend.rb b/lib/deprecated/line/bot/event/unsend.rb similarity index 100% rename from lib/line/bot/event/unsend.rb rename to lib/deprecated/line/bot/event/unsend.rb diff --git a/lib/line/bot/event/video_play_complete.rb b/lib/deprecated/line/bot/event/video_play_complete.rb similarity index 100% rename from lib/line/bot/event/video_play_complete.rb rename to lib/deprecated/line/bot/event/video_play_complete.rb diff --git a/lib/line/bot/httpclient.rb b/lib/deprecated/line/bot/httpclient.rb similarity index 100% rename from lib/line/bot/httpclient.rb rename to lib/deprecated/line/bot/httpclient.rb diff --git a/lib/line/bot/util.rb b/lib/deprecated/line/bot/util.rb similarity index 100% rename from lib/line/bot/util.rb rename to lib/deprecated/line/bot/util.rb diff --git a/lib/line-bot-api.rb b/lib/line-bot-api.rb index 7a175743..2dd26c74 100644 --- a/lib/line-bot-api.rb +++ b/lib/line-bot-api.rb @@ -1 +1,4 @@ -require 'line/bot' +require 'line/client' + +# Deprecated +require 'deprecated/line/bot' diff --git a/lib/line/bot/event.rb b/lib/line/bot/event.rb deleted file mode 100644 index 4d183091..00000000 --- a/lib/line/bot/event.rb +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2016 LINE -# -# 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. - -require 'line/bot/event/base' -require 'line/bot/event/account_link' -require 'line/bot/event/beacon' -require 'line/bot/event/follow' -require 'line/bot/event/join' -require 'line/bot/event/leave' -require 'line/bot/event/message' -require 'line/bot/event/postback' -require 'line/bot/event/unfollow' -require 'line/bot/event/unsend' -require 'line/bot/event/member_joined' -require 'line/bot/event/member_left' -require 'line/bot/event/things' -require 'line/bot/event/video_play_complete' diff --git a/lib/line/client.rb b/lib/line/client.rb new file mode 100644 index 00000000..154d5af5 --- /dev/null +++ b/lib/line/client.rb @@ -0,0 +1,45 @@ +# Copyright 2016 LINE +# +# 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. + +require 'line/client/version' +require 'line/client/webhook' + +clients_dir = File.expand_path('../clients', __dir__) + +clients = [ + 'channel-access-token', + 'insight', + 'liff', + 'manage-audience', + 'messaging-api', + 'module-attach', + 'module', + 'shop', + 'webhook' +] + +clients.each do |client| + lib_dir = "#{clients_dir}/#{client}/lib" + $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir) +end + +require 'line_client_channel_access_token' +require 'line_client_insight' +require 'line_client_liff' +require 'line_client_manage_audience' +require 'line_client_messaging_api' +require 'line_client_module_attach' +require 'line_client_module' +require 'line_client_shop' +require 'line_client_webhook' diff --git a/lib/line/bot/api/version.rb b/lib/line/client/version.rb similarity index 89% rename from lib/line/bot/api/version.rb rename to lib/line/client/version.rb index a80b3bca..5461b0d5 100644 --- a/lib/line/bot/api/version.rb +++ b/lib/line/client/version.rb @@ -12,10 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -module Line - module Bot - module API - VERSION = "1.28.0" - end +module LINE + module Client + VERSION = '2.0.0' end end diff --git a/lib/line/client/webhook.rb b/lib/line/client/webhook.rb new file mode 100644 index 00000000..7130551d --- /dev/null +++ b/lib/line/client/webhook.rb @@ -0,0 +1,50 @@ +module LINE + module Client + module Webhook + class << self + # Verify that the request was sent from the LINE Platform + # + # @param body [String] Request body + # @param signature [String] x-line-signature in the request header + # @param channel_secret [String] Channel secret + # + # @return [Boolean] + def validate_signature(body, signature, channel_secret) + digest = OpenSSL::HMAC.digest(OpenSSL::Digest.new('SHA256'), channel_secret, body) + signature == Base64.strict_encode64(digest) + end + + # Parse events from the request body + # + # @param body [String] Request body + # + # @return [Array] + def parse_events_from(body) + json = JSON.parse(body) + json = underscore(json) + json['events'].map do |event| + class_name = event['type'].gsub(/^./, &:upcase) + begin + LINE::Client::Webhook.const_get("#{class_name}Event").new(event) + rescue NameError + LINE::Client::Webhook::Event.new(event) + end + end + end + + private + + def underscore(object) + case object + when Hash + object.transform_keys! { |key| key.gsub(/([a-z\d])([A-Z])/, '\1_\2').downcase } + object.transform_values! { |value| underscore(value) } + when Array + object.map! { |value| underscore(value) } + end + object + end + end + end + end +end diff --git a/line-bot-api.gemspec b/line-bot-api.gemspec index d80c701f..213e341f 100644 --- a/line-bot-api.gemspec +++ b/line-bot-api.gemspec @@ -1,26 +1,31 @@ lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require 'line/bot/api/version' + +require 'line/client/version' Gem::Specification.new do |spec| - spec.name = "line-bot-api" - spec.version = Line::Bot::API::VERSION - spec.authors = ["LINE Corporation"] - spec.email = ["kimoto@linecorp.com", "todaka.yusuke@linecorp.com", "masaki_kurosawa@linecorp.com"] + spec.name = 'line-bot-api' + spec.version = LINE::Client::VERSION + spec.authors = ['LINE Corporation'] + spec.email = ['kimoto@linecorp.com', 'todaka.yusuke@linecorp.com', 'masaki_kurosawa@linecorp.com'] - spec.description = "Line::Bot::API - SDK of the LINE Messaging API for Ruby" - spec.summary = "SDK of the LINE Messaging API" - spec.homepage = "https://github.com/line/line-bot-sdk-ruby" - spec.license = "Apache-2.0" + spec.description = 'LINE Messaging API SDK for Ruby' + spec.summary = 'LINE Messaging API SDK for Ruby' + spec.homepage = 'https://github.com/line/line-bot-sdk-ruby' + spec.license = 'Apache-2.0' spec.files = %w(CONTRIBUTING.md LICENSE README.md line-bot-api.gemspec) + Dir['lib/**/*.rb'] spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) - spec.require_paths = ["lib"] + spec.require_paths = ['lib'] + + spec.required_ruby_version = '>= 2.7.0' + + spec.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' - spec.required_ruby_version = '>= 2.4.0' + spec.add_development_dependency 'rspec', '~> 3.0' + spec.add_development_dependency 'webmock', '~> 3.8' - spec.add_development_dependency "addressable", "~> 2.3" - spec.add_development_dependency 'rake', "~> 13.0" - spec.add_development_dependency "rspec", "~> 3.0" - spec.add_development_dependency "webmock", "~> 3.8" + # Deprecated + spec.add_development_dependency 'addressable', '~> 2.3' + spec.add_development_dependency 'rake', '~> 13.0' end diff --git a/line-openapi b/line-openapi new file mode 160000 index 00000000..cdac9465 --- /dev/null +++ b/line-openapi @@ -0,0 +1 @@ +Subproject commit cdac9465346ff0fd97ec2435462d15d45450a168 diff --git a/spec/fixtures/line/bot/preview.jpg b/spec/deprecated/fixtures/line/bot/preview.jpg similarity index 100% rename from spec/fixtures/line/bot/preview.jpg rename to spec/deprecated/fixtures/line/bot/preview.jpg diff --git a/spec/fixtures/line/bot/rich_menu_01.png b/spec/deprecated/fixtures/line/bot/rich_menu_01.png similarity index 100% rename from spec/fixtures/line/bot/rich_menu_01.png rename to spec/deprecated/fixtures/line/bot/rich_menu_01.png diff --git a/spec/fixtures/line/bot/rich_menu_01.txt b/spec/deprecated/fixtures/line/bot/rich_menu_01.txt similarity index 100% rename from spec/fixtures/line/bot/rich_menu_01.txt rename to spec/deprecated/fixtures/line/bot/rich_menu_01.txt diff --git a/spec/fixtures/line/bot/video.mp4 b/spec/deprecated/fixtures/line/bot/video.mp4 similarity index 100% rename from spec/fixtures/line/bot/video.mp4 rename to spec/deprecated/fixtures/line/bot/video.mp4 diff --git a/spec/line/bot/client_aggregation_spec.rb b/spec/deprecated/line/bot/client_aggregation_spec.rb similarity index 100% rename from spec/line/bot/client_aggregation_spec.rb rename to spec/deprecated/line/bot/client_aggregation_spec.rb diff --git a/spec/line/bot/client_audience_match_spec.rb b/spec/deprecated/line/bot/client_audience_match_spec.rb similarity index 100% rename from spec/line/bot/client_audience_match_spec.rb rename to spec/deprecated/line/bot/client_audience_match_spec.rb diff --git a/spec/line/bot/client_audience_spec.rb b/spec/deprecated/line/bot/client_audience_spec.rb similarity index 100% rename from spec/line/bot/client_audience_spec.rb rename to spec/deprecated/line/bot/client_audience_spec.rb diff --git a/spec/line/bot/client_channel_token_spec.rb b/spec/deprecated/line/bot/client_channel_token_spec.rb similarity index 100% rename from spec/line/bot/client_channel_token_spec.rb rename to spec/deprecated/line/bot/client_channel_token_spec.rb diff --git a/spec/line/bot/client_get_follower_spec.rb b/spec/deprecated/line/bot/client_get_follower_spec.rb similarity index 100% rename from spec/line/bot/client_get_follower_spec.rb rename to spec/deprecated/line/bot/client_get_follower_spec.rb diff --git a/spec/line/bot/client_get_group_or_room_member_spec.rb b/spec/deprecated/line/bot/client_get_group_or_room_member_spec.rb similarity index 100% rename from spec/line/bot/client_get_group_or_room_member_spec.rb rename to spec/deprecated/line/bot/client_get_group_or_room_member_spec.rb diff --git a/spec/line/bot/client_get_spec.rb b/spec/deprecated/line/bot/client_get_spec.rb similarity index 100% rename from spec/line/bot/client_get_spec.rb rename to spec/deprecated/line/bot/client_get_spec.rb diff --git a/spec/line/bot/client_parse_spec.rb b/spec/deprecated/line/bot/client_parse_spec.rb similarity index 100% rename from spec/line/bot/client_parse_spec.rb rename to spec/deprecated/line/bot/client_parse_spec.rb diff --git a/spec/line/bot/client_spec.rb b/spec/deprecated/line/bot/client_spec.rb similarity index 96% rename from spec/line/bot/client_spec.rb rename to spec/deprecated/line/bot/client_spec.rb index a6b69a3e..967ed679 100644 --- a/spec/line/bot/client_spec.rb +++ b/spec/deprecated/line/bot/client_spec.rb @@ -97,7 +97,7 @@ def generate_client header = result[:header] expect(header['Authorization']).to eq "Bearer #{dummy_config[:channel_token]}" - expect(header['User-Agent']).to eq "LINE-BotSDK-Ruby/" + Line::Bot::API::VERSION + expect(header['User-Agent']).to eq "LINE-BotSDK-Ruby/" + LINE::Client::VERSION expect(result[:payload]).to be nil @@ -114,7 +114,7 @@ def generate_client header = result[:header] expect(header['Authorization']).to eq "Bearer #{dummy_config[:channel_token]}" - expect(header['User-Agent']).to eq "LINE-BotSDK-Ruby/" + Line::Bot::API::VERSION + expect(header['User-Agent']).to eq "LINE-BotSDK-Ruby/" + LINE::Client::VERSION expect(header['Content-Type']).to eq "application/json; charset=UTF-8" body = JSON.parse(result[:payload], symbolize_names: true) diff --git a/spec/line/bot/client_validate_message_objects_spec.rb b/spec/deprecated/line/bot/client_validate_message_objects_spec.rb similarity index 100% rename from spec/line/bot/client_validate_message_objects_spec.rb rename to spec/deprecated/line/bot/client_validate_message_objects_spec.rb diff --git a/spec/line/bot/client_validate_spec.rb b/spec/deprecated/line/bot/client_validate_spec.rb similarity index 100% rename from spec/line/bot/client_validate_spec.rb rename to spec/deprecated/line/bot/client_validate_spec.rb diff --git a/spec/line/bot/liff_spec.rb b/spec/deprecated/line/bot/liff_spec.rb similarity index 100% rename from spec/line/bot/liff_spec.rb rename to spec/deprecated/line/bot/liff_spec.rb diff --git a/spec/line/bot/link_token_spec.rb b/spec/deprecated/line/bot/link_token_spec.rb similarity index 100% rename from spec/line/bot/link_token_spec.rb rename to spec/deprecated/line/bot/link_token_spec.rb diff --git a/spec/line/bot/mock_http_client.rb b/spec/deprecated/line/bot/mock_http_client.rb similarity index 100% rename from spec/line/bot/mock_http_client.rb rename to spec/deprecated/line/bot/mock_http_client.rb diff --git a/spec/line/bot/rich_menu_spec.rb b/spec/deprecated/line/bot/rich_menu_spec.rb similarity index 98% rename from spec/line/bot/rich_menu_spec.rb rename to spec/deprecated/line/bot/rich_menu_spec.rb index 0c713414..0daec50d 100644 --- a/spec/line/bot/rich_menu_spec.rb +++ b/spec/deprecated/line/bot/rich_menu_spec.rb @@ -55,8 +55,8 @@ } EOS -RICH_MENU_IMAGE_FILE_PATH = 'spec/fixtures/line/bot/rich_menu_01.png' -RICH_MENU_INVALID_FILE_EXTENSION_PATH = 'spec/fixtures/line/bot/rich_menu_01.txt' +RICH_MENU_IMAGE_FILE_PATH = 'spec/deprecated/fixtures/line/bot/rich_menu_01.png' +RICH_MENU_INVALID_FILE_EXTENSION_PATH = 'spec/deprecated/fixtures/line/bot/rich_menu_01.txt' describe Line::Bot::Client do let(:client) do diff --git a/spec/line/bot/send_message_01_text_spec.rb b/spec/deprecated/line/bot/send_message_01_text_spec.rb similarity index 100% rename from spec/line/bot/send_message_01_text_spec.rb rename to spec/deprecated/line/bot/send_message_01_text_spec.rb diff --git a/spec/line/bot/send_message_02_image_spec.rb b/spec/deprecated/line/bot/send_message_02_image_spec.rb similarity index 100% rename from spec/line/bot/send_message_02_image_spec.rb rename to spec/deprecated/line/bot/send_message_02_image_spec.rb diff --git a/spec/line/bot/send_message_03_video_spec.rb b/spec/deprecated/line/bot/send_message_03_video_spec.rb similarity index 100% rename from spec/line/bot/send_message_03_video_spec.rb rename to spec/deprecated/line/bot/send_message_03_video_spec.rb diff --git a/spec/line/bot/send_message_04_audio_spec.rb b/spec/deprecated/line/bot/send_message_04_audio_spec.rb similarity index 100% rename from spec/line/bot/send_message_04_audio_spec.rb rename to spec/deprecated/line/bot/send_message_04_audio_spec.rb diff --git a/spec/line/bot/send_message_05_location_spec.rb b/spec/deprecated/line/bot/send_message_05_location_spec.rb similarity index 100% rename from spec/line/bot/send_message_05_location_spec.rb rename to spec/deprecated/line/bot/send_message_05_location_spec.rb diff --git a/spec/line/bot/send_message_06_sticker_spec.rb b/spec/deprecated/line/bot/send_message_06_sticker_spec.rb similarity index 100% rename from spec/line/bot/send_message_06_sticker_spec.rb rename to spec/deprecated/line/bot/send_message_06_sticker_spec.rb diff --git a/spec/line/bot/send_message_07_imagemap_spec.rb b/spec/deprecated/line/bot/send_message_07_imagemap_spec.rb similarity index 100% rename from spec/line/bot/send_message_07_imagemap_spec.rb rename to spec/deprecated/line/bot/send_message_07_imagemap_spec.rb diff --git a/spec/line/bot/send_message_08_image_carousel_spec.rb b/spec/deprecated/line/bot/send_message_08_image_carousel_spec.rb similarity index 100% rename from spec/line/bot/send_message_08_image_carousel_spec.rb rename to spec/deprecated/line/bot/send_message_08_image_carousel_spec.rb diff --git a/spec/line/bot/send_message_11_template_buttons_spec.rb b/spec/deprecated/line/bot/send_message_11_template_buttons_spec.rb similarity index 100% rename from spec/line/bot/send_message_11_template_buttons_spec.rb rename to spec/deprecated/line/bot/send_message_11_template_buttons_spec.rb diff --git a/spec/line/bot/send_message_12_template_confirm_spec.rb b/spec/deprecated/line/bot/send_message_12_template_confirm_spec.rb similarity index 100% rename from spec/line/bot/send_message_12_template_confirm_spec.rb rename to spec/deprecated/line/bot/send_message_12_template_confirm_spec.rb diff --git a/spec/line/bot/send_message_13_template_carousel_spec.rb b/spec/deprecated/line/bot/send_message_13_template_carousel_spec.rb similarity index 100% rename from spec/line/bot/send_message_13_template_carousel_spec.rb rename to spec/deprecated/line/bot/send_message_13_template_carousel_spec.rb diff --git a/spec/line/bot/send_message_14_template_datepicker_spec.rb b/spec/deprecated/line/bot/send_message_14_template_datepicker_spec.rb similarity index 100% rename from spec/line/bot/send_message_14_template_datepicker_spec.rb rename to spec/deprecated/line/bot/send_message_14_template_datepicker_spec.rb diff --git a/spec/line/bot/webhook_spec.rb b/spec/deprecated/line/bot/webhook_spec.rb similarity index 100% rename from spec/line/bot/webhook_spec.rb rename to spec/deprecated/line/bot/webhook_spec.rb diff --git a/spec/line/bot/api/spec.rb b/spec/line/bot/api/spec.rb deleted file mode 100644 index f7ca1da0..00000000 --- a/spec/line/bot/api/spec.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'spec_helper' - -describe Line::Bot::API do - it 'has a version number' do - expect(Line::Bot::API::VERSION).not_to be nil - end -end diff --git a/spec/line/client/webhook_spec.rb b/spec/line/client/webhook_spec.rb new file mode 100644 index 00000000..774f65a8 --- /dev/null +++ b/spec/line/client/webhook_spec.rb @@ -0,0 +1,46 @@ +require 'spec_helper' + +describe LINE::Client::Webhook do + let(:body) do + JSON.generate( + destination: 'xxxxxxxxxx', + events: [ + { + replyToken: 'nHuyWiB7yP5Zw52FIkcQobQuGDXCTA', + type: 'videoPlayComplete', + mode: 'active', + timestamp: 1462629479859, + source: { + type: 'user', + userId: 'U4af4980629...' + }, + webhookEventId: '01FZ74A0TDDPYRVKNK77XKC3ZR', + deliveryContext: { + isRedelivery: false + }, + videoPlayComplete: { + trackingId: 'track-id' + } + } + ] + ) + end + let(:channel_secret) { 'channel secret' } + + it 'validates a signature with success' do + result = LINE::Client::Webhook.validate_signature(body, 'moA4ZK/DQvvl3uSUh1tkXnyLDiQa4t17vcieTpAKKls=', channel_secret) + expect(result).to be_truthy + end + + it 'validates a signature with failure' do + result = LINE::Client::Webhook.validate_signature(body, 'invalid signature', channel_secret) + expect(result).to be_falsey + end + + it 'parses events from the body' do + events = LINE::Client::Webhook.parse_events_from(body) + event = events[0] + expect(event.class).to eq LINE::Client::Webhook::VideoPlayCompleteEvent + expect(event.reply_token).to eq 'nHuyWiB7yP5Zw52FIkcQobQuGDXCTA' + end +end diff --git a/spec/line/clients/messaging_api_spec.rb b/spec/line/clients/messaging_api_spec.rb new file mode 100644 index 00000000..ca7269f3 --- /dev/null +++ b/spec/line/clients/messaging_api_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper' +require 'webmock/rspec' + +describe LINE::Client::MessagingApi do + it 'gets webhook endpoint information' do + stub_request(:get, 'https://api.line.me/v2/bot/channel/webhook/endpoint') + .with( + headers: { + 'Authorization' => 'Bearer YOUR_BEARER_TOKEN', + } + ) + .to_return( + status: 200, + body: JSON.generate( + 'endpoint': 'https://example.com/test', + 'active': true + ), + headers: {} + ) + + LINE::Client::MessagingApi.configure do |config| + config.access_token = 'YOUR_BEARER_TOKEN' + end + + api_instance = LINE::Client::MessagingApi::MessagingApiApi.new + result = api_instance.get_webhook_endpoint + expect(result.endpoint).to eq 'https://example.com/test' + expect(result.active).to be_truthy + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ac827c97..724f4b51 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,2 +1,6 @@ $LOAD_PATH.unshift File.expand_path('../lib', __dir__) -require 'line/bot' + +require 'line/client' + +# Deprecated +require 'deprecated/line/bot' diff --git a/src/main/resources/ruby-client/README.mustache b/src/main/resources/ruby-client/README.mustache new file mode 100644 index 00000000..303dbe76 --- /dev/null +++ b/src/main/resources/ruby-client/README.mustache @@ -0,0 +1,156 @@ +# {{moduleName}} + +{{#appDescriptionWithNewLines}} +{{{.}}} +{{/appDescriptionWithNewLines}} + +This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: {{appVersion}} +- Package version: {{gemVersion}} +{{^hideGenerationTimestamp}} +- Build date: {{generatedDate}} +{{/hideGenerationTimestamp}} +- Build package: {{generatorClass}} +{{#infoUrl}} +For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) +{{/infoUrl}} + +## Installation + +### Build a gem + +To build the Ruby code into a gem: + +```shell +gem build line-bot-api.gemspec +``` + +Then either install the gem locally: + +```shell +gem install ./line-bot-api-{{{gemVersion}}}.gem +``` + +(for development, run `gem install --dev ./line-bot-api-{{{gemVersion}}}.gem` to install the development dependencies) + +or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/). + +Finally add this to the Gemfile: + + gem 'line-bot-api', '~> {{{gemVersion}}}' + +### Install from Git + +If the Ruby gem is hosted at a git repository: https://{{gitHost}}/{{gitUserId}}{{^gitUserId}}YOUR_GIT_USERNAME{{/gitUserId}}/{{gitRepoId}}{{^gitRepoId}}YOUR_GIT_REPO{{/gitRepoId}}, then add the following in the Gemfile: + + gem 'line-bot-api', :git => 'https://{{gitHost}}/{{gitUserId}}{{^gitUserId}}YOUR_GIT_USERNAME{{/gitUserId}}/{{gitRepoId}}{{^gitRepoId}}YOUR_GIT_REPO{{/gitRepoId}}.git' + +### Include the Ruby code directly + +Include the Ruby code directly using `-I` as follows: + +```shell +ruby -Ilib script.rb +``` + +## Getting Started + +Please follow the [installation](#installation) procedure and then run the following code: + +```ruby +# Load the gem +require 'line-bot-api' +{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}} +# Setup authorization +{{{moduleName}}}.configure do |config|{{#authMethods}}{{#isBasic}}{{#isBasicBasic}} + # Configure HTTP basic authorization: {{{name}}} + config.username = 'YOUR_USERNAME' + config.password = 'YOUR_PASSWORD'{{/isBasicBasic}}{{#isBasicBearer}} + # Configure Bearer authorization{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}: {{{name}}} + config.access_token = 'YOUR_BEARER_TOKEN' + # Configure a proc to get access tokens in lieu of the static access_token configuration + config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' } {{/isBasicBearer}}{{/isBasic}}{{#isApiKey}} + # Configure API key authorization: {{{name}}} + config.api_key['{{{name}}}'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) + # config.api_key_prefix['{{{name}}}'] = 'Bearer'{{/isApiKey}}{{#isOAuth}} + # Configure OAuth2 access token for authorization: {{{name}}} + config.access_token = 'YOUR ACCESS TOKEN' + # Configure a proc to get access tokens in lieu of the static access_token configuration + config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' } {{/isOAuth}} + {{#isFaraday}} + # Configure faraday connection + config.configure_faraday_connection { |connection| 'YOUR CONNECTION CONFIG PROC' } + {{/isFaraday}} +{{/authMethods}}end +{{/hasAuthMethods}} + +api_instance = {{{moduleName}}}::{{{classname}}}.new +{{#requiredParams}} +{{{paramName}}} = {{{vendorExtensions.x-ruby-example}}} # {{{dataType}}} | {{{description}}} +{{/requiredParams}} +{{#optionalParams}} +{{#-first}} +opts = { +{{/-first}} + {{{paramName}}}: {{{vendorExtensions.x-ruby-example}}}{{^-last}},{{/-last}} # {{{dataType}}} | {{{description}}} +{{#-last}} +} +{{/-last}} +{{/optionalParams}} + +begin +{{#summary}} #{{{.}}} +{{/summary}} {{#returnType}}result = {{/returnType}}api_instance.{{{operationId}}}{{#hasParams}}({{#requiredParams}}{{{paramName}}}{{^-last}}, {{/-last}}{{/requiredParams}}{{#optionalParams}}{{#-last}}{{#hasRequiredParams}}, {{/hasRequiredParams}}opts{{/-last}}{{/optionalParams}}){{/hasParams}}{{#returnType}} + p result{{/returnType}} +rescue {{{moduleName}}}::ApiError => e + puts "Exception when calling {{classname}}->{{{operationId}}}: #{e}" +end +{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} +``` + +## Documentation for API Endpoints + +All URIs are relative to *{{basePath}}* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{moduleName}}::{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{{summary}}} +{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} + +## Documentation for Models + +{{#models}}{{#model}} - [{{moduleName}}::{{classname}}]({{modelDocPath}}{{classname}}.md) +{{/model}}{{/models}} + +## Documentation for Authorization + +{{^authMethods}}Endpoints do not require authorization.{{/authMethods}} +{{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}} +{{#authMethods}} +### {{name}} + +{{#isApiKey}} + +- **Type**: API key +- **API key parameter name**: {{keyParamName}} +- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} +{{/isApiKey}} +{{#isBasic}} +{{#isBasicBasic}}- **Type**: HTTP basic authentication +{{/isBasicBasic}}{{#isBasicBearer}}- **Type**: Bearer authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} +{{/isBasicBearer}}{{#isHttpSignature}}- **Type**: HTTP signature authentication +{{/isHttpSignature}} +{{/isBasic}} +{{#isOAuth}} + +- **Type**: OAuth +- **Flow**: {{flow}} +- **Authorization URL**: {{authorizationUrl}} +- **Scopes**: {{^scopes}}N/A{{/scopes}} +{{#scopes}} - {{scope}}: {{description}} +{{/scopes}} +{{/isOAuth}} + +{{/authMethods}} \ No newline at end of file diff --git a/src/main/resources/ruby-client/partial_model_generic.mustache b/src/main/resources/ruby-client/partial_model_generic.mustache new file mode 100644 index 00000000..f6a0b7fa --- /dev/null +++ b/src/main/resources/ruby-client/partial_model_generic.mustache @@ -0,0 +1,387 @@ + {{#description}} + # {{{.}}} + {{/description}} + class {{classname}}{{#parent}} < {{{.}}}{{/parent}} + {{#vars}} + {{#description}} + # {{{.}}} + {{/description}} + attr_accessor :{{{name}}} + + {{/vars}} +{{#hasEnums}} + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + +{{/hasEnums}} + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + {{#vars}} + :'{{{name}}}' => :'{{{baseName}}}'{{^-last}},{{/-last}} + {{/vars}} + } + end + + # Returns all the JSON keys this model knows about{{#parent}}, including the ones defined in its parent(s){{/parent}} + def self.acceptable_attributes + {{^parent}} + attribute_map.values + {{/parent}} + {{#parent}} + attribute_map.values.concat(superclass.acceptable_attributes) + {{/parent}} + end + + # Returns the key-value map of all the JSON attributes this model knows about{{#parent}}, including the ones defined in its parent(s){{/parent}} + def self.acceptable_attribute_map + {{^parent}} + attribute_map + {{/parent}} + {{#parent}} + attribute_map.merge(superclass.acceptable_attribute_map) + {{/parent}} + end + + # Attribute type mapping. + def self.openapi_types + { + {{#vars}} + :'{{{name}}}' => :'{{{dataType}}}'{{^-last}},{{/-last}} + {{/vars}} + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + {{#vars}} + {{#isNullable}} + :'{{{name}}}'{{^-last}},{{/-last}} + {{/isNullable}} + {{/vars}} + ]) + end + + {{#anyOf}} + {{#-first}} + # List of class defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + {{/-first}} + :'{{{.}}}'{{^-last}},{{/-last}} + {{#-last}} + ] + end + + {{/-last}} + {{/anyOf}} + {{#allOf}} + {{#-first}} + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + {{/-first}} + :'{{{.}}}'{{^-last}},{{/-last}} + {{#-last}} + ] + end + + {{/-last}} + {{/allOf}} + {{#discriminator}} + {{#propertyName}} + # discriminator's property name in OpenAPI v3 + def self.openapi_discriminator_name + :'{{{.}}}' + end + + {{/propertyName}} + {{/discriminator}} + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `{{{moduleName}}}::{{{classname}}}` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `{{{moduleName}}}::{{{classname}}}`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + {{#parent}} + + # call parent's initialize + super(attributes) + {{/parent}} + {{#vars}} + + if attributes.key?(:'{{{name}}}') + {{#isArray}} + if (value = attributes[:'{{{name}}}']).is_a?(Array) + self.{{{name}}} = value + end + {{/isArray}} + {{#isMap}} + if (value = attributes[:'{{{name}}}']).is_a?(Hash) + self.{{{name}}} = value + end + {{/isMap}} + {{^isContainer}} + self.{{{name}}} = attributes[:'{{{name}}}'] + {{/isContainer}} + {{#defaultValue}} + else + self.{{{name}}} = {{{defaultValue}}} + {{/defaultValue}} + {{^defaultValue}} + {{#required}} + else + self.{{{name}}} = nil + {{/required}} + {{/defaultValue}} + end + {{/vars}} + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = {{^parent}}Array.new{{/parent}}{{#parent}}super{{/parent}} + {{#vars}} + {{^isNullable}} + {{#required}} + if @{{{name}}}.nil? + invalid_properties.push('invalid value for "{{{name}}}", {{{name}}} cannot be nil.') + end + + {{/required}} + {{/isNullable}} + {{#hasValidation}} + {{#maxLength}} + if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.to_s.length > {{{maxLength}}} + invalid_properties.push('invalid value for "{{{name}}}", the character length must be smaller than or equal to {{{maxLength}}}.') + end + + {{/maxLength}} + {{#minLength}} + if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.to_s.length < {{{minLength}}} + invalid_properties.push('invalid value for "{{{name}}}", the character length must be great than or equal to {{{minLength}}}.') + end + + {{/minLength}} + {{#maximum}} + if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{{maximum}}} + invalid_properties.push('invalid value for "{{{name}}}", must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{{maximum}}}.') + end + + {{/maximum}} + {{#minimum}} + if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{{minimum}}} + invalid_properties.push('invalid value for "{{{name}}}", must be greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{{minimum}}}.') + end + + {{/minimum}} + {{#pattern}} + pattern = Regexp.new({{{pattern}}}) + if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}} !~ pattern + invalid_properties.push("invalid value for \"{{{name}}}\", must conform to the pattern #{pattern}.") + end + + {{/pattern}} + {{#maxItems}} + if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.length > {{{maxItems}}} + invalid_properties.push('invalid value for "{{{name}}}", number of items must be less than or equal to {{{maxItems}}}.') + end + + {{/maxItems}} + {{#minItems}} + if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.length < {{{minItems}}} + invalid_properties.push('invalid value for "{{{name}}}", number of items must be greater than or equal to {{{minItems}}}.') + end + + {{/minItems}} + {{/hasValidation}} + {{/vars}} + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + {{#vars}} + {{^isNullable}} + {{#required}} + return false if @{{{name}}}.nil? + {{/required}} + {{/isNullable}} + {{#isEnum}} + {{^isContainer}} + {{{name}}}_validator = EnumAttributeValidator.new('{{{dataType}}}', [{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}]) + return false unless {{{name}}}_validator.valid?(@{{{name}}}) + {{/isContainer}} + {{/isEnum}} + {{#hasValidation}} + {{#maxLength}} + return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.to_s.length > {{{maxLength}}} + {{/maxLength}} + {{#minLength}} + return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.to_s.length < {{{minLength}}} + {{/minLength}} + {{#maximum}} + return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{{maximum}}} + {{/maximum}} + {{#minimum}} + return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{{minimum}}} + {{/minimum}} + {{#pattern}} + return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}} !~ Regexp.new({{{pattern}}}) + {{/pattern}} + {{#maxItems}} + return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.length > {{{maxItems}}} + {{/maxItems}} + {{#minItems}} + return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.length < {{{minItems}}} + {{/minItems}} + {{/hasValidation}} + {{/vars}} + {{#anyOf}} + {{#-first}} + _any_of_found = false + self.class.openapi_any_of.each do |_class| + _any_of = {{moduleName}}.const_get(_class).build_from_hash(self.to_hash) + if _any_of.valid? + _any_of_found = true + end + end + + if !_any_of_found + return false + end + + {{/-first}} + {{/anyOf}} + true{{#parent}} && super{{/parent}} + end + + {{#vars}} + {{#isEnum}} + {{^isContainer}} + # Custom attribute writer method checking allowed values (enum). + # @param [Object] {{{name}}} Object to be assigned + def {{{name}}}=({{{name}}}) + validator = EnumAttributeValidator.new('{{{dataType}}}', [{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}]) + unless validator.valid?({{{name}}}) + fail ArgumentError, "invalid value for \"{{{name}}}\", must be one of #{validator.allowable_values}." + end + @{{{name}}} = {{{name}}} + end + + {{/isContainer}} + {{/isEnum}} + {{^isEnum}} + {{#hasValidation}} + # Custom attribute writer method with validation + # @param [Object] {{{name}}} Value to be assigned + def {{{name}}}=({{{name}}}) + {{^isNullable}} + if {{{name}}}.nil? + fail ArgumentError, '{{{name}}} cannot be nil' + end + + {{/isNullable}} + {{#maxLength}} + if {{#isNullable}}!{{{name}}}.nil? && {{/isNullable}}{{{name}}}.to_s.length > {{{maxLength}}} + fail ArgumentError, 'invalid value for "{{{name}}}", the character length must be smaller than or equal to {{{maxLength}}}.' + end + + {{/maxLength}} + {{#minLength}} + if {{#isNullable}}!{{{name}}}.nil? && {{/isNullable}}{{{name}}}.to_s.length < {{{minLength}}} + fail ArgumentError, 'invalid value for "{{{name}}}", the character length must be great than or equal to {{{minLength}}}.' + end + + {{/minLength}} + {{#maximum}} + if {{#isNullable}}!{{{name}}}.nil? && {{/isNullable}}{{{name}}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{{maximum}}} + fail ArgumentError, 'invalid value for "{{{name}}}", must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{{maximum}}}.' + end + + {{/maximum}} + {{#minimum}} + if {{#isNullable}}!{{{name}}}.nil? && {{/isNullable}}{{{name}}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{{minimum}}} + fail ArgumentError, 'invalid value for "{{{name}}}", must be greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{{minimum}}}.' + end + + {{/minimum}} + {{#pattern}} + pattern = Regexp.new({{{pattern}}}) + if {{#isNullable}}!{{{name}}}.nil? && {{/isNullable}}{{{name}}} !~ pattern + fail ArgumentError, "invalid value for \"{{{name}}}\", must conform to the pattern #{pattern}." + end + + {{/pattern}} + {{#maxItems}} + if {{#isNullable}}!{{{name}}}.nil? && {{/isNullable}}{{{name}}}.length > {{{maxItems}}} + fail ArgumentError, 'invalid value for "{{{name}}}", number of items must be less than or equal to {{{maxItems}}}.' + end + + {{/maxItems}} + {{#minItems}} + if {{#isNullable}}!{{{name}}}.nil? && {{/isNullable}}{{{name}}}.length < {{{minItems}}} + fail ArgumentError, 'invalid value for "{{{name}}}", number of items must be greater than or equal to {{{minItems}}}.' + end + + {{/minItems}} + @{{{name}}} = {{{name}}} + end + + {{/hasValidation}} + {{/isEnum}} + {{/vars}} + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class{{#vars}} && + {{name}} == o.{{name}}{{/vars}}{{#parent}} && super(o){{/parent}} + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [{{#vars}}{{name}}{{^-last}}, {{/-last}}{{/vars}}].hash + end + +{{> base_object}} + end