Gemini and Vertex registration.
Integration from other modules
Integration here means other Go packages in this repository. Go internal import rules restrict imports from outside the repository; HTTP clients use mounted gateway endpoints.
Blank-import this package at startup to register its fixed actions, then match them through registry. Administrators must still configure deployments with explicit transport/endpoint_types, base URLs, and credentials. The native data plane sends requests.
| Entry point or resource | Usage and result |
|---|---|
| 空白导入 google | Trigger init; there is no runtime constructor |
| registry.Match(method, path) | Obtain transport, action, and path captures |
Integration demo
Save the code as demo/main.go inside the repository and run go run ./demo from the repository root. Remove the demo directory after use.
package main
import (
"fmt"
_ "github.com/sunqirui1987/xhub/internal/provider/google"
"github.com/sunqirui1987/xhub/internal/provider/registry"
)
// main 演示本页 API 的最小调用;无参数和返回值,打印上述预期结果,依赖与副作用见本页说明。
func main() {
hit, ok := registry.Match("POST", "/v1beta/models/demo-model:generateContent")
if !ok {
panic("registered action not found")
}
fmt.Println(hit.Transport.ID, hit.Action.Name)
}Prints gemini_generate_content create. This only verifies protocol registration; it does not require an account or submit a task.
Errors, state, and side effects
Gemini uses x-goog-api-key; Vertex uses Bearer. Deployments must supply project/region base URLs and tokens; OAuth is not acquired automatically. Importing does not connect, provision credentials, or verify supplier availability. The data plane must deduplicate task settlement.
Source and verification
Code entry points: native.go
Unit tests live beside source: native_test.go
go test ./internal/provider/google/...
Backend regressions live in cmd/regression; browser flows in frontend/e2e. Offline tests use local HTTP upstreams and do not establish production credential or vendor availability.