From 61bc04009804e89465b50e8c6b6ce0a57bac6733 Mon Sep 17 00:00:00 2001 From: pptx704 Date: Thu, 23 Apr 2026 02:31:47 +0600 Subject: [PATCH] Minor patches --- Makefile | 2 +- api/openapi.yaml | 56 +++++++++++++++++++++++++++++++++- docs/.gitignore | 20 ------------ pyproject.toml | 5 +-- src/wrenn/models/_generated.py | 15 ++++++++- 5 files changed, 73 insertions(+), 25 deletions(-) delete mode 100644 docs/.gitignore diff --git a/Makefile b/Makefile index 51535c3..7b1b356 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ .PHONY: generate lint test check test-integration # Variables -SPEC_URL = "https://git.omukk.dev/wrenn/wrenn/raw/branch/main/internal/api/openapi.yaml" +SPEC_URL = "https://raw.githubusercontent.com/wrennhq/wrenn/refs/heads/main/internal/api/openapi.yaml" SPEC_PATH = "api/openapi.yaml" generate: diff --git a/api/openapi.yaml b/api/openapi.yaml index f4c369d..8d3861c 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -2,7 +2,7 @@ openapi: "3.1.0" info: title: Wrenn API description: MicroVM-based code execution platform API. - version: "0.1.0" + version: "0.1.3" servers: - url: http://localhost:8080 @@ -921,6 +921,38 @@ paths: "400": $ref: "#/components/responses/BadRequest" + /v1/capsules/usage: + get: + summary: Get daily CPU and RAM usage for your team + operationId: getCapsuleUsage + tags: [capsules] + security: + - apiKeyAuth: [] + parameters: + - name: from + in: query + required: false + schema: + type: string + format: date + description: Start date (YYYY-MM-DD). Defaults to 30 days ago. + - name: to + in: query + required: false + schema: + type: string + format: date + description: End date (YYYY-MM-DD). Defaults to today. + responses: + "200": + description: Daily usage data for the team + content: + application/json: + schema: + $ref: "#/components/schemas/UsageResponse" + "400": + $ref: "#/components/responses/BadRequest" + /v1/capsules/{id}: parameters: - name: id @@ -2432,6 +2464,28 @@ components: after this duration of inactivity (no exec or ping). 0 means no auto-pause. + UsageResponse: + type: object + properties: + from: + type: string + format: date + to: + type: string + format: date + points: + type: array + items: + type: object + properties: + date: + type: string + format: date + cpu_minutes: + type: number + ram_mb_minutes: + type: number + CapsuleStats: type: object properties: diff --git a/docs/.gitignore b/docs/.gitignore deleted file mode 100644 index b2d6de3..0000000 --- a/docs/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -# Dependencies -/node_modules - -# Production -/build - -# Generated files -.docusaurus -.cache-loader - -# Misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/pyproject.toml b/pyproject.toml index 839941f..33c72ac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,11 @@ [project] name = "wrenn" version = "0.1.0" -description = "Add your description here" +description = "Python SDK for Wrenn" readme = "README.md" authors = [ - { name = "Tasnim Kabir Sadik", email = "tksadik92@gmail.com" } + { name = "Rafeed M. Bhuiyan", email = "rafeed@omukk.dev" } + { name = "Tasnim Kabir Sadik", email = "tksadik@omukk.dev" } ] requires-python = ">=3.13" dependencies = [ diff --git a/src/wrenn/models/_generated.py b/src/wrenn/models/_generated.py index 3d53b03..5542c2f 100644 --- a/src/wrenn/models/_generated.py +++ b/src/wrenn/models/_generated.py @@ -1,10 +1,11 @@ # generated by datamodel-codegen: # filename: openapi.yaml -# timestamp: 2026-04-16T20:32:20+00:00 +# timestamp: 2026-04-22T20:21:34+00:00 from __future__ import annotations from pydantic import AwareDatetime, BaseModel, EmailStr, Field from typing import Annotated +from datetime import date as date_aliased from enum import StrEnum @@ -69,6 +70,18 @@ class CreateCapsuleRequest(BaseModel): ] = 0 +class Point(BaseModel): + date: date_aliased | None = None + cpu_minutes: float | None = None + ram_mb_minutes: float | None = None + + +class UsageResponse(BaseModel): + from_: Annotated[date_aliased | None, Field(alias="from")] = None + to: date_aliased | None = None + points: list[Point] | None = None + + class Range(StrEnum): field_5m = "5m" field_1h = "1h"