# MIC SDKs

Clients for Node.js/TypeScript, Python and Java 25. This development release includes the 15 documented MIC methods. Use your approved developer application's token and workspace.

Set the API base to `https://www.pradiota.com/sandbox/v1`. A trailing `/v1` is added once. Load your workspace in the MIC console and pass its `micws_` identifier. Request every scope listed for the operation; file-backed methods also need `files:read`.

Install the downloaded archive:

- Node.js: `npm install ./pradiota-mic-0.1.0-development.2.tgz`, then import `MicClient` from `@pradiota/mic`.
- Python: `python -m pip install ./pradiota_mic-0.1.0.dev2-py3-none-any.whl`, then import `MicClient` from `pradiota_mic`.
- Java: install the supplied JAR and POM with `mvn install:install-file -Dfile=mic-development-0.1.0-development.2.jar -DpomFile=mic-development-0.1.0-development.2.pom`. Add `com.pradiota:mic-development:0.1.0-development.2` to your project.

Use a stable idempotency key for each mutation. Cancellation also needs the current `If-Match` value. Clients make one attempt per call. After a timeout, check the resource before retrying with the same key. A processing request records the request for review; approval and execution are separate steps.

File downloads return bytes with status, request ID, ETag, content type and range metadata. Clients buffer responses with a default 64 MiB limit; use Range for larger files. Node and Python let you configure the limit; Java uses the fixed default. A partial download's SHA header describes the full file; it does not verify the downloaded range. Processing-request revisions preserve signed 64-bit integers. TypeScript uses `LosslessNumber` or bigint when a value exceeds the safe integer range.

See the developer API reference for parameters, scopes, request examples and response types.

## Monthly usage

Call `getMicPublicUsage` with your workspace and `window: "MONTH"`; the token needs `mic.usage:read`. MONTH returns measured organization usage for the calendar month in the published reset timezone. It does not grant a monthly quota: each bucket's `granted`, `remaining` and `resetAt` is null. DAY and ENTITLEMENT continue to report the approved quota counters. Keep decimal counter strings as strings when displaying them.

After creating the client shown in the language guide:

```javascript
const usage = await client.getMicPublicUsage({ workspaceId: process.env.MIC_WORKSPACE_ID, window: "MONTH" });
for (const bucket of usage.body.data.buckets) console.log(bucket.metric, bucket.used);
```

```python
usage = client.getMicPublicUsage({"workspaceId": os.environ["MIC_WORKSPACE_ID"], "window": "MONTH"})
for bucket in usage.body["data"]["buckets"]:
    print(bucket["metric"], bucket["used"])
```

```java
var usage = client.getMicPublicUsage(new com.pradiota.mic.Models.GetMicPublicUsageParameters(System.getenv("MIC_WORKSPACE_ID"), "MONTH"));
for (var bucket : usage.body().data().buckets()) System.out.println(bucket.metric() + ": " + bucket.used());
```

This release's MONTH and existing DAY/ENTITLEMENT response checks run against a local test server. They do not verify live application access, processing or billing.
