No project description provided
Project description
stigg-api-client
This library provides a Python wrapper to Stigg's GraphQL API based on the operations that are in use by the Stigg's Node.js SDK.
It leverages the sgqlc library to generate Python classes for GraphQL types, and
utilizes the sgqlc.endpoint.requests.RequestsEndpoint
class to send the API requests. The responses are being
automatically converted into native Python types.
Documentation
See https://docs.stigg.io/docs/python-sdk
Installation
pip install stigg-api-client
Usage
Initialize the client:
import os
from stigg import Stigg
api_key = os.environ.get("STIGG_SERVER_API_KEY")
stigg_client = Stigg.create_client(api_key)
Provision a customer
import os
from stigg import Stigg
api_key = os.environ.get("STIGG_SERVER_API_KEY")
client = Stigg.create_client(api_key)
data = client.request(Stigg.mutation.provision_customer, {
"input": {
"refId": "customer-id",
"name": "Acme",
"email": "hello@acme.com",
"couponRefId": "coupon-id",
"billingInformation": {
"language": "en",
"timezone": "America/New_York",
"billingAddress": {
"country": "US",
"city": "New York",
"state": "NY",
"addressLine1": "123 Main Street",
"addressLine2": "Apt. 1",
"phoneNumber": "+1 212-499-5321",
"postalCode": "10164"
},
"shippingAddress": {
"country": "US",
"city": "New York",
"state": "NY",
"addressLine1": "123 Main Street",
"addressLine2": "Apt. 1",
"phoneNumber": "+1 212-499-5321",
"postalCode": "10164"
}
},
"additionalMetaData": {
"key": "value"
},
"subscriptionParams": {
"planId": "plan-revvenu-basic"
}
}
})
print(data.provision_customer.customer.name)
Get a customer by ID
import os
from stigg import Stigg
api_key = os.environ.get("STIGG_SERVER_API_KEY")
client = Stigg.create_client(api_key)
data = client.request(Stigg.query.get_customer_by_id, {
"input": {"customerId": "customer-id"}
})
customer = data.get_customer_by_ref_id
print(customer.name)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
stigg_api_client-2.188.0.tar.gz
(69.2 kB
view hashes)
Built Distribution
Close
Hashes for stigg_api_client-2.188.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d7ca7816637d29ea8e1a70ca297371399cf9d325591111d59de786f67ed8d43 |
|
MD5 | c6f00f692400ec4e9188ca0d22529d7b |
|
BLAKE2b-256 | 4a6fe9ac6c84103f146f5a3ed0dd22eb73428a4ce3b66fdf6590886c8abb7d55 |