Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Generate text and images via the reverse-engineered Gemini Web API with multi-turn conversation support.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
scripts/gemini-webapi/types/gem.ts
1export class Gem {2constructor(3public id: string,4public name: string,5public description: string | null,6public prompt: string | null,7public predefined: boolean,8) {}910toString(): string {11return `Gem(id='${this.id}', name='${this.name}', description='${this.description}', prompt='${this.prompt}', predefined=${this.predefined})`;12}13}1415export class GemJar implements Iterable<Gem> {16private m = new Map<string, Gem>();1718constructor(entries?: Iterable<[string, Gem]>) {19if (entries) for (const [id, gem] of entries) this.m.set(id, gem);20}2122[Symbol.iterator](): Iterator<Gem> {23return this.m.values();24}2526entries(): IterableIterator<[string, Gem]> {27return this.m.entries();28}2930values(): IterableIterator<Gem> {31return this.m.values();32}3334has(id: string): boolean {35return this.m.has(id);36}3738set(id: string, gem: Gem): this {39this.m.set(id, gem);40return this;41}4243get(id?: string | null, name?: string | null, def: Gem | null = null): Gem | null {44if (id == null && name == null) {45throw new Error('At least one of gem id or name must be provided.');46}4748if (id != null) {49const g = this.m.get(id) ?? null;50if (!g) return def;51if (name != null) return g.name === name ? g : def;52return g;53}5455if (name != null) {56for (const g of this.m.values()) {57if (g.name === name) return g;58}59return def;60}6162return def;63}6465filter(predefined: boolean | null = null, name: string | null = null): GemJar {66const out: [string, Gem][] = [];67for (const [id, gem] of this.m.entries()) {68if (predefined != null && gem.predefined !== predefined) continue;69if (name != null && gem.name !== name) continue;70out.push([id, gem]);71}72return new GemJar(out);73}74}7576