Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# FirebaseAuth
FirebaseAuth/Tests/SampleSwift/AuthenticationExample/SwiftApplication.plist
FirebaseAuth/Tests/SampleSwift/ObjCApiTests/AuthCredentials.h
FirebaseAuth/Tests/SampleSwift/GoogleService-Info_multi.plist
FirebaseAuth/Tests/SampleSwift/GoogleService-Info.plist
FirebaseAuth/Tests/SampleSwift/Sample.entitlements
FirebaseAuth/Tests/SampleSwift/SwiftApiTests/Credentials.swift

# FirebaseAI
FirebaseAI/Tests/TestApp/Resources/GoogleService-Info.plist
FirebaseAI/Tests/TestApp/Resources/GoogleService-Info-Spark.plist
FirebaseAI/Tests/TestApp/Tests/Integration/Credentials.swift

# FirebaseDatabase
FirebaseDatabase/Tests/Resources/GoogleService-Info.plist

FirebaseRemoteConfig/Tests/Sample/GoogleService-Info.plist
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Namespace for GenerateContent API Types
enum GenerateContentAPI {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

extension GenerateContentAPI.AudioResponseFormat {
/// Optional. The delivery mode for the audio output.
///
/// ### Gemini Developer API
///
/// Optional. The delivery mode for the audio output.
///
/// ### Gemini Enterprise Agent Platform
///
/// Optional. Delivery mode for the generated content.
enum Delivery: Codable, Sendable, Equatable, Hashable {
/// Audio data is returned inline in the response.
case inline

/// Audio data is returned as a URI.
case uri

/// Unrecognized case.
///
/// - Parameter value: The raw string value of the unrecognized enum case.
case unrecognized(_ value: String)
}
}

// MARK: - RawRepresentable Conformance

extension GenerateContentAPI.AudioResponseFormat.Delivery: RawRepresentable {
var rawValue: String {
switch self {
case .inline: "INLINE"
case .uri: "URI"
case let .unrecognized(value): value
}
}

init(rawValue: String) {
switch rawValue {
case "INLINE": self = .inline
case "URI": self = .uri
default: self = .unrecognized(rawValue)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

extension GenerateContentAPI.AudioResponseFormat {
/// Optional. The MIME type of the audio output.
enum MimeType: Codable, Sendable, Equatable, Hashable {
/// MP3 audio format.
case mp3

/// OGG Opus audio format.
case oggOpus

/// Raw PCM (L16) audio format.
case l16

/// WAV audio format.
case wav

/// A-law audio format.
case alaw

/// Mu-law audio format.
case mulaw

/// Unrecognized case.
///
/// - Parameter value: The raw string value of the unrecognized enum case.
case unrecognized(_ value: String)
}
}

// MARK: - RawRepresentable Conformance

extension GenerateContentAPI.AudioResponseFormat.MimeType: RawRepresentable {
var rawValue: String {
switch self {
case .mp3: "AUDIO_MP3"
case .oggOpus: "AUDIO_OGG_OPUS"
case .l16: "AUDIO_L16"
case .wav: "AUDIO_WAV"
case .alaw: "AUDIO_ALAW"
case .mulaw: "AUDIO_MULAW"
case let .unrecognized(value): value
}
}

init(rawValue: String) {
switch rawValue {
case "AUDIO_MP3": self = .mp3
case "AUDIO_OGG_OPUS": self = .oggOpus
case "AUDIO_L16": self = .l16
case "AUDIO_WAV": self = .wav
case "AUDIO_ALAW": self = .alaw
case "AUDIO_MULAW": self = .mulaw
default: self = .unrecognized(rawValue)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

extension GenerateContentAPI {
/// An internal data model for `AudioResponseFormat`.
///
/// ### Gemini Developer API
///
/// Type: `GoogleAiGenerativelanguageV1betaAudioResponseFormat`
///
/// Configuration for audio output format.
///
/// ### Gemini Enterprise Agent Platform
///
/// Type: `GoogleCloudAiplatformV1beta1AudioResponseFormat`
///
/// Configuration for audio-specific output formatting.
struct AudioResponseFormat: Codable, Sendable, Equatable, Hashable {
/// Optional. The MIME type of the audio output.
let mimeType: MimeType?

/// Optional. The delivery mode for the audio output.
///
/// ### Gemini Developer API
///
/// Optional. The delivery mode for the audio output.
///
/// ### Gemini Enterprise Agent Platform
///
/// Optional. Delivery mode for the generated content.
let delivery: Delivery?

/// Optional. Sample rate in Hz.
///
/// ### Gemini Developer API
///
/// Optional. Sample rate in Hz.
///
/// ### Gemini Enterprise Agent Platform
///
/// Optional. Sample rate for the generated audio in Hertz.
let sampleRate: Int?

/// Optional. Bit rate in bits per second (bps). Only applicable for compressed formats
/// (MP3, Opus).
let bitRate: Int?

/// Creates a new `AudioResponseFormat`.
///
/// - Parameters:
/// - mimeType: Optional. The MIME type of the audio output.
/// - delivery: Optional. The delivery mode for the audio output. (behavior varies by
/// backend). For more details, see ``delivery``.
/// - sampleRate: Optional. Sample rate in Hz. (behavior varies by backend). For more details,
/// see ``sampleRate``.
/// - bitRate: Optional. Bit rate in bits per second (bps). Only applicable for compressed
/// formats
init(mimeType: MimeType? = nil,
delivery: Delivery? = nil,
sampleRate: Int? = nil,
bitRate: Int? = nil) {
self.mimeType = mimeType
self.delivery = delivery
self.sampleRate = sampleRate
self.bitRate = bitRate
}

enum CodingKeys: String, CodingKey {
case mimeType
case delivery
case sampleRate
case bitRate
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import Foundation

extension GenerateContentAPI {
/// An internal data model for `Blob`.
///
/// ### Gemini Developer API
///
/// Type: `Blob`
///
/// An element in the history the represents raw binary data.
///
/// ### Gemini Enterprise Agent Platform
///
/// Type: `GoogleCloudAiplatformV1beta1Blob`
///
/// A content blob.
///
/// A Blob contains data of a specific
/// media type. It is used to represent images, audio, and video.
struct Blob: Codable, Sendable, Equatable, Hashable {
/// Required. The IANA standard MIME type of the source data.
///
/// ### Gemini Developer API
///
/// Required. The IANA standard MIME type of the source data.
/// Examples:
/// - image/png
/// - image/jpeg
///
/// ### Gemini Enterprise Agent Platform
///
/// Required. The IANA standard MIME type of the source data.
let mimeType: String?

/// Required. Raw bytes for media formats.
///
/// ### Gemini Developer API
///
/// Required. Raw bytes for media formats.
///
/// ### Gemini Enterprise Agent Platform
///
/// Required. The raw bytes of the data.
let data: Data?

/// Optional. The display name of the blob. Used to provide a label or filename
///
/// ### Gemini Developer API
///
/// > Important: This property is not supported in the Gemini Developer API.
///
/// ### Gemini Enterprise Agent Platform
///
/// Optional. The display name of the blob. Used to provide a label or filename
/// to distinguish blobs.
///
/// This field is only returned in `PromptMessage` for prompt management. It is
/// used in the Gemini calls only when server-side tools (`code_execution`,
/// `google_search`, and `url_context`) are enabled.
let displayName: String?

/// Creates a new `Blob`.
///
/// - Parameters:
/// - mimeType: Required. The IANA standard MIME type of the source data. (behavior varies by
/// backend). For more details, see ``mimeType``.
/// - data: Required. Raw bytes for media formats. (behavior varies by backend). For more
/// details, see ``data``.
/// - displayName: Optional. The display name of the blob. Used to provide a label or filename
/// (Gemini Enterprise Agent Platform only). For more details, see ``displayName``.
init(mimeType: String?,
data: Data?,
displayName: String? = nil) {
self.mimeType = mimeType
self.data = data
self.displayName = displayName
}

enum CodingKeys: String, CodingKey {
case mimeType
case data
case displayName
}
}
}
Loading
Loading