docs(business): document catalog, collections, orders, and profile writes - #501
Conversation
…ites whatsapp-rust#1252 added client.business() with get_catalog/get_collections/ get_order (MEX) and update_profile/set_cover_photo/remove_cover_photo (IQ w:biz), plus the BusinessError, BusinessProfileUpdate, and catalog/order types backing them. Expands the business API page with the new methods, types, and validation rules, adds the client.business() accessor to the client reference, and adds BusinessError to the error type reference. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DyDYg23Kh9PKoFGDof4Dxa
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
Warning Review limit reached
Next review available in: 46 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
| Filename | Overview |
|---|---|
| api/business.mdx | Expands the feature reference with Business sub-API methods, associated models, validation rules, errors, examples, and support limitations. |
| api/client.mdx | Adds the Client::business() accessor and summarizes its catalog, order, profile, and cover-photo operations. |
| api/errors.mdx | Adds BusinessError to the domain-error table and documents its MEX, IQ, validation, and malformed-response variants. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
Client[Client] --> Read[get_business_profile]
Client --> Business[client.business]
Business --> MEX[MEX operations]
Business --> IQ[IQ w:biz operations]
MEX --> Catalog[get_catalog]
MEX --> Collections[get_collections]
MEX --> Order[get_order]
IQ --> Update[update_profile]
IQ --> SetCover[set_cover_photo]
IQ --> RemoveCover[remove_cover_photo]
Reviews (2): Last reviewed commit: "docs(business): address review feedback ..." | Re-trigger Greptile
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 920417e4d4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| **Parameters:** | ||
| - `jid` - the business the order was placed with | ||
| - `order_id` / `token` - taken from the order message itself (`OrderMessage.orderId` / `OrderMessage.token`); the token is a per-order capability, so an order cannot be read without the message that announced it |
There was a problem hiding this comment.
Use the Rust field name for order IDs
When readers extract these values in Rust, OrderMessage.orderId does not exist: the generated API converts protobuf camelCase fields to snake_case Rust identifiers, as documented in api/waproto.mdx. Refer to OrderMessage.order_id instead; otherwise the documented access path fails to compile.
Useful? React with 👍 / 👎.
| ``` | ||
|
|
||
| <Note> | ||
| `Collection::products` is a possibly-truncated prefix — the collections query returns no per-collection cursor, so `products.len() == item_limit` is the only signal that more products exist in that collection. |
There was a problem hiding this comment.
Describe the collection length check as inconclusive
When a collection contains exactly item_limit products, this equality holds even though no additional products exist. The length is therefore only a signal that the collection may be truncated, as the example above correctly says, not a signal that more products exist; the same overstatement is repeated in the later warning and can make consumers report nonexistent additional items.
Useful? React with 👍 / 👎.
|
|
||
| `BusinessHoursConfig` is `#[non_exhaustive]`: struct-literal construction and exhaustive struct destructuring from outside the crate are both disallowed. Field reads are unaffected; add `..` to any exhaustive destructuring patterns. | ||
|
|
||
| **Constructors:** |
There was a problem hiding this comment.
Explain that closed days are omitted
For users trying to mark a day as closed, this constructor description is not actionable: BusinessHoursConfig::new still requires a BusinessHourMode, but the documented enum has no closed variant. Since the configuration contains one entry per opening range, document that a closed day is represented by omitting that day's entry rather than implying that new can construct one.
Useful? React with 👍 / 👎.
|
|
||
| ### BusinessProfileUpdate | ||
|
|
||
| A delta mutation of the business profile, passed to [`update_profile`](#update_profile). Every field is `None` by default and a `None` field is left untouched — this is a delta, not a replacement. The distinction that matters is between "leave alone" and "clear": clearing is `Some` of an empty value (`Some(String::new())` for text, `Some(Vec::new())` for `websites`). |
There was a problem hiding this comment.
Split the profile-delta explanation by concept
This paragraph compresses default-field behavior, delta-versus-replacement semantics, and the syntax for clearing two different field shapes into dense compound sentences. Split these concepts into concise sentences so readers do not miss the operationally important distinction between None and an empty Some value.
AGENTS.md reference: AGENTS.md:L24-L25
Useful? React with 👍 / 👎.
- Note there's no "closed" mode/constructor for BusinessHoursConfig — a day is closed by omitting its entry from `config`. - Hedge the collection-truncation signal as "may exist" rather than "exist": products.len() == item_limit doesn't prove more are available. - Split the dense BusinessProfileUpdate delta-semantics paragraph into separate sentences. - Point get_order's order_id/token doc at the Rust struct field name (order_id), not the wire/proto name (orderId). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DyDYg23Kh9PKoFGDof4Dxa
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6a77bec7ca
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| - `BusinessHoursConfig::new(day_of_week, mode)` — a day whose mode carries no explicit range (`Open24H` or `AppointmentOnly`) | ||
| - `BusinessHoursConfig::with_hours(day_of_week, mode, open_time, close_time)` — a single opening range, in minutes past local midnight. A day with two ranges is two entries sharing a `day_of_week`. | ||
|
|
||
| <Note> |
There was a problem hiding this comment.
Describe config entries as opening ranges
For a business with two opening ranges on the same day, this sentence incorrectly says config holds one entry per day, contradicting the constructor guidance immediately above that requires two entries sharing a day_of_week. Readers following this wording can omit a valid interval; clarify that closed days have no entries and open days have one entry per opening range.
Useful? React with 👍 / 👎.
Summary
Documents the API surface added by oxidezap/whatsapp-rust#1252 ("feat(business): add catalog, product and business profile operations"), which added a new
client.business()sub-API alongside the pre-existingclient.get_business_profile().api/business.mdx— expanded from a profile-read-only page into the full feature reference:Accesssection explaining the split:get_business_profilestays direct-on-Client; catalog/collections/orders/profile-writes live onclient.business().get_catalog,get_collections,get_order(all MEX),update_profile,set_cover_photo,remove_cover_photo(all IQw:biz), each with signature, parameters, and a runnable example.CatalogOptions,CollectionOptions,Catalog,Collections,Collection,Product,Price(thousandths, not hundredths),SalePrice,ProductImage,ProductVideo,ImporterAddress,ProductAvailability,Order,OrderProduct,OrderPriceDetails,VariantProperty,BusinessProfileUpdate,BusinessHoursUpdate,BUSINESS_PROFILE_MAX_WEBSITES,CoverPhotoUpload.Validationsection covering everyBusinessProfileUpdateErrorrejection reason (empty delta, too many websites, out-of-range/non-finite coordinates, invalid business-hour minutes, incomplete hour ranges, mode/range mismatches).Error handlingsection forBusinessError.Not yet supportedsection: product create/edit/delete, cover-photo image upload (takes a pre-uploaded receipt instead), full single-collection paging, catalog/collection variant data — each with the reason from the source PR.is_businesscheck, automatic<biz>stanza detection) kept as-is.api/client.mdx— added a### businessaccessor section (matching the existingmex/newsletter/communityaccessor sections) right afterget_business_profile.api/errors.mdx— addedBusinessErrorto the domain error table and its own### BusinessErrortype-definition section, matching the existing per-feature error pattern.Left untouched per instruction: the
changelog/directory (human-authored only).Test plan
64adf5b(the merge commit for #1252) insrc/features/business.rsandwacore/src/iq/business.rs.#get_catalog,#catalogoptions,#validation,#coverphotoupload, etc.) match their heading text under Mintlify's slug convention.mint broken-links— not run (CLI unavailable in this sandbox); recommend running before merge.Generated by Claude Code
Summary by cubic
Expands Business API docs to cover catalog, collections, and order lookup over MEX, plus business profile and cover photo writes over IQ. Adds
client.business()withget_catalog,get_collections,get_order,update_profile,set_cover_photo,remove_cover_photo; documents types, validation, andBusinessError; and clarifies hours behavior (no closed mode), collection paging ("may exist"), update semantics, andorder_id/tokennaming.Written for commit 6a77bec. Summary will update on new commits.