MCPcopy Index your code
hub / github.com/chartbrew/chartbrew / getAiUsage

Function getAiUsage

client/src/api/ai.js:103–124  ·  view source on GitHub ↗
(teamId, startDate, endDate)

Source from the content-addressed store, hash-verified

101}
102
103export async function getAiUsage(teamId, startDate, endDate) {
104 const token = getAuthToken();
105 let url = new URL(`${API_HOST}/ai/usage/${teamId}`);
106 if (startDate) {
107 url.searchParams.set("startDate", startDate);
108 }
109 if (endDate) {
110 url.searchParams.set("endDate", endDate);
111 }
112 const headers = new Headers({
113 "Accept": "application/json",
114 "Authorization": `Bearer ${token}`,
115 });
116
117 const response = await fetch(url.toString(), { headers, method: "GET" });
118 if (!response.ok) {
119 const error = await response.json();
120 throw new Error(error.error || "Failed to fetch AI usage");
121 }
122
123 return response.json();
124}

Callers 1

loadTeamUsageFunction · 0.90

Calls 2

getAuthTokenFunction · 0.90
setMethod · 0.45

Tested by

no test coverage detected