OpenRouterManagedApiKey.fromMap constructor

OpenRouterManagedApiKey.fromMap(
  1. Map<String, dynamic> map
)

Implementation

factory OpenRouterManagedApiKey.fromMap(Map<String, dynamic> map) =>
    OpenRouterManagedApiKey(
      hash: _requireString(map['hash'], 'hash'),
      name: _asString(map['name']),
      label: _asString(map['label']),
      creatorUserId: _asString(map['creator_user_id']),
      createdAt: _asDateTime(map['created_at']),
      updatedAt: _asDateTime(map['updated_at']),
      expiresAt: _asDateTime(map['expires_at']),
      limit: _asDouble(map['limit']),
      limitRemaining: _asDouble(map['limit_remaining']),
      limitReset: OpenRouterApiKeyLimitResetX.fromWireValue(
        _asString(map['limit_reset']),
      ),
      includeByokInLimit: _asBool(map['include_byok_in_limit']),
      usage: _asDouble(map['usage']),
      usageDaily: _asDouble(map['usage_daily']),
      usageWeekly: _asDouble(map['usage_weekly']),
      usageMonthly: _asDouble(map['usage_monthly']),
      byokUsage: _asDouble(map['byok_usage']),
      byokUsageDaily: _asDouble(map['byok_usage_daily']),
      byokUsageWeekly: _asDouble(map['byok_usage_weekly']),
      byokUsageMonthly: _asDouble(map['byok_usage_monthly']),
      disabled: _asBool(map['disabled']) ?? false,
    );