getPrompt method

Future<PromptList?> getPrompt()

List returns the caller org's prompt library as one row per prompt: its name, type, every version number it has, its taxonomy and when it last changed.

List returns the caller org's prompt library as one row per prompt: its name, type, every version number it has, its taxonomy and when it last changed. The template bodies are deliberately absent — fetch one prompt to read its text.

Implementation

Future<PromptList?> getPrompt() async {
  final response = await getPromptWithHttpInfo();
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'PromptList',) as PromptList;

  }
  return null;
}