Skip to main content

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.194.7.tar.gz (69.3 kB view details)

Uploaded Source

Built Distribution

stigg_api_client-2.194.7-py3-none-any.whl (70.4 kB view details)

Uploaded Python 3

File details

Details for the file stigg_api_client-2.194.7.tar.gz.

File metadata

  • Download URL: stigg_api_client-2.194.7.tar.gz
  • Upload date:
  • Size: 69.3 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

Hashes for stigg_api_client-2.194.7.tar.gz
Algorithm Hash digest
SHA256 485b55251d726e0a922d0eb6f68356236626d8665369af8b3163af0a32095124
MD5 7be3d8fdf123c2088aafcbf76a60413e
BLAKE2b-256 bb3c7805744e65232474ef95e0996d07f9502b9bbd20e205fa079baaadd3bd54

See more details on using hashes here.

File details

Details for the file stigg_api_client-2.194.7-py3-none-any.whl.

File metadata

  • Download URL: stigg_api_client-2.194.7-py3-none-any.whl
  • Upload date:
  • Size: 70.4 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

Hashes for stigg_api_client-2.194.7-py3-none-any.whl
Algorithm Hash digest
SHA256 0458629a13009c543fb1a80735deadb352fb776063e1149d5ac6098e6e583a93
MD5 d0b15008d50e196f815aefdc2f518755
BLAKE2b-256 8b2ba7ae0d6fe94bed32a56588c2907db54d2f9316513d285d7d1407fd18e366

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page