struct Gemini::Part

Overview

A datatype containing media that is part of a multi-part Content message.

Union field #data. #data can be only one of the following:

API Reference

Defined in:

gemini/types.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(pull : JSON::PullParser) #

Custom JSON deserializable


def self.new(data : Gemini::Blob | Gemini::FunctionCall | Gemini::FunctionResponse | String) #

Instance Method Detail


def data=(data : Text | FunctionCall | FunctionResponse | InlineData) #

def function_call #

Same as #function_call? but raise error if nil


def function_call? #

if #data type is FunctionCall will return value, or nil if not


def function_call?(&) #

Do not yield if #data is a diferent type


def function_response #

Same as #function_response? but raise error if nil


def function_response? #

if #data type is FunctionResponse will return value, or nil if not


def function_response?(&) #

Do not yield if #data is a diferent type


def inline_data #

Same as #inline_data? but raise error if nil


def inline_data? #

if #data type is InlineData will return value, or nil if not


def inline_data?(&) #

Do not yield if #data is a diferent type


def text #

Same as #text? but raise error if nil


def text? #

if #data type is Text will return value, or nil if not


def text?(&) #

Do not yield if #data is a diferent type


def to_json(json : JSON::Builder) #

Custom JSON serializable