From 25c483ed069976a44d43c03cd6e9f60f9405e8fa Mon Sep 17 00:00:00 2001 From: James Ding Date: Wed, 24 Dec 2025 13:34:27 -0800 Subject: [PATCH 1/3] feat: add comprehensive API reference documentation for Fish Audio Go SDK --- api-reference/sdk/go/api-reference.md | 1083 +++++++++++++++++++++++++ 1 file changed, 1083 insertions(+) create mode 100644 api-reference/sdk/go/api-reference.md diff --git a/api-reference/sdk/go/api-reference.md b/api-reference/sdk/go/api-reference.md new file mode 100644 index 0000000..a3ae4b9 --- /dev/null +++ b/api-reference/sdk/go/api-reference.md @@ -0,0 +1,1083 @@ +--- +title: "API Reference" +description: "Complete reference for Fish Audio Go SDK" +icon: "book" +--- + + + +# fishaudio + +```go +import "github.com/fishaudio/fish-audio-go" +``` + + +## Constants + + + +```go +const ( + // DefaultBaseURL is the default Fish Audio API base URL. + DefaultBaseURL = "https://api.fish.audio" + + // DefaultTimeout is the default request timeout. + DefaultTimeout = 240 * time.Second + + // Version is the SDK version. + Version = "0.1.0" +) +``` + + +## type [APIError]() + +APIError is raised when the API returns an error response. + +```go +type APIError struct { + StatusCode int + Message string + Body string +} +``` + + +### func \(\*APIError\) [Error]() + +```go +func (e *APIError) Error() string +``` + + + + +### func \(\*APIError\) [IsFishAudioError]() + +```go +func (e *APIError) IsFishAudioError() +``` + + + + +## type [ASRResponse]() + +ASRResponse contains the result of speech\-to\-text transcription. + +```go +type ASRResponse struct { + // Text is the complete transcription of the audio. + Text string `json:"text"` + // Duration is the total audio duration in milliseconds. + Duration float64 `json:"duration"` + // Segments contains timestamped text segments. + Segments []ASRSegment `json:"segments"` +} +``` + + +## type [ASRSegment]() + +ASRSegment represents a timestamped segment of transcribed text. + +```go +type ASRSegment struct { + // Text is the transcribed text for this segment. + Text string `json:"text"` + // Start is the segment start time in seconds. + Start float64 `json:"start"` + // End is the segment end time in seconds. + End float64 `json:"end"` +} +``` + + +## type [ASRService]() + +ASRService provides speech\-to\-text operations. + +```go +type ASRService struct { + // contains filtered or unexported fields +} +``` + + +### func \(\*ASRService\) [Transcribe]() + +```go +func (s *ASRService) Transcribe(ctx context.Context, audio []byte, params *TranscribeParams) (*ASRResponse, error) +``` + +Transcribe converts audio to text. + +Example: + +``` +audio, _ := os.ReadFile("audio.mp3") +result, err := client.ASR.Transcribe(ctx, audio, &fishaudio.TranscribeParams{ + Language: "en", +}) +fmt.Println(result.Text) +``` + + +## type [AccountService]() + +AccountService provides account and billing operations. + +```go +type AccountService struct { + // contains filtered or unexported fields +} +``` + + +### func \(\*AccountService\) [GetCredits]() + +```go +func (s *AccountService) GetCredits(ctx context.Context, params *GetCreditsParams) (*Credits, error) +``` + +GetCredits returns the API credit balance. + +Example: + +``` +credits, err := client.Account.GetCredits(ctx, nil) +fmt.Printf("Available credits: %s\n", credits.Credit) +``` + + +### func \(\*AccountService\) [GetPackage]() + +```go +func (s *AccountService) GetPackage(ctx context.Context) (*Package, error) +``` + +GetPackage returns the user's package information. + +Example: + +``` +pkg, err := client.Account.GetPackage(ctx) +fmt.Printf("Balance: %d/%d\n", pkg.Balance, pkg.Total) +``` + + +## type [AudioFormat]() + +AudioFormat specifies the output audio format. + +```go +type AudioFormat string +``` + + + +```go +const ( + AudioFormatMP3 AudioFormat = "mp3" + AudioFormatWAV AudioFormat = "wav" + AudioFormatPCM AudioFormat = "pcm" + AudioFormatOpus AudioFormat = "opus" +) +``` + + +## type [AudioStream]() + +AudioStream wraps an HTTP response for streaming audio data. + +It provides two ways to consume audio: + +- Iterate chunk\-by\-chunk using Next\(\) and Bytes\(\) +- Collect all chunks at once using Collect\(\) + +Example: + +``` +// Stream chunks +stream, _ := client.TTS.Stream(ctx, params) +defer stream.Close() +for stream.Next() { + chunk := stream.Bytes() + // process chunk +} +if err := stream.Err(); err != nil { + // handle error +} + +// Or collect all at once +stream, _ := client.TTS.Stream(ctx, params) +audio, err := stream.Collect() +``` + +```go +type AudioStream struct { + // contains filtered or unexported fields +} +``` + + +### func \(\*AudioStream\) [Bytes]() + +```go +func (s *AudioStream) Bytes() []byte +``` + +Bytes returns the current chunk of audio data. Only valid after a successful call to Next\(\). + + +### func \(\*AudioStream\) [Close]() + +```go +func (s *AudioStream) Close() error +``` + +Close closes the underlying response body. + + +### func \(\*AudioStream\) [Collect]() + +```go +func (s *AudioStream) Collect() ([]byte, error) +``` + +Collect reads all remaining audio data and returns it as a single byte slice. This consumes the stream and closes it automatically. + + +### func \(\*AudioStream\) [Err]() + +```go +func (s *AudioStream) Err() error +``` + +Err returns any error that occurred during iteration. + + +### func \(\*AudioStream\) [Next]() + +```go +func (s *AudioStream) Next() bool +``` + +Next advances to the next chunk of audio data. It returns false when there are no more chunks or an error occurred. + + +### func \(\*AudioStream\) [Read]() + +```go +func (s *AudioStream) Read(p []byte) (n int, err error) +``` + +Read implements io.Reader interface. + + +## type [AuthenticationError]() + +AuthenticationError is raised when authentication fails \(401\). + +```go +type AuthenticationError struct { + *APIError +} +``` + + +## type [Author]() + +Author represents voice model author information. + +```go +type Author struct { + ID string `json:"_id"` + Nickname string `json:"nickname"` + Avatar string `json:"avatar"` +} +``` + + +## type [Client]() + +Client is the Fish Audio API client. + +```go +type Client struct { + + // Services + TTS *TTSService + ASR *ASRService + Voices *VoicesService + Account *AccountService + // contains filtered or unexported fields +} +``` + + +### func [NewClient]() + +```go +func NewClient(apiKey string, opts ...ClientOption) *Client +``` + +NewClient creates a new Fish Audio API client. + +If apiKey is empty, it will try to read from the FISH\_API\_KEY environment variable. + + +### func \(\*Client\) [Close]() + +```go +func (c *Client) Close() error +``` + +Close closes the HTTP client's idle connections. + + +## type [ClientOption]() + +ClientOption is a function that configures the Client. + +```go +type ClientOption func(*Client) +``` + + +### func [WithBaseURL]() + +```go +func WithBaseURL(url string) ClientOption +``` + +WithBaseURL sets a custom base URL for the API. + + +### func [WithHTTPClient]() + +```go +func WithHTTPClient(httpClient *http.Client) ClientOption +``` + +WithHTTPClient sets a custom HTTP client. + + +### func [WithTimeout]() + +```go +func WithTimeout(timeout time.Duration) ClientOption +``` + +WithTimeout sets the default timeout for requests. + + +## type [ConvertParams]() + +ConvertParams contains parameters for TTS conversion. + +```go +type ConvertParams struct { + // Text is the text to synthesize into speech (required). + Text string `json:"text"` + // ReferenceID is the voice model ID to use. + ReferenceID string `json:"reference_id,omitempty"` + // References is a list of reference audio for voice cloning. + References []ReferenceAudio `json:"references,omitempty"` + // Format is the audio output format. + Format AudioFormat `json:"format,omitempty"` + // Latency is the generation mode. + Latency LatencyMode `json:"latency,omitempty"` + // Speed is a shorthand for setting prosody speed (0.5-2.0). + Speed float64 `json:"-"` + // Config provides additional TTS configuration. + Config *TTSConfig `json:"-"` +} +``` + + +## type [CreateVoiceParams]() + +CreateVoiceParams contains parameters for creating a voice. + +```go +type CreateVoiceParams struct { + // Title is the voice model name (required). + Title string + // Voices is a list of audio file bytes for training (required). + Voices [][]byte + // Description is the voice description. + Description string + // Texts are transcripts for voice samples. + Texts []string + // Tags are tags for categorization. + Tags []string + // CoverImage is the cover image bytes. + CoverImage []byte + // Visibility is the visibility setting. Default: "private". + Visibility Visibility + // TrainMode is the training mode. Default: "fast". + TrainMode TrainMode + // EnhanceAudioQuality indicates whether to enhance audio quality. Default: true. + EnhanceAudioQuality *bool +} +``` + + +## type [Credits]() + +Credits represents the user's API credit balance. + +```go +type Credits struct { + ID string `json:"_id"` + UserID string `json:"user_id"` + Credit string `json:"credit"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + HasPhoneSHA256 *bool `json:"has_phone_sha256,omitempty"` + HasFreeCredit *bool `json:"has_free_credit,omitempty"` +} +``` + + +## type [FishAudioError]() + +FishAudioError is the base interface for all Fish Audio SDK errors. + +```go +type FishAudioError interface { + IsFishAudioError() + // contains filtered or unexported methods +} +``` + + +## type [GetCreditsParams]() + +GetCreditsParams contains parameters for getting credits. + +```go +type GetCreditsParams struct { + // CheckFreeCredit indicates whether to check free credit availability. + CheckFreeCredit bool +} +``` + + +## type [LatencyMode]() + +LatencyMode specifies the generation latency mode. + +```go +type LatencyMode string +``` + + + +```go +const ( + LatencyNormal LatencyMode = "normal" + LatencyBalanced LatencyMode = "balanced" +) +``` + + +## type [ListVoicesParams]() + +ListVoicesParams contains parameters for listing voices. + +```go +type ListVoicesParams struct { + // PageSize is the number of results per page. Default: 10. + PageSize int + // PageNumber is the page number (1-indexed). Default: 1. + PageNumber int + // Title filters by title. + Title string + // Tags filters by tags. + Tags []string + // SelfOnly returns only the user's own voices. + SelfOnly bool + // AuthorID filters by author ID. + AuthorID string + // Language filters by language(s). + Language []string + // TitleLanguage filters by title language(s). + TitleLanguage []string + // SortBy is the sort field. Options: "task_count", "created_at". Default: "task_count". + SortBy string +} +``` + + +## type [Model]() + +Model specifies the TTS model to use. + +```go +type Model string +``` + + + +```go +const ( + ModelSpeech15 Model = "speech-1.5" + ModelSpeech16 Model = "speech-1.6" + ModelS1 Model = "s1" +) +``` + + +## type [ModelState]() + +ModelState specifies the state of a voice model. + +```go +type ModelState string +``` + + + +```go +const ( + ModelStateCreated ModelState = "created" + ModelStateTraining ModelState = "training" + ModelStateTrained ModelState = "trained" + ModelStateFailed ModelState = "failed" +) +``` + + +## type [NotFoundError]() + +NotFoundError is raised when a resource is not found \(404\). + +```go +type NotFoundError struct { + *APIError +} +``` + + +## type [Package]() + +Package represents the user's prepaid package information. + +```go +type Package struct { + ID string `json:"_id"` + UserID string `json:"user_id"` + Type string `json:"type"` + Total int `json:"total"` + Balance int `json:"balance"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + FinishedAt *string `json:"finished_at,omitempty"` +} +``` + + +## type [PaginatedResponse]() + +PaginatedResponse wraps paginated API responses. + +```go +type PaginatedResponse[T any] struct { + Total int `json:"total"` + Items []T `json:"items"` +} +``` + + +## type [PermissionError]() + +PermissionError is raised when permission is denied \(403\). + +```go +type PermissionError struct { + *APIError +} +``` + + +## type [Prosody]() + +Prosody contains speech prosody settings \(speed and volume\). + +```go +type Prosody struct { + // Speed is the speech speed multiplier. Range: 0.5-2.0. Default: 1.0. + Speed float64 `json:"speed,omitempty"` + // Volume is the volume adjustment in decibels. Range: -20.0 to 20.0. Default: 0.0. + Volume float64 `json:"volume,omitempty"` +} +``` + + +## type [RateLimitError]() + +RateLimitError is raised when rate limit is exceeded \(429\). + +```go +type RateLimitError struct { + *APIError +} +``` + + +## type [ReferenceAudio]() + +ReferenceAudio contains reference audio for voice cloning. + +```go +type ReferenceAudio struct { + // Audio is the audio file bytes for the reference sample. + Audio []byte `json:"audio"` + // Text is the transcription of what is spoken in the reference audio. + Text string `json:"text"` +} +``` + + +## type [RequestOptions]() + +RequestOptions allows per\-request overrides of client defaults. + +```go +type RequestOptions struct { + // Timeout overrides the client's default timeout. + Timeout time.Duration + + // AdditionalHeaders are extra headers to include in the request. + AdditionalHeaders map[string]string + + // AdditionalQueryParams are extra query parameters to include. + AdditionalQueryParams map[string]string +} +``` + + +## type [Sample]() + +Sample represents a sample audio for a voice model. + +```go +type Sample struct { + Title string `json:"title"` + Text string `json:"text"` + TaskID string `json:"task_id"` + Audio string `json:"audio"` +} +``` + + +## type [ServerError]() + +ServerError is raised when the server encounters an error \(5xx\). + +```go +type ServerError struct { + *APIError +} +``` + + +## type [StreamParams]() + +StreamParams contains parameters for TTS streaming. + +```go +type StreamParams struct { + // Text is the text to synthesize into speech (required). + Text string `json:"text"` + // ReferenceID is the voice model ID to use. + ReferenceID string `json:"reference_id,omitempty"` + // References is a list of reference audio for voice cloning. + References []ReferenceAudio `json:"references,omitempty"` + // Format is the audio output format. + Format AudioFormat `json:"format,omitempty"` + // Latency is the generation mode. + Latency LatencyMode `json:"latency,omitempty"` + // Speed is a shorthand for setting prosody speed (0.5-2.0). + Speed float64 `json:"-"` + // Config provides additional TTS configuration. + Config *TTSConfig `json:"-"` +} +``` + + +## type [TTSConfig]() + +TTSConfig is reusable configuration for text\-to\-speech requests. + +```go +type TTSConfig struct { + // Format is the audio output format. Options: "mp3", "wav", "pcm", "opus". Default: "mp3". + Format AudioFormat `json:"format,omitempty"` + // SampleRate is the audio sample rate in Hz. + SampleRate int `json:"sample_rate,omitempty"` + // MP3Bitrate is the MP3 bitrate in kbps. Options: 64, 128, 192. Default: 128. + MP3Bitrate int `json:"mp3_bitrate,omitempty"` + // OpusBitrate is the Opus bitrate in kbps. Options: -1000, 24, 32, 48, 64. Default: 32. + OpusBitrate int `json:"opus_bitrate,omitempty"` + // Normalize indicates whether to normalize/clean the input text. Default: true. + Normalize *bool `json:"normalize,omitempty"` + // ChunkLength is the characters per generation chunk. Range: 100-300. Default: 200. + ChunkLength int `json:"chunk_length,omitempty"` + // Latency is the generation mode. Options: "normal", "balanced". Default: "balanced". + Latency LatencyMode `json:"latency,omitempty"` + // ReferenceID is the voice model ID from fish.audio. + ReferenceID string `json:"reference_id,omitempty"` + // References is a list of reference audio samples for instant voice cloning. + References []ReferenceAudio `json:"references,omitempty"` + // Prosody contains speech speed and volume settings. + Prosody *Prosody `json:"prosody,omitempty"` + // TopP is the nucleus sampling parameter. Range: 0.0-1.0. Default: 0.7. + TopP float64 `json:"top_p,omitempty"` + // Temperature is the randomness in generation. Range: 0.0-1.0. Default: 0.7. + Temperature float64 `json:"temperature,omitempty"` +} +``` + + +## type [TTSService]() + +TTSService provides text\-to\-speech operations. + +```go +type TTSService struct { + // contains filtered or unexported fields +} +``` + + +### func \(\*TTSService\) [Convert]() + +```go +func (s *TTSService) Convert(ctx context.Context, params *ConvertParams) ([]byte, error) +``` + +Convert generates speech from text and returns the complete audio. + + +### func \(\*TTSService\) [Stream]() + +```go +func (s *TTSService) Stream(ctx context.Context, params *StreamParams) (*AudioStream, error) +``` + +Stream generates speech from text and returns an audio stream. + + +### func \(\*TTSService\) [StreamWebSocket]() + +```go +func (s *TTSService) StreamWebSocket(ctx context.Context, textChan <-chan string, params *StreamParams, opts *WebSocketOptions) (*WebSocketAudioStream, error) +``` + +StreamWebSocket streams text to speech over WebSocket for real\-time generation. + +The textChan receives text chunks to synthesize. Close the channel to end streaming. Returns a WebSocketAudioStream that can be iterated for audio chunks. + + +## type [TrainMode]() + +TrainMode specifies the training mode for voice models. + +```go +type TrainMode string +``` + + + +```go +const ( + TrainModeFast TrainMode = "fast" +) +``` + + +## type [TranscribeParams]() + +TranscribeParams contains parameters for ASR transcription. + +```go +type TranscribeParams struct { + // Language is the language code (e.g., "en", "zh"). Auto-detected if empty. + Language string + // IncludeTimestamps indicates whether to include timestamp information. Default: true. + IncludeTimestamps *bool +} +``` + + +## type [UpdateVoiceParams]() + +UpdateVoiceParams contains parameters for updating a voice. + +```go +type UpdateVoiceParams struct { + // Title is the new title. + Title string + // Description is the new description. + Description string + // CoverImage is the new cover image bytes. + CoverImage []byte + // Visibility is the new visibility setting. + Visibility Visibility + // Tags are the new tags. + Tags []string +} +``` + + +## type [ValidationError]() + +ValidationError is raised when request validation fails \(422\). + +```go +type ValidationError struct { + *APIError +} +``` + + +## type [Visibility]() + +Visibility specifies the visibility of a voice model. + +```go +type Visibility string +``` + + + +```go +const ( + VisibilityPublic Visibility = "public" + VisibilityUnlist Visibility = "unlist" + VisibilityPrivate Visibility = "private" +) +``` + + +## type [Voice]() + +Voice represents a voice model. + +```go +type Voice struct { + ID string `json:"_id"` + Type string `json:"type"` + Title string `json:"title"` + Description string `json:"description"` + CoverImage string `json:"cover_image"` + TrainMode TrainMode `json:"train_mode"` + State ModelState `json:"state"` + Tags []string `json:"tags"` + Samples []Sample `json:"samples"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` + Languages []string `json:"languages"` + Visibility Visibility `json:"visibility"` + LockVisibility bool `json:"lock_visibility"` + LikeCount int `json:"like_count"` + MarkCount int `json:"mark_count"` + SharedCount int `json:"shared_count"` + TaskCount int `json:"task_count"` + Liked bool `json:"liked"` + Marked bool `json:"marked"` + Author Author `json:"author"` +} +``` + + +## type [VoicesService]() + +VoicesService provides voice management operations. + +```go +type VoicesService struct { + // contains filtered or unexported fields +} +``` + + +### func \(\*VoicesService\) [Create]() + +```go +func (s *VoicesService) Create(ctx context.Context, params *CreateVoiceParams) (*Voice, error) +``` + +Create creates/clones a new voice. + + +### func \(\*VoicesService\) [Delete]() + +```go +func (s *VoicesService) Delete(ctx context.Context, voiceID string) error +``` + +Delete deletes a voice. + + +### func \(\*VoicesService\) [Get]() + +```go +func (s *VoicesService) Get(ctx context.Context, voiceID string) (*Voice, error) +``` + +Get returns a voice by ID. + + +### func \(\*VoicesService\) [List]() + +```go +func (s *VoicesService) List(ctx context.Context, params *ListVoicesParams) (*PaginatedResponse[Voice], error) +``` + +List returns available voices/models. + + +### func \(\*VoicesService\) [Update]() + +```go +func (s *VoicesService) Update(ctx context.Context, voiceID string, params *UpdateVoiceParams) error +``` + +Update updates voice metadata. + + +## type [WebSocketAudioStream]() + +WebSocketAudioStream wraps WebSocket audio chunks for iteration. + +```go +type WebSocketAudioStream struct { + // contains filtered or unexported fields +} +``` + + +### func \(\*WebSocketAudioStream\) [Bytes]() + +```go +func (s *WebSocketAudioStream) Bytes() []byte +``` + +Bytes returns the current chunk of audio data. + + +### func \(\*WebSocketAudioStream\) [Close]() + +```go +func (s *WebSocketAudioStream) Close() error +``` + +Close closes the stream. + + +### func \(\*WebSocketAudioStream\) [Collect]() + +```go +func (s *WebSocketAudioStream) Collect() ([]byte, error) +``` + +Collect reads all audio chunks and returns them as a single byte slice. + + +### func \(\*WebSocketAudioStream\) [Err]() + +```go +func (s *WebSocketAudioStream) Err() error +``` + +Err returns any error that occurred during iteration. + + +### func \(\*WebSocketAudioStream\) [Next]() + +```go +func (s *WebSocketAudioStream) Next() bool +``` + +Next advances to the next chunk of audio data. Returns false when there are no more chunks or an error occurred. + + +### func \(\*WebSocketAudioStream\) [Read]() + +```go +func (s *WebSocketAudioStream) Read(p []byte) (n int, err error) +``` + +Read implements io.Reader interface. + + +## type [WebSocketError]() + +WebSocketError is raised when WebSocket connection or streaming fails. + +```go +type WebSocketError struct { + Message string +} +``` + + +### func \(\*WebSocketError\) [Error]() + +```go +func (e *WebSocketError) Error() string +``` + + + + +### func \(\*WebSocketError\) [IsFishAudioError]() + +```go +func (e *WebSocketError) IsFishAudioError() +``` + + + + +## type [WebSocketOptions]() + +WebSocketOptions configures WebSocket connections. + +```go +type WebSocketOptions struct { + // PingTimeout is the maximum delay to wait for a pong response. + // Default: 20 seconds. + PingTimeout time.Duration + + // PingInterval is the interval for sending ping messages. + // Default: 20 seconds. + PingInterval time.Duration + + // MaxMessageSize is the maximum message size in bytes. + // Default: 65536 bytes (64 KiB). + MaxMessageSize int64 + + // ReadBufferSize is the size of the read buffer. + ReadBufferSize int + + // WriteBufferSize is the size of the write buffer. + WriteBufferSize int +} +``` + + +### func [DefaultWebSocketOptions]() + +```go +func DefaultWebSocketOptions() *WebSocketOptions +``` + +DefaultWebSocketOptions returns WebSocketOptions with default values. + +Generated by [gomarkdoc]() From fe4e3cc605c36aa4db9a2aa067423d44b36bfb5a Mon Sep 17 00:00:00 2001 From: James Ding Date: Wed, 24 Dec 2025 15:04:52 -0800 Subject: [PATCH 2/3] feat: rename api-reference.md to api-reference.mdx and update anchor tags for consistency --- .../{api-reference.md => api-reference.mdx} | 356 +++++++++--------- 1 file changed, 178 insertions(+), 178 deletions(-) rename api-reference/sdk/go/{api-reference.md => api-reference.mdx} (62%) diff --git a/api-reference/sdk/go/api-reference.md b/api-reference/sdk/go/api-reference.mdx similarity index 62% rename from api-reference/sdk/go/api-reference.md rename to api-reference/sdk/go/api-reference.mdx index a3ae4b9..1f10a76 100644 --- a/api-reference/sdk/go/api-reference.md +++ b/api-reference/sdk/go/api-reference.mdx @@ -4,7 +4,7 @@ description: "Complete reference for Fish Audio Go SDK" icon: "book" --- - + # fishaudio @@ -15,7 +15,7 @@ import "github.com/fishaudio/fish-audio-go" ## Constants - + ```go const ( @@ -30,8 +30,8 @@ const ( ) ``` - -## type [APIError]() + +## type [APIError](https://github.com/fishaudio/fish-audio-go/blob/main/errors.go#L12-L16) APIError is raised when the API returns an error response. @@ -43,8 +43,8 @@ type APIError struct { } ``` - -### func \(\*APIError\) [Error]() + +### func (*APIError) [Error](https://github.com/fishaudio/fish-audio-go/blob/main/errors.go#L18) ```go func (e *APIError) Error() string @@ -52,8 +52,8 @@ func (e *APIError) Error() string - -### func \(\*APIError\) [IsFishAudioError]() + +### func (*APIError) [IsFishAudioError](https://github.com/fishaudio/fish-audio-go/blob/main/errors.go#L22) ```go func (e *APIError) IsFishAudioError() @@ -61,10 +61,10 @@ func (e *APIError) IsFishAudioError() - -## type [ASRResponse]() + +## type [ASRResponse](https://github.com/fishaudio/fish-audio-go/blob/main/asr.go#L24-L31) -ASRResponse contains the result of speech\-to\-text transcription. +ASRResponse contains the result of speech-to-text transcription. ```go type ASRResponse struct { @@ -77,8 +77,8 @@ type ASRResponse struct { } ``` - -## type [ASRSegment]() + +## type [ASRSegment](https://github.com/fishaudio/fish-audio-go/blob/main/asr.go#L14-L21) ASRSegment represents a timestamped segment of transcribed text. @@ -93,10 +93,10 @@ type ASRSegment struct { } ``` - -## type [ASRService]() + +## type [ASRService](https://github.com/fishaudio/fish-audio-go/blob/main/asr.go#L42-L44) -ASRService provides speech\-to\-text operations. +ASRService provides speech-to-text operations. ```go type ASRService struct { @@ -104,8 +104,8 @@ type ASRService struct { } ``` - -### func \(\*ASRService\) [Transcribe]() + +### func (*ASRService) [Transcribe](https://github.com/fishaudio/fish-audio-go/blob/main/asr.go#L55) ```go func (s *ASRService) Transcribe(ctx context.Context, audio []byte, params *TranscribeParams) (*ASRResponse, error) @@ -123,8 +123,8 @@ result, err := client.ASR.Transcribe(ctx, audio, &fishaudio.TranscribeParams{ fmt.Println(result.Text) ``` - -## type [AccountService]() + +## type [AccountService](https://github.com/fishaudio/fish-audio-go/blob/main/account.go#L38-L40) AccountService provides account and billing operations. @@ -134,8 +134,8 @@ type AccountService struct { } ``` - -### func \(\*AccountService\) [GetCredits]() + +### func (*AccountService) [GetCredits](https://github.com/fishaudio/fish-audio-go/blob/main/account.go#L48) ```go func (s *AccountService) GetCredits(ctx context.Context, params *GetCreditsParams) (*Credits, error) @@ -150,8 +150,8 @@ credits, err := client.Account.GetCredits(ctx, nil) fmt.Printf("Available credits: %s\n", credits.Credit) ``` - -### func \(\*AccountService\) [GetPackage]() + +### func (*AccountService) [GetPackage](https://github.com/fishaudio/fish-audio-go/blob/main/account.go#L68) ```go func (s *AccountService) GetPackage(ctx context.Context) (*Package, error) @@ -166,8 +166,8 @@ pkg, err := client.Account.GetPackage(ctx) fmt.Printf("Balance: %d/%d\n", pkg.Balance, pkg.Total) ``` - -## type [AudioFormat]() + +## type [AudioFormat](https://github.com/fishaudio/fish-audio-go/blob/main/shared.go#L4) AudioFormat specifies the output audio format. @@ -175,7 +175,7 @@ AudioFormat specifies the output audio format. type AudioFormat string ``` - + ```go const ( @@ -186,15 +186,15 @@ const ( ) ``` - -## type [AudioStream]() + +## type [AudioStream](https://github.com/fishaudio/fish-audio-go/blob/main/audio_stream.go#L31-L37) AudioStream wraps an HTTP response for streaming audio data. It provides two ways to consume audio: -- Iterate chunk\-by\-chunk using Next\(\) and Bytes\(\) -- Collect all chunks at once using Collect\(\) +- Iterate chunk-by-chunk using Next() and Bytes() +- Collect all chunks at once using Collect() Example: @@ -221,17 +221,17 @@ type AudioStream struct { } ``` - -### func \(\*AudioStream\) [Bytes]() + +### func (*AudioStream) [Bytes](https://github.com/fishaudio/fish-audio-go/blob/main/audio_stream.go#L71) ```go func (s *AudioStream) Bytes() []byte ``` -Bytes returns the current chunk of audio data. Only valid after a successful call to Next\(\). +Bytes returns the current chunk of audio data. Only valid after a successful call to Next(). - -### func \(\*AudioStream\) [Close]() + +### func (*AudioStream) [Close](https://github.com/fishaudio/fish-audio-go/blob/main/audio_stream.go#L95) ```go func (s *AudioStream) Close() error @@ -239,8 +239,8 @@ func (s *AudioStream) Close() error Close closes the underlying response body. - -### func \(\*AudioStream\) [Collect]() + +### func (*AudioStream) [Collect](https://github.com/fishaudio/fish-audio-go/blob/main/audio_stream.go#L82) ```go func (s *AudioStream) Collect() ([]byte, error) @@ -248,8 +248,8 @@ func (s *AudioStream) Collect() ([]byte, error) Collect reads all remaining audio data and returns it as a single byte slice. This consumes the stream and closes it automatically. - -### func \(\*AudioStream\) [Err]() + +### func (*AudioStream) [Err](https://github.com/fishaudio/fish-audio-go/blob/main/audio_stream.go#L76) ```go func (s *AudioStream) Err() error @@ -257,8 +257,8 @@ func (s *AudioStream) Err() error Err returns any error that occurred during iteration. - -### func \(\*AudioStream\) [Next]() + +### func (*AudioStream) [Next](https://github.com/fishaudio/fish-audio-go/blob/main/audio_stream.go#L49) ```go func (s *AudioStream) Next() bool @@ -266,8 +266,8 @@ func (s *AudioStream) Next() bool Next advances to the next chunk of audio data. It returns false when there are no more chunks or an error occurred. - -### func \(\*AudioStream\) [Read]() + +### func (*AudioStream) [Read](https://github.com/fishaudio/fish-audio-go/blob/main/audio_stream.go#L107) ```go func (s *AudioStream) Read(p []byte) (n int, err error) @@ -275,10 +275,10 @@ func (s *AudioStream) Read(p []byte) (n int, err error) Read implements io.Reader interface. - -## type [AuthenticationError]() + +## type [AuthenticationError](https://github.com/fishaudio/fish-audio-go/blob/main/errors.go#L25-L27) -AuthenticationError is raised when authentication fails \(401\). +AuthenticationError is raised when authentication fails (401). ```go type AuthenticationError struct { @@ -286,8 +286,8 @@ type AuthenticationError struct { } ``` - -## type [Author]() + +## type [Author](https://github.com/fishaudio/fish-audio-go/blob/main/voices.go#L26-L30) Author represents voice model author information. @@ -299,8 +299,8 @@ type Author struct { } ``` - -## type [Client]() + +## type [Client](https://github.com/fishaudio/fish-audio-go/blob/main/client.go#L26-L37) Client is the Fish Audio API client. @@ -316,8 +316,8 @@ type Client struct { } ``` - -### func [NewClient]() + +### func [NewClient](https://github.com/fishaudio/fish-audio-go/blob/main/client.go#L42) ```go func NewClient(apiKey string, opts ...ClientOption) *Client @@ -325,10 +325,10 @@ func NewClient(apiKey string, opts ...ClientOption) *Client NewClient creates a new Fish Audio API client. -If apiKey is empty, it will try to read from the FISH\_API\_KEY environment variable. +If apiKey is empty, it will try to read from the FISH_API_KEY environment variable. - -### func \(\*Client\) [Close]() + +### func (*Client) [Close](https://github.com/fishaudio/fish-audio-go/blob/main/client.go#L73) ```go func (c *Client) Close() error @@ -336,8 +336,8 @@ func (c *Client) Close() error Close closes the HTTP client's idle connections. - -## type [ClientOption]() + +## type [ClientOption](https://github.com/fishaudio/fish-audio-go/blob/main/options.go#L9) ClientOption is a function that configures the Client. @@ -345,8 +345,8 @@ ClientOption is a function that configures the Client. type ClientOption func(*Client) ``` - -### func [WithBaseURL]() + +### func [WithBaseURL](https://github.com/fishaudio/fish-audio-go/blob/main/options.go#L12) ```go func WithBaseURL(url string) ClientOption @@ -354,8 +354,8 @@ func WithBaseURL(url string) ClientOption WithBaseURL sets a custom base URL for the API. - -### func [WithHTTPClient]() + +### func [WithHTTPClient](https://github.com/fishaudio/fish-audio-go/blob/main/options.go#L19) ```go func WithHTTPClient(httpClient *http.Client) ClientOption @@ -363,8 +363,8 @@ func WithHTTPClient(httpClient *http.Client) ClientOption WithHTTPClient sets a custom HTTP client. - -### func [WithTimeout]() + +### func [WithTimeout](https://github.com/fishaudio/fish-audio-go/blob/main/options.go#L26) ```go func WithTimeout(timeout time.Duration) ClientOption @@ -372,8 +372,8 @@ func WithTimeout(timeout time.Duration) ClientOption WithTimeout sets the default timeout for requests. - -## type [ConvertParams]() + +## type [ConvertParams](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L60-L75) ConvertParams contains parameters for TTS conversion. @@ -396,8 +396,8 @@ type ConvertParams struct { } ``` - -## type [CreateVoiceParams]() + +## type [CreateVoiceParams](https://github.com/fishaudio/fish-audio-go/blob/main/voices.go#L80-L99) CreateVoiceParams contains parameters for creating a voice. @@ -424,8 +424,8 @@ type CreateVoiceParams struct { } ``` - -## type [Credits]() + +## type [Credits](https://github.com/fishaudio/fish-audio-go/blob/main/account.go#L9-L17) Credits represents the user's API credit balance. @@ -441,8 +441,8 @@ type Credits struct { } ``` - -## type [FishAudioError]() + +## type [FishAudioError](https://github.com/fishaudio/fish-audio-go/blob/main/errors.go#L6-L9) FishAudioError is the base interface for all Fish Audio SDK errors. @@ -453,8 +453,8 @@ type FishAudioError interface { } ``` - -## type [GetCreditsParams]() + +## type [GetCreditsParams](https://github.com/fishaudio/fish-audio-go/blob/main/account.go#L32-L35) GetCreditsParams contains parameters for getting credits. @@ -465,8 +465,8 @@ type GetCreditsParams struct { } ``` - -## type [LatencyMode]() + +## type [LatencyMode](https://github.com/fishaudio/fish-audio-go/blob/main/shared.go#L14) LatencyMode specifies the generation latency mode. @@ -474,7 +474,7 @@ LatencyMode specifies the generation latency mode. type LatencyMode string ``` - + ```go const ( @@ -483,8 +483,8 @@ const ( ) ``` - -## type [ListVoicesParams]() + +## type [ListVoicesParams](https://github.com/fishaudio/fish-audio-go/blob/main/voices.go#L58-L77) ListVoicesParams contains parameters for listing voices. @@ -511,8 +511,8 @@ type ListVoicesParams struct { } ``` - -## type [Model]() + +## type [Model](https://github.com/fishaudio/fish-audio-go/blob/main/shared.go#L54) Model specifies the TTS model to use. @@ -520,7 +520,7 @@ Model specifies the TTS model to use. type Model string ``` - + ```go const ( @@ -530,8 +530,8 @@ const ( ) ``` - -## type [ModelState]() + +## type [ModelState](https://github.com/fishaudio/fish-audio-go/blob/main/shared.go#L44) ModelState specifies the state of a voice model. @@ -539,7 +539,7 @@ ModelState specifies the state of a voice model. type ModelState string ``` - + ```go const ( @@ -550,10 +550,10 @@ const ( ) ``` - -## type [NotFoundError]() + +## type [NotFoundError](https://github.com/fishaudio/fish-audio-go/blob/main/errors.go#L35-L37) -NotFoundError is raised when a resource is not found \(404\). +NotFoundError is raised when a resource is not found (404). ```go type NotFoundError struct { @@ -561,8 +561,8 @@ type NotFoundError struct { } ``` - -## type [Package]() + +## type [Package](https://github.com/fishaudio/fish-audio-go/blob/main/account.go#L20-L29) Package represents the user's prepaid package information. @@ -579,8 +579,8 @@ type Package struct { } ``` - -## type [PaginatedResponse]() + +## type [PaginatedResponse](https://github.com/fishaudio/fish-audio-go/blob/main/shared.go#L22-L25) PaginatedResponse wraps paginated API responses. @@ -591,10 +591,10 @@ type PaginatedResponse[T any] struct { } ``` - -## type [PermissionError]() + +## type [PermissionError](https://github.com/fishaudio/fish-audio-go/blob/main/errors.go#L30-L32) -PermissionError is raised when permission is denied \(403\). +PermissionError is raised when permission is denied (403). ```go type PermissionError struct { @@ -602,10 +602,10 @@ type PermissionError struct { } ``` - -## type [Prosody]() + +## type [Prosody](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L24-L29) -Prosody contains speech prosody settings \(speed and volume\). +Prosody contains speech prosody settings (speed and volume). ```go type Prosody struct { @@ -616,10 +616,10 @@ type Prosody struct { } ``` - -## type [RateLimitError]() + +## type [RateLimitError](https://github.com/fishaudio/fish-audio-go/blob/main/errors.go#L40-L42) -RateLimitError is raised when rate limit is exceeded \(429\). +RateLimitError is raised when rate limit is exceeded (429). ```go type RateLimitError struct { @@ -627,8 +627,8 @@ type RateLimitError struct { } ``` - -## type [ReferenceAudio]() + +## type [ReferenceAudio](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L16-L21) ReferenceAudio contains reference audio for voice cloning. @@ -641,10 +641,10 @@ type ReferenceAudio struct { } ``` - -## type [RequestOptions]() + +## type [RequestOptions](https://github.com/fishaudio/fish-audio-go/blob/main/options.go#L33-L42) -RequestOptions allows per\-request overrides of client defaults. +RequestOptions allows per-request overrides of client defaults. ```go type RequestOptions struct { @@ -659,8 +659,8 @@ type RequestOptions struct { } ``` - -## type [Sample]() + +## type [Sample](https://github.com/fishaudio/fish-audio-go/blob/main/voices.go#L18-L23) Sample represents a sample audio for a voice model. @@ -673,10 +673,10 @@ type Sample struct { } ``` - -## type [ServerError]() + +## type [ServerError](https://github.com/fishaudio/fish-audio-go/blob/main/errors.go#L50-L52) -ServerError is raised when the server encounters an error \(5xx\). +ServerError is raised when the server encounters an error (5xx). ```go type ServerError struct { @@ -684,8 +684,8 @@ type ServerError struct { } ``` - -## type [StreamParams]() + +## type [StreamParams](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L78-L93) StreamParams contains parameters for TTS streaming. @@ -708,10 +708,10 @@ type StreamParams struct { } ``` - -## type [TTSConfig]() + +## type [TTSConfig](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L32-L57) -TTSConfig is reusable configuration for text\-to\-speech requests. +TTSConfig is reusable configuration for text-to-speech requests. ```go type TTSConfig struct { @@ -742,10 +742,10 @@ type TTSConfig struct { } ``` - -## type [TTSService]() + +## type [TTSService](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L113-L115) -TTSService provides text\-to\-speech operations. +TTSService provides text-to-speech operations. ```go type TTSService struct { @@ -753,8 +753,8 @@ type TTSService struct { } ``` - -### func \(\*TTSService\) [Convert]() + +### func (*TTSService) [Convert](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L118) ```go func (s *TTSService) Convert(ctx context.Context, params *ConvertParams) ([]byte, error) @@ -762,8 +762,8 @@ func (s *TTSService) Convert(ctx context.Context, params *ConvertParams) ([]byte Convert generates speech from text and returns the complete audio. - -### func \(\*TTSService\) [Stream]() + +### func (*TTSService) [Stream](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L135) ```go func (s *TTSService) Stream(ctx context.Context, params *StreamParams) (*AudioStream, error) @@ -771,19 +771,19 @@ func (s *TTSService) Stream(ctx context.Context, params *StreamParams) (*AudioSt Stream generates speech from text and returns an audio stream. - -### func \(\*TTSService\) [StreamWebSocket]() + +### func (*TTSService) [StreamWebSocket](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L235) ```go func (s *TTSService) StreamWebSocket(ctx context.Context, textChan <-chan string, params *StreamParams, opts *WebSocketOptions) (*WebSocketAudioStream, error) ``` -StreamWebSocket streams text to speech over WebSocket for real\-time generation. +StreamWebSocket streams text to speech over WebSocket for real-time generation. The textChan receives text chunks to synthesize. Close the channel to end streaming. Returns a WebSocketAudioStream that can be iterated for audio chunks. - -## type [TrainMode]() + +## type [TrainMode](https://github.com/fishaudio/fish-audio-go/blob/main/shared.go#L37) TrainMode specifies the training mode for voice models. @@ -791,7 +791,7 @@ TrainMode specifies the training mode for voice models. type TrainMode string ``` - + ```go const ( @@ -799,8 +799,8 @@ const ( ) ``` - -## type [TranscribeParams]() + +## type [TranscribeParams](https://github.com/fishaudio/fish-audio-go/blob/main/asr.go#L34-L39) TranscribeParams contains parameters for ASR transcription. @@ -813,8 +813,8 @@ type TranscribeParams struct { } ``` - -## type [UpdateVoiceParams]() + +## type [UpdateVoiceParams](https://github.com/fishaudio/fish-audio-go/blob/main/voices.go#L102-L113) UpdateVoiceParams contains parameters for updating a voice. @@ -833,10 +833,10 @@ type UpdateVoiceParams struct { } ``` - -## type [ValidationError]() + +## type [ValidationError](https://github.com/fishaudio/fish-audio-go/blob/main/errors.go#L45-L47) -ValidationError is raised when request validation fails \(422\). +ValidationError is raised when request validation fails (422). ```go type ValidationError struct { @@ -844,8 +844,8 @@ type ValidationError struct { } ``` - -## type [Visibility]() + +## type [Visibility](https://github.com/fishaudio/fish-audio-go/blob/main/shared.go#L28) Visibility specifies the visibility of a voice model. @@ -853,7 +853,7 @@ Visibility specifies the visibility of a voice model. type Visibility string ``` - + ```go const ( @@ -863,8 +863,8 @@ const ( ) ``` - -## type [Voice]() + +## type [Voice](https://github.com/fishaudio/fish-audio-go/blob/main/voices.go#L33-L55) Voice represents a voice model. @@ -894,8 +894,8 @@ type Voice struct { } ``` - -## type [VoicesService]() + +## type [VoicesService](https://github.com/fishaudio/fish-audio-go/blob/main/voices.go#L116-L118) VoicesService provides voice management operations. @@ -905,8 +905,8 @@ type VoicesService struct { } ``` - -### func \(\*VoicesService\) [Create]() + +### func (*VoicesService) [Create](https://github.com/fishaudio/fish-audio-go/blob/main/voices.go#L192) ```go func (s *VoicesService) Create(ctx context.Context, params *CreateVoiceParams) (*Voice, error) @@ -914,8 +914,8 @@ func (s *VoicesService) Create(ctx context.Context, params *CreateVoiceParams) ( Create creates/clones a new voice. - -### func \(\*VoicesService\) [Delete]() + +### func (*VoicesService) [Delete](https://github.com/fishaudio/fish-audio-go/blob/main/voices.go#L389) ```go func (s *VoicesService) Delete(ctx context.Context, voiceID string) error @@ -923,8 +923,8 @@ func (s *VoicesService) Delete(ctx context.Context, voiceID string) error Delete deletes a voice. - -### func \(\*VoicesService\) [Get]() + +### func (*VoicesService) [Get](https://github.com/fishaudio/fish-audio-go/blob/main/voices.go#L183) ```go func (s *VoicesService) Get(ctx context.Context, voiceID string) (*Voice, error) @@ -932,8 +932,8 @@ func (s *VoicesService) Get(ctx context.Context, voiceID string) (*Voice, error) Get returns a voice by ID. - -### func \(\*VoicesService\) [List]() + +### func (*VoicesService) [List](https://github.com/fishaudio/fish-audio-go/blob/main/voices.go#L121) ```go func (s *VoicesService) List(ctx context.Context, params *ListVoicesParams) (*PaginatedResponse[Voice], error) @@ -941,8 +941,8 @@ func (s *VoicesService) List(ctx context.Context, params *ListVoicesParams) (*Pa List returns available voices/models. - -### func \(\*VoicesService\) [Update]() + +### func (*VoicesService) [Update](https://github.com/fishaudio/fish-audio-go/blob/main/voices.go#L316) ```go func (s *VoicesService) Update(ctx context.Context, voiceID string, params *UpdateVoiceParams) error @@ -950,8 +950,8 @@ func (s *VoicesService) Update(ctx context.Context, voiceID string, params *Upda Update updates voice metadata. - -## type [WebSocketAudioStream]() + +## type [WebSocketAudioStream](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L376-L383) WebSocketAudioStream wraps WebSocket audio chunks for iteration. @@ -961,8 +961,8 @@ type WebSocketAudioStream struct { } ``` - -### func \(\*WebSocketAudioStream\) [Bytes]() + +### func (*WebSocketAudioStream) [Bytes](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L410) ```go func (s *WebSocketAudioStream) Bytes() []byte @@ -970,8 +970,8 @@ func (s *WebSocketAudioStream) Bytes() []byte Bytes returns the current chunk of audio data. - -### func \(\*WebSocketAudioStream\) [Close]() + +### func (*WebSocketAudioStream) [Close](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L465) ```go func (s *WebSocketAudioStream) Close() error @@ -979,8 +979,8 @@ func (s *WebSocketAudioStream) Close() error Close closes the stream. - -### func \(\*WebSocketAudioStream\) [Collect]() + +### func (*WebSocketAudioStream) [Collect](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L424) ```go func (s *WebSocketAudioStream) Collect() ([]byte, error) @@ -988,8 +988,8 @@ func (s *WebSocketAudioStream) Collect() ([]byte, error) Collect reads all audio chunks and returns them as a single byte slice. - -### func \(\*WebSocketAudioStream\) [Err]() + +### func (*WebSocketAudioStream) [Err](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L417) ```go func (s *WebSocketAudioStream) Err() error @@ -997,8 +997,8 @@ func (s *WebSocketAudioStream) Err() error Err returns any error that occurred during iteration. - -### func \(\*WebSocketAudioStream\) [Next]() + +### func (*WebSocketAudioStream) [Next](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L387) ```go func (s *WebSocketAudioStream) Next() bool @@ -1006,8 +1006,8 @@ func (s *WebSocketAudioStream) Next() bool Next advances to the next chunk of audio data. Returns false when there are no more chunks or an error occurred. - -### func \(\*WebSocketAudioStream\) [Read]() + +### func (*WebSocketAudioStream) [Read](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L436) ```go func (s *WebSocketAudioStream) Read(p []byte) (n int, err error) @@ -1015,8 +1015,8 @@ func (s *WebSocketAudioStream) Read(p []byte) (n int, err error) Read implements io.Reader interface. - -## type [WebSocketError]() + +## type [WebSocketError](https://github.com/fishaudio/fish-audio-go/blob/main/errors.go#L55-L57) WebSocketError is raised when WebSocket connection or streaming fails. @@ -1026,8 +1026,8 @@ type WebSocketError struct { } ``` - -### func \(\*WebSocketError\) [Error]() + +### func (*WebSocketError) [Error](https://github.com/fishaudio/fish-audio-go/blob/main/errors.go#L59) ```go func (e *WebSocketError) Error() string @@ -1035,8 +1035,8 @@ func (e *WebSocketError) Error() string - -### func \(\*WebSocketError\) [IsFishAudioError]() + +### func (*WebSocketError) [IsFishAudioError](https://github.com/fishaudio/fish-audio-go/blob/main/errors.go#L63) ```go func (e *WebSocketError) IsFishAudioError() @@ -1044,8 +1044,8 @@ func (e *WebSocketError) IsFishAudioError() - -## type [WebSocketOptions]() + +## type [WebSocketOptions](https://github.com/fishaudio/fish-audio-go/blob/main/options.go#L45-L63) WebSocketOptions configures WebSocket connections. @@ -1071,8 +1071,8 @@ type WebSocketOptions struct { } ``` - -### func [DefaultWebSocketOptions]() + +### func [DefaultWebSocketOptions](https://github.com/fishaudio/fish-audio-go/blob/main/options.go#L66) ```go func DefaultWebSocketOptions() *WebSocketOptions @@ -1080,4 +1080,4 @@ func DefaultWebSocketOptions() *WebSocketOptions DefaultWebSocketOptions returns WebSocketOptions with default values. -Generated by [gomarkdoc]() +Generated by [gomarkdoc](https://github.com/princjef/gomarkdoc) From 10c8353fd853504e51dbcdedc3373612c289a357 Mon Sep 17 00:00:00 2001 From: James Ding Date: Wed, 24 Dec 2025 16:08:56 -0800 Subject: [PATCH 3/3] feat: update anchor tags in api-reference.mdx for consistency and add Go SDK section in docs.json --- api-reference/sdk/go/api-reference.mdx | 354 ++++++++++++------------- docs.json | 7 + 2 files changed, 184 insertions(+), 177 deletions(-) diff --git a/api-reference/sdk/go/api-reference.mdx b/api-reference/sdk/go/api-reference.mdx index 1f10a76..8992a2c 100644 --- a/api-reference/sdk/go/api-reference.mdx +++ b/api-reference/sdk/go/api-reference.mdx @@ -15,7 +15,7 @@ import "github.com/fishaudio/fish-audio-go" ## Constants - + ```go const ( @@ -30,8 +30,8 @@ const ( ) ``` - -## type [APIError](https://github.com/fishaudio/fish-audio-go/blob/main/errors.go#L12-L16) + +## type [APIError]() APIError is raised when the API returns an error response. @@ -43,8 +43,8 @@ type APIError struct { } ``` - -### func (*APIError) [Error](https://github.com/fishaudio/fish-audio-go/blob/main/errors.go#L18) + +### func \(\*APIError\) [Error]() ```go func (e *APIError) Error() string @@ -52,8 +52,8 @@ func (e *APIError) Error() string - -### func (*APIError) [IsFishAudioError](https://github.com/fishaudio/fish-audio-go/blob/main/errors.go#L22) + +### func \(\*APIError\) [IsFishAudioError]() ```go func (e *APIError) IsFishAudioError() @@ -61,10 +61,10 @@ func (e *APIError) IsFishAudioError() - -## type [ASRResponse](https://github.com/fishaudio/fish-audio-go/blob/main/asr.go#L24-L31) + +## type [ASRResponse]() -ASRResponse contains the result of speech-to-text transcription. +ASRResponse contains the result of speech\-to\-text transcription. ```go type ASRResponse struct { @@ -77,8 +77,8 @@ type ASRResponse struct { } ``` - -## type [ASRSegment](https://github.com/fishaudio/fish-audio-go/blob/main/asr.go#L14-L21) + +## type [ASRSegment]() ASRSegment represents a timestamped segment of transcribed text. @@ -93,10 +93,10 @@ type ASRSegment struct { } ``` - -## type [ASRService](https://github.com/fishaudio/fish-audio-go/blob/main/asr.go#L42-L44) + +## type [ASRService]() -ASRService provides speech-to-text operations. +ASRService provides speech\-to\-text operations. ```go type ASRService struct { @@ -104,8 +104,8 @@ type ASRService struct { } ``` - -### func (*ASRService) [Transcribe](https://github.com/fishaudio/fish-audio-go/blob/main/asr.go#L55) + +### func \(\*ASRService\) [Transcribe]() ```go func (s *ASRService) Transcribe(ctx context.Context, audio []byte, params *TranscribeParams) (*ASRResponse, error) @@ -123,8 +123,8 @@ result, err := client.ASR.Transcribe(ctx, audio, &fishaudio.TranscribeParams{ fmt.Println(result.Text) ``` - -## type [AccountService](https://github.com/fishaudio/fish-audio-go/blob/main/account.go#L38-L40) + +## type [AccountService]() AccountService provides account and billing operations. @@ -134,8 +134,8 @@ type AccountService struct { } ``` - -### func (*AccountService) [GetCredits](https://github.com/fishaudio/fish-audio-go/blob/main/account.go#L48) + +### func \(\*AccountService\) [GetCredits]() ```go func (s *AccountService) GetCredits(ctx context.Context, params *GetCreditsParams) (*Credits, error) @@ -150,8 +150,8 @@ credits, err := client.Account.GetCredits(ctx, nil) fmt.Printf("Available credits: %s\n", credits.Credit) ``` - -### func (*AccountService) [GetPackage](https://github.com/fishaudio/fish-audio-go/blob/main/account.go#L68) + +### func \(\*AccountService\) [GetPackage]() ```go func (s *AccountService) GetPackage(ctx context.Context) (*Package, error) @@ -166,8 +166,8 @@ pkg, err := client.Account.GetPackage(ctx) fmt.Printf("Balance: %d/%d\n", pkg.Balance, pkg.Total) ``` - -## type [AudioFormat](https://github.com/fishaudio/fish-audio-go/blob/main/shared.go#L4) + +## type [AudioFormat]() AudioFormat specifies the output audio format. @@ -175,7 +175,7 @@ AudioFormat specifies the output audio format. type AudioFormat string ``` - + ```go const ( @@ -186,15 +186,15 @@ const ( ) ``` - -## type [AudioStream](https://github.com/fishaudio/fish-audio-go/blob/main/audio_stream.go#L31-L37) + +## type [AudioStream]() AudioStream wraps an HTTP response for streaming audio data. It provides two ways to consume audio: -- Iterate chunk-by-chunk using Next() and Bytes() -- Collect all chunks at once using Collect() +- Iterate chunk\-by\-chunk using Next\(\) and Bytes\(\) +- Collect all chunks at once using Collect\(\) Example: @@ -221,17 +221,17 @@ type AudioStream struct { } ``` - -### func (*AudioStream) [Bytes](https://github.com/fishaudio/fish-audio-go/blob/main/audio_stream.go#L71) + +### func \(\*AudioStream\) [Bytes]() ```go func (s *AudioStream) Bytes() []byte ``` -Bytes returns the current chunk of audio data. Only valid after a successful call to Next(). +Bytes returns the current chunk of audio data. Only valid after a successful call to Next\(\). - -### func (*AudioStream) [Close](https://github.com/fishaudio/fish-audio-go/blob/main/audio_stream.go#L95) + +### func \(\*AudioStream\) [Close]() ```go func (s *AudioStream) Close() error @@ -239,8 +239,8 @@ func (s *AudioStream) Close() error Close closes the underlying response body. - -### func (*AudioStream) [Collect](https://github.com/fishaudio/fish-audio-go/blob/main/audio_stream.go#L82) + +### func \(\*AudioStream\) [Collect]() ```go func (s *AudioStream) Collect() ([]byte, error) @@ -248,8 +248,8 @@ func (s *AudioStream) Collect() ([]byte, error) Collect reads all remaining audio data and returns it as a single byte slice. This consumes the stream and closes it automatically. - -### func (*AudioStream) [Err](https://github.com/fishaudio/fish-audio-go/blob/main/audio_stream.go#L76) + +### func \(\*AudioStream\) [Err]() ```go func (s *AudioStream) Err() error @@ -257,8 +257,8 @@ func (s *AudioStream) Err() error Err returns any error that occurred during iteration. - -### func (*AudioStream) [Next](https://github.com/fishaudio/fish-audio-go/blob/main/audio_stream.go#L49) + +### func \(\*AudioStream\) [Next]() ```go func (s *AudioStream) Next() bool @@ -266,8 +266,8 @@ func (s *AudioStream) Next() bool Next advances to the next chunk of audio data. It returns false when there are no more chunks or an error occurred. - -### func (*AudioStream) [Read](https://github.com/fishaudio/fish-audio-go/blob/main/audio_stream.go#L107) + +### func \(\*AudioStream\) [Read]() ```go func (s *AudioStream) Read(p []byte) (n int, err error) @@ -275,10 +275,10 @@ func (s *AudioStream) Read(p []byte) (n int, err error) Read implements io.Reader interface. - -## type [AuthenticationError](https://github.com/fishaudio/fish-audio-go/blob/main/errors.go#L25-L27) + +## type [AuthenticationError]() -AuthenticationError is raised when authentication fails (401). +AuthenticationError is raised when authentication fails \(401\). ```go type AuthenticationError struct { @@ -286,8 +286,8 @@ type AuthenticationError struct { } ``` - -## type [Author](https://github.com/fishaudio/fish-audio-go/blob/main/voices.go#L26-L30) + +## type [Author]() Author represents voice model author information. @@ -299,8 +299,8 @@ type Author struct { } ``` - -## type [Client](https://github.com/fishaudio/fish-audio-go/blob/main/client.go#L26-L37) + +## type [Client]() Client is the Fish Audio API client. @@ -316,8 +316,8 @@ type Client struct { } ``` - -### func [NewClient](https://github.com/fishaudio/fish-audio-go/blob/main/client.go#L42) + +### func [NewClient]() ```go func NewClient(apiKey string, opts ...ClientOption) *Client @@ -325,10 +325,10 @@ func NewClient(apiKey string, opts ...ClientOption) *Client NewClient creates a new Fish Audio API client. -If apiKey is empty, it will try to read from the FISH_API_KEY environment variable. +If apiKey is empty, it will try to read from the FISH\_API\_KEY environment variable. - -### func (*Client) [Close](https://github.com/fishaudio/fish-audio-go/blob/main/client.go#L73) + +### func \(\*Client\) [Close]() ```go func (c *Client) Close() error @@ -336,8 +336,8 @@ func (c *Client) Close() error Close closes the HTTP client's idle connections. - -## type [ClientOption](https://github.com/fishaudio/fish-audio-go/blob/main/options.go#L9) + +## type [ClientOption]() ClientOption is a function that configures the Client. @@ -345,8 +345,8 @@ ClientOption is a function that configures the Client. type ClientOption func(*Client) ``` - -### func [WithBaseURL](https://github.com/fishaudio/fish-audio-go/blob/main/options.go#L12) + +### func [WithBaseURL]() ```go func WithBaseURL(url string) ClientOption @@ -354,8 +354,8 @@ func WithBaseURL(url string) ClientOption WithBaseURL sets a custom base URL for the API. - -### func [WithHTTPClient](https://github.com/fishaudio/fish-audio-go/blob/main/options.go#L19) + +### func [WithHTTPClient]() ```go func WithHTTPClient(httpClient *http.Client) ClientOption @@ -363,8 +363,8 @@ func WithHTTPClient(httpClient *http.Client) ClientOption WithHTTPClient sets a custom HTTP client. - -### func [WithTimeout](https://github.com/fishaudio/fish-audio-go/blob/main/options.go#L26) + +### func [WithTimeout]() ```go func WithTimeout(timeout time.Duration) ClientOption @@ -372,8 +372,8 @@ func WithTimeout(timeout time.Duration) ClientOption WithTimeout sets the default timeout for requests. - -## type [ConvertParams](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L60-L75) + +## type [ConvertParams]() ConvertParams contains parameters for TTS conversion. @@ -396,8 +396,8 @@ type ConvertParams struct { } ``` - -## type [CreateVoiceParams](https://github.com/fishaudio/fish-audio-go/blob/main/voices.go#L80-L99) + +## type [CreateVoiceParams]() CreateVoiceParams contains parameters for creating a voice. @@ -424,8 +424,8 @@ type CreateVoiceParams struct { } ``` - -## type [Credits](https://github.com/fishaudio/fish-audio-go/blob/main/account.go#L9-L17) + +## type [Credits]() Credits represents the user's API credit balance. @@ -441,8 +441,8 @@ type Credits struct { } ``` - -## type [FishAudioError](https://github.com/fishaudio/fish-audio-go/blob/main/errors.go#L6-L9) + +## type [FishAudioError]() FishAudioError is the base interface for all Fish Audio SDK errors. @@ -453,8 +453,8 @@ type FishAudioError interface { } ``` - -## type [GetCreditsParams](https://github.com/fishaudio/fish-audio-go/blob/main/account.go#L32-L35) + +## type [GetCreditsParams]() GetCreditsParams contains parameters for getting credits. @@ -465,8 +465,8 @@ type GetCreditsParams struct { } ``` - -## type [LatencyMode](https://github.com/fishaudio/fish-audio-go/blob/main/shared.go#L14) + +## type [LatencyMode]() LatencyMode specifies the generation latency mode. @@ -474,7 +474,7 @@ LatencyMode specifies the generation latency mode. type LatencyMode string ``` - + ```go const ( @@ -483,8 +483,8 @@ const ( ) ``` - -## type [ListVoicesParams](https://github.com/fishaudio/fish-audio-go/blob/main/voices.go#L58-L77) + +## type [ListVoicesParams]() ListVoicesParams contains parameters for listing voices. @@ -511,8 +511,8 @@ type ListVoicesParams struct { } ``` - -## type [Model](https://github.com/fishaudio/fish-audio-go/blob/main/shared.go#L54) + +## type [Model]() Model specifies the TTS model to use. @@ -520,7 +520,7 @@ Model specifies the TTS model to use. type Model string ``` - + ```go const ( @@ -530,8 +530,8 @@ const ( ) ``` - -## type [ModelState](https://github.com/fishaudio/fish-audio-go/blob/main/shared.go#L44) + +## type [ModelState]() ModelState specifies the state of a voice model. @@ -539,7 +539,7 @@ ModelState specifies the state of a voice model. type ModelState string ``` - + ```go const ( @@ -550,10 +550,10 @@ const ( ) ``` - -## type [NotFoundError](https://github.com/fishaudio/fish-audio-go/blob/main/errors.go#L35-L37) + +## type [NotFoundError]() -NotFoundError is raised when a resource is not found (404). +NotFoundError is raised when a resource is not found \(404\). ```go type NotFoundError struct { @@ -561,8 +561,8 @@ type NotFoundError struct { } ``` - -## type [Package](https://github.com/fishaudio/fish-audio-go/blob/main/account.go#L20-L29) + +## type [Package]() Package represents the user's prepaid package information. @@ -579,8 +579,8 @@ type Package struct { } ``` - -## type [PaginatedResponse](https://github.com/fishaudio/fish-audio-go/blob/main/shared.go#L22-L25) + +## type [PaginatedResponse]() PaginatedResponse wraps paginated API responses. @@ -591,10 +591,10 @@ type PaginatedResponse[T any] struct { } ``` - -## type [PermissionError](https://github.com/fishaudio/fish-audio-go/blob/main/errors.go#L30-L32) + +## type [PermissionError]() -PermissionError is raised when permission is denied (403). +PermissionError is raised when permission is denied \(403\). ```go type PermissionError struct { @@ -602,10 +602,10 @@ type PermissionError struct { } ``` - -## type [Prosody](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L24-L29) + +## type [Prosody]() -Prosody contains speech prosody settings (speed and volume). +Prosody contains speech prosody settings \(speed and volume\). ```go type Prosody struct { @@ -616,10 +616,10 @@ type Prosody struct { } ``` - -## type [RateLimitError](https://github.com/fishaudio/fish-audio-go/blob/main/errors.go#L40-L42) + +## type [RateLimitError]() -RateLimitError is raised when rate limit is exceeded (429). +RateLimitError is raised when rate limit is exceeded \(429\). ```go type RateLimitError struct { @@ -627,8 +627,8 @@ type RateLimitError struct { } ``` - -## type [ReferenceAudio](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L16-L21) + +## type [ReferenceAudio]() ReferenceAudio contains reference audio for voice cloning. @@ -641,10 +641,10 @@ type ReferenceAudio struct { } ``` - -## type [RequestOptions](https://github.com/fishaudio/fish-audio-go/blob/main/options.go#L33-L42) + +## type [RequestOptions]() -RequestOptions allows per-request overrides of client defaults. +RequestOptions allows per\-request overrides of client defaults. ```go type RequestOptions struct { @@ -659,8 +659,8 @@ type RequestOptions struct { } ``` - -## type [Sample](https://github.com/fishaudio/fish-audio-go/blob/main/voices.go#L18-L23) + +## type [Sample]() Sample represents a sample audio for a voice model. @@ -673,10 +673,10 @@ type Sample struct { } ``` - -## type [ServerError](https://github.com/fishaudio/fish-audio-go/blob/main/errors.go#L50-L52) + +## type [ServerError]() -ServerError is raised when the server encounters an error (5xx). +ServerError is raised when the server encounters an error \(5xx\). ```go type ServerError struct { @@ -684,8 +684,8 @@ type ServerError struct { } ``` - -## type [StreamParams](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L78-L93) + +## type [StreamParams]() StreamParams contains parameters for TTS streaming. @@ -708,10 +708,10 @@ type StreamParams struct { } ``` - -## type [TTSConfig](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L32-L57) + +## type [TTSConfig]() -TTSConfig is reusable configuration for text-to-speech requests. +TTSConfig is reusable configuration for text\-to\-speech requests. ```go type TTSConfig struct { @@ -742,10 +742,10 @@ type TTSConfig struct { } ``` - -## type [TTSService](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L113-L115) + +## type [TTSService]() -TTSService provides text-to-speech operations. +TTSService provides text\-to\-speech operations. ```go type TTSService struct { @@ -753,8 +753,8 @@ type TTSService struct { } ``` - -### func (*TTSService) [Convert](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L118) + +### func \(\*TTSService\) [Convert]() ```go func (s *TTSService) Convert(ctx context.Context, params *ConvertParams) ([]byte, error) @@ -762,8 +762,8 @@ func (s *TTSService) Convert(ctx context.Context, params *ConvertParams) ([]byte Convert generates speech from text and returns the complete audio. - -### func (*TTSService) [Stream](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L135) + +### func \(\*TTSService\) [Stream]() ```go func (s *TTSService) Stream(ctx context.Context, params *StreamParams) (*AudioStream, error) @@ -771,19 +771,19 @@ func (s *TTSService) Stream(ctx context.Context, params *StreamParams) (*AudioSt Stream generates speech from text and returns an audio stream. - -### func (*TTSService) [StreamWebSocket](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L235) + +### func \(\*TTSService\) [StreamWebSocket]() ```go func (s *TTSService) StreamWebSocket(ctx context.Context, textChan <-chan string, params *StreamParams, opts *WebSocketOptions) (*WebSocketAudioStream, error) ``` -StreamWebSocket streams text to speech over WebSocket for real-time generation. +StreamWebSocket streams text to speech over WebSocket for real\-time generation. The textChan receives text chunks to synthesize. Close the channel to end streaming. Returns a WebSocketAudioStream that can be iterated for audio chunks. - -## type [TrainMode](https://github.com/fishaudio/fish-audio-go/blob/main/shared.go#L37) + +## type [TrainMode]() TrainMode specifies the training mode for voice models. @@ -791,7 +791,7 @@ TrainMode specifies the training mode for voice models. type TrainMode string ``` - + ```go const ( @@ -799,8 +799,8 @@ const ( ) ``` - -## type [TranscribeParams](https://github.com/fishaudio/fish-audio-go/blob/main/asr.go#L34-L39) + +## type [TranscribeParams]() TranscribeParams contains parameters for ASR transcription. @@ -813,8 +813,8 @@ type TranscribeParams struct { } ``` - -## type [UpdateVoiceParams](https://github.com/fishaudio/fish-audio-go/blob/main/voices.go#L102-L113) + +## type [UpdateVoiceParams]() UpdateVoiceParams contains parameters for updating a voice. @@ -833,10 +833,10 @@ type UpdateVoiceParams struct { } ``` - -## type [ValidationError](https://github.com/fishaudio/fish-audio-go/blob/main/errors.go#L45-L47) + +## type [ValidationError]() -ValidationError is raised when request validation fails (422). +ValidationError is raised when request validation fails \(422\). ```go type ValidationError struct { @@ -844,8 +844,8 @@ type ValidationError struct { } ``` - -## type [Visibility](https://github.com/fishaudio/fish-audio-go/blob/main/shared.go#L28) + +## type [Visibility]() Visibility specifies the visibility of a voice model. @@ -853,7 +853,7 @@ Visibility specifies the visibility of a voice model. type Visibility string ``` - + ```go const ( @@ -863,8 +863,8 @@ const ( ) ``` - -## type [Voice](https://github.com/fishaudio/fish-audio-go/blob/main/voices.go#L33-L55) + +## type [Voice]() Voice represents a voice model. @@ -894,8 +894,8 @@ type Voice struct { } ``` - -## type [VoicesService](https://github.com/fishaudio/fish-audio-go/blob/main/voices.go#L116-L118) + +## type [VoicesService]() VoicesService provides voice management operations. @@ -905,8 +905,8 @@ type VoicesService struct { } ``` - -### func (*VoicesService) [Create](https://github.com/fishaudio/fish-audio-go/blob/main/voices.go#L192) + +### func \(\*VoicesService\) [Create]() ```go func (s *VoicesService) Create(ctx context.Context, params *CreateVoiceParams) (*Voice, error) @@ -914,8 +914,8 @@ func (s *VoicesService) Create(ctx context.Context, params *CreateVoiceParams) ( Create creates/clones a new voice. - -### func (*VoicesService) [Delete](https://github.com/fishaudio/fish-audio-go/blob/main/voices.go#L389) + +### func \(\*VoicesService\) [Delete]() ```go func (s *VoicesService) Delete(ctx context.Context, voiceID string) error @@ -923,8 +923,8 @@ func (s *VoicesService) Delete(ctx context.Context, voiceID string) error Delete deletes a voice. - -### func (*VoicesService) [Get](https://github.com/fishaudio/fish-audio-go/blob/main/voices.go#L183) + +### func \(\*VoicesService\) [Get]() ```go func (s *VoicesService) Get(ctx context.Context, voiceID string) (*Voice, error) @@ -932,8 +932,8 @@ func (s *VoicesService) Get(ctx context.Context, voiceID string) (*Voice, error) Get returns a voice by ID. - -### func (*VoicesService) [List](https://github.com/fishaudio/fish-audio-go/blob/main/voices.go#L121) + +### func \(\*VoicesService\) [List]() ```go func (s *VoicesService) List(ctx context.Context, params *ListVoicesParams) (*PaginatedResponse[Voice], error) @@ -941,8 +941,8 @@ func (s *VoicesService) List(ctx context.Context, params *ListVoicesParams) (*Pa List returns available voices/models. - -### func (*VoicesService) [Update](https://github.com/fishaudio/fish-audio-go/blob/main/voices.go#L316) + +### func \(\*VoicesService\) [Update]() ```go func (s *VoicesService) Update(ctx context.Context, voiceID string, params *UpdateVoiceParams) error @@ -950,8 +950,8 @@ func (s *VoicesService) Update(ctx context.Context, voiceID string, params *Upda Update updates voice metadata. - -## type [WebSocketAudioStream](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L376-L383) + +## type [WebSocketAudioStream]() WebSocketAudioStream wraps WebSocket audio chunks for iteration. @@ -961,8 +961,8 @@ type WebSocketAudioStream struct { } ``` - -### func (*WebSocketAudioStream) [Bytes](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L410) + +### func \(\*WebSocketAudioStream\) [Bytes]() ```go func (s *WebSocketAudioStream) Bytes() []byte @@ -970,8 +970,8 @@ func (s *WebSocketAudioStream) Bytes() []byte Bytes returns the current chunk of audio data. - -### func (*WebSocketAudioStream) [Close](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L465) + +### func \(\*WebSocketAudioStream\) [Close]() ```go func (s *WebSocketAudioStream) Close() error @@ -979,8 +979,8 @@ func (s *WebSocketAudioStream) Close() error Close closes the stream. - -### func (*WebSocketAudioStream) [Collect](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L424) + +### func \(\*WebSocketAudioStream\) [Collect]() ```go func (s *WebSocketAudioStream) Collect() ([]byte, error) @@ -988,8 +988,8 @@ func (s *WebSocketAudioStream) Collect() ([]byte, error) Collect reads all audio chunks and returns them as a single byte slice. - -### func (*WebSocketAudioStream) [Err](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L417) + +### func \(\*WebSocketAudioStream\) [Err]() ```go func (s *WebSocketAudioStream) Err() error @@ -997,8 +997,8 @@ func (s *WebSocketAudioStream) Err() error Err returns any error that occurred during iteration. - -### func (*WebSocketAudioStream) [Next](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L387) + +### func \(\*WebSocketAudioStream\) [Next]() ```go func (s *WebSocketAudioStream) Next() bool @@ -1006,8 +1006,8 @@ func (s *WebSocketAudioStream) Next() bool Next advances to the next chunk of audio data. Returns false when there are no more chunks or an error occurred. - -### func (*WebSocketAudioStream) [Read](https://github.com/fishaudio/fish-audio-go/blob/main/tts.go#L436) + +### func \(\*WebSocketAudioStream\) [Read]() ```go func (s *WebSocketAudioStream) Read(p []byte) (n int, err error) @@ -1015,8 +1015,8 @@ func (s *WebSocketAudioStream) Read(p []byte) (n int, err error) Read implements io.Reader interface. - -## type [WebSocketError](https://github.com/fishaudio/fish-audio-go/blob/main/errors.go#L55-L57) + +## type [WebSocketError]() WebSocketError is raised when WebSocket connection or streaming fails. @@ -1026,8 +1026,8 @@ type WebSocketError struct { } ``` - -### func (*WebSocketError) [Error](https://github.com/fishaudio/fish-audio-go/blob/main/errors.go#L59) + +### func \(\*WebSocketError\) [Error]() ```go func (e *WebSocketError) Error() string @@ -1035,8 +1035,8 @@ func (e *WebSocketError) Error() string - -### func (*WebSocketError) [IsFishAudioError](https://github.com/fishaudio/fish-audio-go/blob/main/errors.go#L63) + +### func \(\*WebSocketError\) [IsFishAudioError]() ```go func (e *WebSocketError) IsFishAudioError() @@ -1044,8 +1044,8 @@ func (e *WebSocketError) IsFishAudioError() - -## type [WebSocketOptions](https://github.com/fishaudio/fish-audio-go/blob/main/options.go#L45-L63) + +## type [WebSocketOptions]() WebSocketOptions configures WebSocket connections. @@ -1071,8 +1071,8 @@ type WebSocketOptions struct { } ``` - -### func [DefaultWebSocketOptions](https://github.com/fishaudio/fish-audio-go/blob/main/options.go#L66) + +### func [DefaultWebSocketOptions]() ```go func DefaultWebSocketOptions() *WebSocketOptions @@ -1080,4 +1080,4 @@ func DefaultWebSocketOptions() *WebSocketOptions DefaultWebSocketOptions returns WebSocketOptions with default values. -Generated by [gomarkdoc](https://github.com/princjef/gomarkdoc) +Generated by [gomarkdoc]() diff --git a/docs.json b/docs.json index 5709015..55edf78 100644 --- a/docs.json +++ b/docs.json @@ -200,6 +200,13 @@ "pages": [ "api-reference/sdk/javascript/api-reference" ] + }, + { + "group": "Go SDK", + "icon": "golang", + "pages": [ + "api-reference/sdk/go/api-reference" + ] } ] }