From 8a470bdaf101bc855ddaf476b7a95f4d88d852d8 Mon Sep 17 00:00:00 2001 From: hzyu-hub Date: Sat, 7 Feb 2026 05:49:41 -0500 Subject: [PATCH] fix: make assignedDate and quotaResetDate optional in CopilotUsageModels GitHub's /copilot_internal/user API returns null for assigned_date and quota_reset_date on trial/free Copilot plans, causing a DecodingError.valueNotFound when decoding the JSON response. This change makes both fields optional (String?) to handle null values gracefully. Fixes #162 --- Sources/CodexBarCore/CopilotUsageModels.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/CodexBarCore/CopilotUsageModels.swift b/Sources/CodexBarCore/CopilotUsageModels.swift index cd43664f6..669f8f52b 100644 --- a/Sources/CodexBarCore/CopilotUsageModels.swift +++ b/Sources/CodexBarCore/CopilotUsageModels.swift @@ -27,8 +27,8 @@ public struct CopilotUsageResponse: Sendable, Decodable { public let quotaSnapshots: QuotaSnapshots public let copilotPlan: String - public let assignedDate: String - public let quotaResetDate: String + public let assignedDate: String? + public let quotaResetDate: String? private enum CodingKeys: String, CodingKey { case quotaSnapshots = "quota_snapshots"