MarshalJSON serializes the provider config, deriving the wire-only `hasBearerTokenProvider` flag from the presence of [ProviderConfig.BearerTokenProvider]. The non-serializable callback never crosses the RPC boundary; the runtime only learns that a token provider exists and forwards the provider nam
()
| 1763 | // learns that a token provider exists and forwards the provider name back when it |
| 1764 | // needs a token. |
| 1765 | func (p ProviderConfig) MarshalJSON() ([]byte, error) { |
| 1766 | type wire ProviderConfig |
| 1767 | aux := struct { |
| 1768 | wire |
| 1769 | HasBearerTokenProvider *bool `json:"hasBearerTokenProvider,omitempty"` |
| 1770 | }{wire: wire(p)} |
| 1771 | if p.BearerTokenProvider != nil { |
| 1772 | aux.HasBearerTokenProvider = Bool(true) |
| 1773 | } |
| 1774 | return json.Marshal(aux) |
| 1775 | } |
| 1776 | |
| 1777 | // CapiSessionOptions configures provider-scoped Copilot API (CAPI) session behavior. |
| 1778 | // |