Repository: Significant-Gravitas/Auto-GPT
File: autogpt_platform/frontend/src/lib/autogpt-server-api/client.ts (TypeScript)

Code before:

  updateLibraryAgentPreset(
    presetId: string,
    preset: CreateLibraryAgentPresetRequest,
  ): Promise<LibraryAgentPreset> {
    return this._request("PUT", `/library/presets/${presetId}`, preset);
  }

  async deleteLibraryAgentPreset(presetId: string): Promise<void> {
    await this._request("DELETE", `/library/presets/${presetId}`);
  }

  executeLibraryAgentPreset(
    presetId: string,
    graphId: GraphID,
    graphVersion: number,
    nodeInput: { [key: string]: any },
  ): Promise<{ id: string }> {
    return this._request("POST", `/library/presets/${presetId}/execute`, {
      graph_id: graphId,
      graph_version: graphVersion,
      node_input: nodeInput,
    });
  }

  /////////////////////// SCHEDULES ////////////////////////

  async createSchedule(schedule: ScheduleCreatable): Promise<Schedule> {
    return this._request("POST", `/schedules`, schedule).then(
      parseScheduleTimestamp,
    );
  }

  async deleteSchedule(scheduleId: ScheduleID): Promise<{ id: string }> {
    return this._request("DELETE", `/schedules/${scheduleId}`);
  }

  async listSchedules(): Promise<Schedule[]> {
    return this._get(`/schedules`).then((schedules) =>
      schedules.map(parseScheduleTimestamp),
    );
  }

  ///////////////////////////////////////////
  /////////// INTERNAL FUNCTIONS ////////////
  //////////////////////////////??///////////

  private _get(path: string, query?: Record<string, any>) {
    return this._request("GET", path, query);
  }


Review comment (suggestion):
```suggestion
//////////////////////////////////
/////////// SCHEDULES ////////////
//////////////////////////////////
```


Code after:

  updateLibraryAgentPreset(
    presetId: string,
    preset: CreateLibraryAgentPresetRequest,
  ): Promise<LibraryAgentPreset> {
    return this._request("PUT", `/library/presets/${presetId}`, preset);
  }

  async deleteLibraryAgentPreset(presetId: string): Promise<void> {
    await this._request("DELETE", `/library/presets/${presetId}`);
  }

  executeLibraryAgentPreset(
    presetId: string,
    graphId: GraphID,
    graphVersion: number,
    nodeInput: { [key: string]: any },
  ): Promise<{ id: string }> {
    return this._request("POST", `/library/presets/${presetId}/execute`, {
      graph_id: graphId,
      graph_version: graphVersion,
      node_input: nodeInput,
    });
  }

  //////////////////////////////////
  /////////// SCHEDULES ////////////
  //////////////////////////////////

  async createSchedule(schedule: ScheduleCreatable): Promise<Schedule> {
    return this._request("POST", `/schedules`, schedule).then(
      parseScheduleTimestamp,
    );
  }

  async deleteSchedule(scheduleId: ScheduleID): Promise<{ id: string }> {
    return this._request("DELETE", `/schedules/${scheduleId}`);
  }

  async listSchedules(): Promise<Schedule[]> {
    return this._get(`/schedules`).then((schedules) =>
      schedules.map(parseScheduleTimestamp),
    );
  }

  ///////////////////////////////////////////
  /////////// INTERNAL FUNCTIONS ////////////
  //////////////////////////////??///////////

  private _get(path: string, query?: Record<string, any>) {
    return this._request("GET", path, query);