Skip to content

SDK naming conventions

What the SDKs rename, what they leave alone, and where the line falls.

In the server SDKs, method names follow your language, and field names keep the API's snake_case: created_at, authorization_url, per_page.

What changes, and what does not

LayerFollows the languageExample
Client, resource and method namesYeswajub.payments.listRefunds(), client.Payments.ListRefunds()
Fields you sendNo"authorization_url", "per_page", "decline_code"
Fields you read backNopayment.authorization_url, payment["created_at"]
HTTP paths and query parametersNo/webhooks, ?per_page=50
Header namesNoIdempotency-Key, X-Wajub-Signature
Enum valuesNopayment.succeeded, pending, XAF
Resource idsNotrx_…, cus_…, po_…
"authorization_url": "https://pay.wajub.com/test_xxxxx"

In Ruby it is payment.authorization_url, in Java payment.getAuthorizationUrl(), and in C# payment.AuthorizationUrl. In Go, Java and C#, read it from that typed field: Raw["authorization_url"] finds nothing.

The method names, by language

SDKStyleA method that shows it
Node.jscamelCasewajub.webhookEndpoints.rotateSecret()
Pythonsnake_casewajub.webhook_endpoints.rotate_secret()
PHPcamelCase$wajub->webhookEndpoints->rotateSecret()
GoPascalCaseclient.WebhookEndpoints.RotateSecret()
Rubysnake_caseclient.webhook_endpoints.rotate_secret
JavacamelCaseclient.webhookEndpoints().rotateSecret()
C#PascalCase with Asyncclient.WebhookEndpoints.RotateSecretAsync()

In Python, the global accessor is wajub.global_, because global is a keyword.

Create a payment with payments.create.

The typed languages decode a few fields

Go, Java and C# give a payment's main fields as typed fields named the language's way, and every other field in Raw, under its API name.

payment.id
payment.status
payment.amount
payment.currency
payment.authorization_url
payment.authorization_token
payment.reference         // an index signature covers the rest

Reading the API reference from any SDK

The reference documents the wire. Apply exactly one transformation.

In the referenceIn your code
POST /webhooks/{id}/rotate-secretThe method, in your language's style
authorization_url in the response bodyThe same string, unchanged
per_page as a query parameterThe same string, unchanged

Without an SDK, everything is snake_case

A raw HTTP call sends and receives snake_case in JSON bodies and query strings. There is no endpoint that accepts camelCase.

What did you think of this content?