@@ -405,35 +405,102 @@ def from_dict(cls, obj: Dict[str, Any]) -> "AuthToken":
405405class ConsumptionOptions :
406406 """Options for consuming a destination via the v2 runtime API.
407407
408- This class encapsulates optional parameters for destination consumption .
408+ Each field maps directly to an HTTP request header sent to the Destination Service .
409409
410410 Fields:
411- fragment_name: Optional fragment name for property merging via X-fragment-name header
412- tenant: Optional subscriber tenant subdomain for user token exchange
411+ fragment_name: Name of the destination fragment used to override/extend destination
412+ properties (X-fragment-name). In case of overlapping properties, fragment values
413+ take priority.
414+ fragment_optional: When True, if the fragment specified by fragment_name does not
415+ exist the destination is returned without it. When False (default), a missing
416+ fragment causes an error (X-fragment-optional).
417+ tenant: Subdomain of the tenant on behalf of which to fetch an access token
418+ (X-tenant). Required when tokenServiceURLType is Common. Takes precedence over
419+ user_token for tenant determination.
420+ user_token: Encoded user JWT token (RFC 7519) for authentication types that require
421+ user information: OAuth2UserTokenExchange, OAuth2JWTBearer,
422+ OAuth2SAMLBearerAssertion (X-user-token). Takes priority over the Authorization
423+ header for token exchange.
424+ subject_token: Subject token for OAuth2TokenExchange destinations (X-subject-token).
425+ Used as the subject_token parameter in the token exchange request (RFC 8693).
426+ Must be used together with subject_token_type.
427+ subject_token_type: Format of the subject token as defined by the authorization
428+ server (X-subject-token-type), e.g.
429+ "urn:ietf:params:oauth:token-type:access_token". Required with subject_token.
430+ actor_token: Actor token for OAuth2TokenExchange destinations (X-actor-token).
431+ Used as the actor_token parameter in the token exchange request (RFC 8693).
432+ Should be used together with actor_token_type.
433+ actor_token_type: Format of the actor token as defined by the authorization server
434+ (X-actor-token-type), e.g. "urn:ietf:params:oauth:token-type:access_token".
435+ saml_assertion: Client-provided SAML assertion for destinations with authentication
436+ type OAuth2SAMLBearerAssertion and SAMLAssertionProvider=ClientProvided
437+ (X-samlAssertion). If applicable but not provided, token retrieval will fail.
438+ refresh_token: Refresh token for OAuth2RefreshToken destinations (X-refresh-token).
439+ Mandatory for that authentication type. The service uses it to fetch new access
440+ and refresh tokens from the configured tokenServiceURL.
441+ code: Authorization code for OAuth2AuthorizationCode destinations (X-code).
442+ Mandatory for that authentication type. Exchanged for an access token at the
443+ configured tokenServiceURL.
444+ redirect_uri: URL-encoded redirect URI for OAuth2AuthorizationCode destinations
445+ (X-redirect-uri). Required when the same redirect URI was registered during the
446+ authorization code grant; must match the registered value.
447+ code_verifier: PKCE code verifier for OAuth2AuthorizationCode destinations
448+ (X-code-verifier). Required when a code challenge was provided during the
449+ authorization code grant.
450+ chain_name: Name of a predefined destination chain, enabling multiple Destination
451+ Service interactions in a single request (X-chain-name).
452+ chain_vars: Key-value pairs for destination chain variables (X-chain-var-<name>).
453+ Each entry is sent as a separate "X-chain-var-<key>" header. Only applicable
454+ when chain_name is provided.
413455
414456 Example:
415457 ```python
416458 from sap_cloud_sdk.destination import create_client, ConsumptionOptions
417459
418460 client = create_client()
419461
420- # Simple consumption
421- dest = client.get_destination("my-api")
462+ # Fragment merging
463+ dest = client.get_destination("my-api", options=ConsumptionOptions(fragment_name="prod") )
422464
423- # With options
424- options = ConsumptionOptions(fragment_name="production ", tenant="tenant-1")
425- dest = client.get_destination("my-api", options=options )
465+ # User token exchange
466+ opts = ConsumptionOptions(user_token="<jwt> ", tenant="tenant-1")
467+ dest = client.get_destination("my-api", options=opts )
426468
427- # Or inline
428- dest = client.get_destination (
429- "my-api ",
430- options=ConsumptionOptions(fragment_name="prod")
469+ # OAuth2TokenExchange
470+ opts = ConsumptionOptions (
471+ subject_token="<token> ",
472+ subject_token_type="urn:ietf:params:oauth:token-type:access_token",
431473 )
474+ dest = client.get_destination("my-api", options=opts)
475+
476+ # OAuth2AuthorizationCode
477+ opts = ConsumptionOptions(code="<auth-code>", redirect_uri="https://app/callback")
478+ dest = client.get_destination("my-api", options=opts)
479+
480+ # Destination chain
481+ opts = ConsumptionOptions(
482+ chain_name="my-chain",
483+ chain_vars={"subject_token": "<token>", "subject_token_type": "access_token"},
484+ )
485+ dest = client.get_destination("my-api", options=opts)
432486 ```
433487 """
434488
435489 fragment_name : Optional [str ] = None
490+ fragment_optional : Optional [bool ] = None
436491 tenant : Optional [str ] = None
492+ user_token : Optional [str ] = None
493+ subject_token : Optional [str ] = None
494+ subject_token_type : Optional [str ] = None
495+ actor_token : Optional [str ] = None
496+ actor_token_type : Optional [str ] = None
497+ saml_assertion : Optional [str ] = None
498+ refresh_token : Optional [str ] = None
499+ code : Optional [str ] = None
500+ redirect_uri : Optional [str ] = None
501+ code_verifier : Optional [str ] = None
502+ chain_name : Optional [str ] = None
503+ chain_vars : Optional [dict ] = None
437504
438505
439506@dataclass
0 commit comments