Skip to main content

Code Craft AI RestClient - Twingate

The codecraftai-restclient-twingate package is a typed, aspect-driven client for the Twingate Admin API. Despite the restclient- prefix, the upstream API is GraphQL, not REST — Twingate publishes a single GraphQL endpoint at https://<your-network>.twingate.com/api/graphql/v1. The package consumes codecraftai-restclient-base for HTTP transport (POST, session management, auth header plumbing, aspects-driven retry/timeout) and layers GraphQL query and mutation construction on top.

The package is implemented as of Milestone M3b of the VPN/cloud-provisioning plan. See the specs/ folder for the Kiro-style requirements, design, and task documentation that drives that work.

Highlights

  • TwingateClient(RestClientBase) exposing api groups for resources, groups, connectors, remote_networks, and devices.

  • IVPNControlPlane Protocol conformance via an idempotent three-phase RBAC apply (apply_acl translates Tailscale-shaped flat-ACL JSON into Twingate’s resource × group × assignment surface).

  • Typed query and mutation builders under queries/ and mutations/, INPUT_OBJECT types under inputs/, and SchemaObject DTOs under model/.

  • Bearer auth from TwingateServiceAccountCredential; endpoint URL derived from the credential’s network slug.

  • Connector-name → connector-id resolution for mint_authkey so callers can pass tag-shaped inputs and have them work against Twingate’s id-keyed surface.

  • Replaces the M3-landed codecraftai-interop/vpn/twingate/twingatecontrolplane.py, which becomes a re-export shim for one release cycle after this package ships.

Schema Regeneration

The typed builders and DTOs are hand-authored from the documented Twingate GraphQL surface — see the “Codegen Decision” section of AGENTS.md. A maintainer with a live Twingate network can re-sync the checked-in schema snapshot:

python -m ccai.restclient.twingate._codegen.import_schema \
    --network <slug> --token <api-token>

This rewrites source/packages/ccai/restclient/twingate/_spec/schema.json and _spec/schema.sha256. The emitter in _codegen/emitter.py can then validate or extend the hand-authored model/ / inputs/ modules. On a non-200 response or GraphQL errors the importer raises ConfigurationError and leaves the checked-in schema untouched.

Repository Structure

  • development/ - Runtime environment scripts.

  • repository-setup/ - Repository homing and setup scripts.

  • source/packages/ccai/restclient/twingate/ - Package source code (lands in M3b).

  • source/testroots/testbase/ccai/tests/restclient/twingate/ - TestBase test roots (lands in M3b).

  • specs/ - Requirements, design, and task documentation (Kiro-style).

  • userguide/ - Standards, conventions, and documentation.

Environment Setup

When working in a Codex container:

./development/setup-agent-container

For local development:

./repository-setup/rehome-repository
./development/setup-environment

Running Tests

Tests land in Milestone M3b. Once source code is in place:

source .venv/bin/activate
testbase testing run --root ./source/testroots/testbase --includes=testbase.ccai.tests

Standards and Conventions

  • Naming conventions: userguide/10-02-naming-conventions.rst

  • Code organization: userguide/10-01-code-organization.rst

  • Coding standards: userguide/10-00-coding-standards.rst

Additional Resources

  • User guide entry point: userguide/userguide.rst

  • Codegen decision rule: workspace PLAN-VPN-AND-CLOUD-PROVISIONING.md §9.2a

Metadata

Release files for codecraftai-restclient-twingate 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for codecraftai-restclient-twingate 1.2.0
File Size Uploaded Provenance
codecraftai_restclient_twingate-1.2.0.tar.gz 41.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for codecraftai-restclient-twingate 1.2.0
File Interpreter ABI Platform
codecraftai_restclient_twingate-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 118.0 kB

Release files / codecraftai_restclient_twingate-1.2.0.tar.gz

Download URL codecraftai_restclient_twingate-1.2.0.tar.gz
Size 41.8 kB
Tags Source
SHA-256 checksum
How to use checksums
dfc0af87eacaa00cd8dfd22bde98c4670763f543a633a5855b3d1532974b00d3
BLAKE2b-256 checksum
How to use checksums
415193dc4b2243eea56f50e740b245c24b677ffd8121a948dfe65e7f86a19c32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / codecraftai_restclient_twingate-1.2.0-py3-none-any.whl

Download URL codecraftai_restclient_twingate-1.2.0-py3-none-any.whl
Size 76.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8fa59793c62837675c06a3187711ee4f8c259ebc058a3ddd536a48e98e0c64f0
BLAKE2b-256 checksum
How to use checksums
09fbe4cd43f5c1c303f8463470d67f0cd353926d111f6dde2f5ad71663b7e85e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Security for codecraftai-restclient-twingate 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for codecraftai_restclient_twingate-1.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page