feat: add GetBusinessProfile - #214
Open
pradosystems wants to merge 1 commit into
Open
Conversation
Exposes whatsmeow's GetBusinessProfile, which returns the public business information a WhatsApp Business account chose to publish: address, email, categories, business hours and timezone. Currently there is no way to reach this from neonize — the compiled .so only exports PutBusinessName and ResolveBusinessMessageLink, so it is not reachable via ctypes either. Changes follow the existing GetProfilePicture pattern: - Neonize.proto: BusinessProfile, Category, BusinessHoursConfig and GetBusinessProfileReturnFunction. Added at the END of the file on purpose, so the descriptor indexes of existing messages do not shift and the regenerated .pb.go diff stays small. - utils/encoder.go: EncodeBusinessProfile / EncodeCategory / EncodeBusinessHoursConfig - main.go: //export GetBusinessProfile - _binder.py, client.py, exc.py: ctypes signature, wrapper and error type Generated files were regenerated with the same toolchain the repo already uses (protoc 34.1 / protoc-gen-go v1.36.12). Verified: builds with CGO_ENABLED=1 go build -buildmode=c-shared, and 'nm -D' confirms the GetBusinessProfile symbol is exported.
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.
What
Exposes whatsmeow's
GetBusinessProfile, returning the public information aWhatsApp Business account chose to publish:
Why
There is currently no way to reach this from neonize.
resolve_business_message_linkonly works from a
wa.me/message/...link and returns a different, smallershape (
BusinessMessageLinkTarget), so it does not cover the case of "I have aJID, what does this business publish?".
It is not reachable via ctypes either — the shipped
.soonly exportsPutBusinessNameandResolveBusinessMessageLink:How
Follows the existing
GetProfilePicturepattern end to end:goneonize/Neonize.protoBusinessProfile,Category,BusinessHoursConfig,GetBusinessProfileReturnFunctiongoneonize/utils/encoder.goEncodeBusinessProfile/EncodeCategory/EncodeBusinessHoursConfiggoneonize/main.go//export GetBusinessProfileneonize/_binder.pyneonize/client.pyget_business_profile()neonize/exc.pyGetBusinessProfileErrorTwo notes on keeping the diff reviewable:
Neonize.protoon purpose. Addingthem in the middle shifts every following message's descriptor index, which
alone produced a ~1150-line diff in the regenerated
.pb.go. Appending keepsit at ~350 lines, almost all of it the new types.
uses —
protoc 34.1andprotoc-gen-go v1.36.12— matching the headers ofthe committed files, so no unrelated churn.
Verification
I have not added the async variant in
aioze/client.py— happy to add it if youprefer the two kept in sync in the same PR.