stigg-api-client


Namestigg-api-client JSON
Version 1.150.1 PyPI version JSON
download
home_pageNone
SummaryNone
upload_time2024-04-18 12:31:45
maintainerNone
docs_urlNone
authorStigg
requires_python<4.0,>=3.7
licenseSTIGG SDK LICENSE
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # stigg-api-client

This library provides a Python wrapper to [Stigg's GraphQL API](https://docs.stigg.io/docs/graphql-api) based on 
the operations that are in use by the [Stigg's Node.js SDK](https://docs.stigg.io/docs/nodejs-sdk).

It leverages the [sgqlc](https://github.com/profusion/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:

```python

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

```python

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

```python

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)

```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "stigg-api-client",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.7",
    "maintainer_email": null,
    "keywords": null,
    "author": "Stigg",
    "author_email": "support@stigg.io",
    "download_url": "https://files.pythonhosted.org/packages/47/de/9d541ddcca6372dd7df9effc5514118d8a40817c6b2e48d6dc04c8f152ff/stigg_api_client-1.150.1.tar.gz",
    "platform": null,
    "description": "# stigg-api-client\n\nThis library provides a Python wrapper to [Stigg's GraphQL API](https://docs.stigg.io/docs/graphql-api) based on \nthe operations that are in use by the [Stigg's Node.js SDK](https://docs.stigg.io/docs/nodejs-sdk).\n\nIt leverages the [sgqlc](https://github.com/profusion/sgqlc) library to generate Python classes for GraphQL types, and\nutilizes the `sgqlc.endpoint.requests.RequestsEndpoint` class to send the API requests. The responses are being\nautomatically converted into native Python types.\n\n## Documentation\n\nSee https://docs.stigg.io/docs/python-sdk\n\n## Installation\n\n    pip install stigg-api-client\n\n## Usage\n\nInitialize the client:\n\n```python\n\nimport os\nfrom stigg import Stigg\n\napi_key = os.environ.get(\"STIGG_SERVER_API_KEY\")\n\nstigg_client = Stigg.create_client(api_key)\n\n```\n\nProvision a customer\n\n```python\n\nimport os\nfrom stigg import Stigg\n\napi_key = os.environ.get(\"STIGG_SERVER_API_KEY\")\n\nclient = Stigg.create_client(api_key)\n\ndata = client.request(Stigg.mutation.provision_customer, {\n    \"input\": {\n        \"refId\": \"customer-id\",\n        \"name\": \"Acme\",\n        \"email\": \"hello@acme.com\",\n        \"couponRefId\": \"coupon-id\",\n        \"billingInformation\": {\n            \"language\": \"en\",\n            \"timezone\": \"America/New_York\",\n            \"billingAddress\": {\n                \"country\": \"US\",\n                \"city\": \"New York\",\n                \"state\": \"NY\",\n                \"addressLine1\": \"123 Main Street\",\n                \"addressLine2\": \"Apt. 1\",\n                \"phoneNumber\": \"+1 212-499-5321\",\n                \"postalCode\": \"10164\"\n            },\n            \"shippingAddress\": {\n                \"country\": \"US\",\n                \"city\": \"New York\",\n                \"state\": \"NY\",\n                \"addressLine1\": \"123 Main Street\",\n                \"addressLine2\": \"Apt. 1\",\n                \"phoneNumber\": \"+1 212-499-5321\",\n                \"postalCode\": \"10164\"\n            }\n        },\n        \"additionalMetaData\": {\n            \"key\": \"value\"\n        },\n        \"subscriptionParams\": {\n            \"planId\": \"plan-revvenu-basic\"\n        }\n    }\n})\n\nprint(data.provision_customer.customer.name)\n\n```\n\nGet a customer by ID\n\n```python\n\nimport os\nfrom stigg import Stigg\n\napi_key = os.environ.get(\"STIGG_SERVER_API_KEY\")\n\nclient = Stigg.create_client(api_key)\n\ndata = client.request(Stigg.query.get_customer_by_id, {\n  \"input\": {\"customerId\": \"customer-id\"}\n})\n\ncustomer = data.get_customer_by_ref_id\nprint(customer.name)\n\n```\n",
    "bugtrack_url": null,
    "license": "STIGG SDK LICENSE",
    "summary": null,
    "version": "1.150.1",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f923cf7ecb594c8fac5bb1f199fee53e4a6ae03f8f922b15775cfa71832a66cd",
                "md5": "a96c349c378c52b7fb631978097a20ea",
                "sha256": "b17e5980a20af10d2b9fc3b90d6e2ad6389ca97c74a175a21f738964726c7297"
            },
            "downloads": -1,
            "filename": "stigg_api_client-1.150.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a96c349c378c52b7fb631978097a20ea",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.7",
            "size": 65264,
            "upload_time": "2024-04-18T12:31:42",
            "upload_time_iso_8601": "2024-04-18T12:31:42.153029Z",
            "url": "https://files.pythonhosted.org/packages/f9/23/cf7ecb594c8fac5bb1f199fee53e4a6ae03f8f922b15775cfa71832a66cd/stigg_api_client-1.150.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "47de9d541ddcca6372dd7df9effc5514118d8a40817c6b2e48d6dc04c8f152ff",
                "md5": "e33f16baaa393da63f965f09986a5444",
                "sha256": "a786595b82d341dbc6ff0ebb4470acacaa57cb73c0f8729ab62f792dc1a44816"
            },
            "downloads": -1,
            "filename": "stigg_api_client-1.150.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e33f16baaa393da63f965f09986a5444",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.7",
            "size": 64177,
            "upload_time": "2024-04-18T12:31:45",
            "upload_time_iso_8601": "2024-04-18T12:31:45.444607Z",
            "url": "https://files.pythonhosted.org/packages/47/de/9d541ddcca6372dd7df9effc5514118d8a40817c6b2e48d6dc04c8f152ff/stigg_api_client-1.150.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-18 12:31:45",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "stigg-api-client"
}
        
Elapsed time: 0.62149s