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.204.0.tar.gz
(69.6 kB
view details)
Built Distribution
File details
Details for the file stigg_api_client-2.204.0.tar.gz
.
File metadata
- Download URL: stigg_api_client-2.204.0.tar.gz
- Upload date:
- Size: 69.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.0 CPython/3.10.12 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc63e312d115a5e57dac895f49868423b21fa7e26530d5b31e35ee0efd701206 |
|
MD5 | 3e27b41cb174d9f401124bd5ccfab4a1 |
|
BLAKE2b-256 | f56064b593ae3a32e916373ffe4d6a873532e9612f2c10f8b1ef6962cc00faa4 |
File details
Details for the file stigg_api_client-2.204.0-py3-none-any.whl
.
File metadata
- Download URL: stigg_api_client-2.204.0-py3-none-any.whl
- Upload date:
- Size: 70.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.0 CPython/3.10.12 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c740241df78f6d4d7968ac5943fc6b958271ed22813b16d7a67a6b7925bcdd60 |
|
MD5 | 8d12f0beb830048f2e939c6aba14156d |
|
BLAKE2b-256 | 58298d369838fbc9a8822a07b314b8251155b38a36e831ea111efb3ef97df149 |