Conversation
d3991b0 to
11d5313
Compare
11d5313 to
b80c5e3
Compare
dacab43 to
14ecfa2
Compare
006189b to
9d53ec3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The current v3 SDK is auto-generated from the LINE OpenAPI specs, where each YAML file produces a separate client class (e.g.,
MessagingApi,ManageAudience,Insight, etc.). This means users must instantiate and manage multiple clients individually, leading to verbose boilerplate:This PR introduces a unified client that wraps all per-domain clients behind a single entry point:
What's changed
tools/generate_unified_client.py— a script that introspects the per-domain API classes and generatesLineBotClient/AsyncLineBotClientwrapper classes. This script is hooked intogenerate-code.pyso it runs automatically after the OpenAPI generator completes.LineBotClientandAsyncLineBotClient(auto-generated) underlinebot.v3flask-echo,flask-kitchensink,aiohttp-echo,fastapi-echo,rich-menu,simple-server-echo) andREADME.rstto use the unified clientMIGRATION.md— comprehensive migration guide from legacylinebot(v2) tolinebot.v3, covering client construction, imports, method mapping, error handling, and a full before/after echo-bot examplelinebot.modelsandlinebot.http_clientclasses with@deprecateddecorator pointing users tolinebot.v3equivalentsDesign decisions
async_reqparameter is intentionally excludedThe OpenAPI-generated per-domain clients (e.g.,
AsyncMessagingApi) support anasync_reqparameter on every method. Whenasync_req=True, the request runs in a thread pool and returns anAsyncResult:This is a thread-based concurrency escape hatch for users of the sync client who want non-blocking behavior without
asyncio. The unified clients intentionally drop this parameter because neither use case needs it:LineBotClient— designed for straightforward synchronous usage. Users who need thread-based concurrency can access the underlying per-domain clients directly (e.g.,client._messaging_api).AsyncLineBotClient— already fully async viaasyncio/aiohttp. The thread pool path would be counterproductive.How to review