@neta-art/cohub 1.29.0 → 1.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/http.d.ts +6 -1
- package/dist/chunks/http.js +13 -0
- package/package.json +1 -1
package/dist/chunks/http.d.ts
CHANGED
|
@@ -1209,7 +1209,7 @@ type ExploreSpacesResponse = {
|
|
|
1209
1209
|
sections: ExploreSection[];
|
|
1210
1210
|
spaces: ExploreSpaceItem[];
|
|
1211
1211
|
};
|
|
1212
|
-
type Permission = "space.view" | "space.edit" | "space.label.view" | "space.label.manage" | "space.label.assign" | "session.view" | "session.edit" | "session.prompt.readonly" | "session.prompt.fullaccess" | "generation.create" | "file.view" | "file.view.filtered" | "file.edit" | "checkpoint.view" | "checkpoint.edit" | "member.view" | "member.manage" | "channel.view" | "channel.manage" | "cronjob.view" | "cronjob.manage" | "taskrun.view" | "sandbox.view" | "sandbox.manage" | "mod.view" | "mod.manage";
|
|
1212
|
+
type Permission = "space.view" | "space.edit" | "space.label.view" | "space.label.manage" | "space.label.assign" | "session.view" | "session.edit" | "session.prompt.readonly" | "session.prompt.fullaccess" | "generation.create" | "file.view" | "file.view.filtered" | "file.edit" | "checkpoint.view" | "checkpoint.edit" | "member.view" | "member.manage" | "channel.view" | "channel.manage" | "cronjob.view" | "cronjob.manage" | "taskrun.view" | "sandbox.view" | "sandbox.manage" | "mod.view" | "mod.manage" | "user.space.list" | "user.session.list" | "user.usage.read";
|
|
1213
1213
|
type SpaceAccess = {
|
|
1214
1214
|
role: SpaceRole | null;
|
|
1215
1215
|
permissions: Permission[];
|
|
@@ -2178,6 +2178,11 @@ declare class UserApi {
|
|
|
2178
2178
|
profile: UserProfile;
|
|
2179
2179
|
}>;
|
|
2180
2180
|
getRules(customFetch?: Fetch): Promise<UserRulesResponse>;
|
|
2181
|
+
listSessions(optionsOrFetch?: {
|
|
2182
|
+
limit?: number;
|
|
2183
|
+
cursor?: string | null;
|
|
2184
|
+
} | Fetch, customFetch?: Fetch): Promise<SpaceSessionsResponse>;
|
|
2185
|
+
getUsage(days?: number, customFetch?: Fetch): Promise<SpaceUsageResponse>;
|
|
2181
2186
|
setAuthToken(token: string): Promise<any>;
|
|
2182
2187
|
clearAuthToken(): Promise<null>;
|
|
2183
2188
|
}
|
package/dist/chunks/http.js
CHANGED
|
@@ -2092,6 +2092,19 @@ var UserApi = class {
|
|
|
2092
2092
|
fetch: customFetch
|
|
2093
2093
|
});
|
|
2094
2094
|
}
|
|
2095
|
+
listSessions(optionsOrFetch, customFetch) {
|
|
2096
|
+
const options = typeof optionsOrFetch === "function" ? void 0 : optionsOrFetch;
|
|
2097
|
+
const fetch = typeof optionsOrFetch === "function" ? optionsOrFetch : customFetch;
|
|
2098
|
+
const params = new URLSearchParams();
|
|
2099
|
+
if (options?.limit !== void 0) params.set("limit", String(options.limit));
|
|
2100
|
+
if (options?.cursor) params.set("cursor", options.cursor);
|
|
2101
|
+
const query = params.toString();
|
|
2102
|
+
return this.transport.request(`/api/me/sessions${query ? `?${query}` : ""}`, { fetch });
|
|
2103
|
+
}
|
|
2104
|
+
getUsage(days = 30, customFetch) {
|
|
2105
|
+
const params = new URLSearchParams({ days: String(days) });
|
|
2106
|
+
return this.transport.request(`/api/me/usage?${params.toString()}`, { fetch: customFetch });
|
|
2107
|
+
}
|
|
2095
2108
|
async setAuthToken(token) {
|
|
2096
2109
|
const trimmedToken = token.trim();
|
|
2097
2110
|
const response = await fetch(this.transportBaseUrl ? `${this.transportBaseUrl}/api/me` : "/api/me", { headers: { Authorization: `Bearer ${trimmedToken}` } });
|