mirror of
https://github.com/hanzoai/papers.git
synced 2026-10-29 07:34:31 +00:00
48 lines
880 B
TeX
48 lines
880 B
TeX
\section{Shared Utilities}
|
|
|
|
|
|
\subsection{Pagination}
|
|
|
|
All SDKs implement cursor-based pagination:
|
|
|
|
\begin{lstlisting}[caption=Pagination Pattern]
|
|
// JavaScript
|
|
for await (const product of hanzo.products.list()) { }
|
|
|
|
# Python
|
|
for product in client.products.list():
|
|
pass
|
|
|
|
// Go
|
|
iter := client.Products.List(params)
|
|
for iter.Next() {
|
|
product := iter.Product()
|
|
}
|
|
|
|
# Ruby
|
|
Hanzo::Product.list.auto_paging_each { |p| }
|
|
\end{lstlisting}
|
|
|
|
\subsection{Webhook Verification}
|
|
|
|
\begin{lstlisting}[caption=Webhook Verification]
|
|
// JavaScript
|
|
const event = hanzo.webhooks.constructEvent(
|
|
body, signature, endpointSecret
|
|
);
|
|
|
|
# Python
|
|
event = hanzo.Webhook.construct_event(
|
|
payload, sig_header, endpoint_secret
|
|
)
|
|
|
|
// Go
|
|
event, err := webhook.ConstructEvent(body, sig, secret)
|
|
|
|
# Ruby
|
|
event = Hanzo::Webhook.construct_event(
|
|
payload, sig_header, endpoint_secret
|
|
)
|
|
\end{lstlisting}
|
|
|