How apple/apple-ads-platform-api-swift works
AppleAdsClient is a Swift client library for the Apple Ads Platform API. An application configures a client, then calls generated API operations; the client assembles middleware that attaches authentication and request metadata before sending requests to Apple. In managed key-based authentication, it signs a client-secret JWT, exchanges it for an access token, and caches/refreshes that token; custom secret and token providers are supported alternatives. The README also documents configuration-from-environment and long-running service use. The graph reflects the sampled connection and middleware code; generated endpoint internals and some documented capabilities were not sampled.
Main entry points: AppleAdsClient.swift AppleAdsClient · AccessTokenFetcher.swift Access token fetcher · Client.swift Generated operations · CachingTokenProvider.swift Caching token provider
Components 19
Client and API
- AppleAdsClient
Sources/AppleAdsClient/AppleAdsClient.swift - Generated operations
Sources/AppleAdsClient/Generated/Client.swift - API models
Sources/AppleAdsClient/Generated/Types.swift - Ad account context
Sources/AppleAdsClient/XApContext.swift - Date transcoder
Sources/AppleAdsClient/AppleAdsDateTranscoder.swift
Authentication
- Token provider
Sources/AppleAdsClient/Auth/TokenProvider.swift - Caching token provider
Sources/AppleAdsClient/Auth/CachingTokenProvider.swift - Access token fetcher
Sources/AppleAdsClient/AccessTokenFetcher.swift - JWT signer
Sources/AppleAdsClient/Auth/JWTSigner.swift - Client secret provider
Sources/AppleAdsClient/Auth/ClientSecretProvider.swift
Request middleware
- Auth middleware
Sources/AppleAdsClient/AuthMiddleware.swift - User-Agent middleware
Sources/AppleAdsClient/UserAgentMiddleware.swift - Header fixup
Sources/AppleAdsClient/HeaderFixupMiddleware.swift
Configuration and lifecycle
- Client configuration
Sources/AppleAdsClient/AppleAdsClientConfiguration.swift - Config reader
Sources/AppleAdsClient/AppleAdsClientConfiguration+ConfigReader.swift - Service lifecycle
Sources/AppleAdsClient/AppleAdsClient.swift
Other components
- Application
- Apple Ads API
- OAuth endpoint
Connections 20
- Application → Client configuration: sets options
- Application → AppleAdsClient: creates and calls
- Config reader → Client configuration: reads values
- AppleAdsClient → Generated operations: constructs client
- AppleAdsClient → Caching token provider: creates managed cache
- AppleAdsClient → Access token fetcher: creates fetcher
- AppleAdsClient → JWT signer: creates signer
- AppleAdsClient → Auth middleware: installs middleware
- AppleAdsClient → User-Agent middleware: installs middleware
- AppleAdsClient → Header fixup: installs middleware
- AppleAdsClient → Date transcoder: configures transcoder
- AppleAdsClient → Service lifecycle: supports service use
- Generated operations → Apple Ads API: sends API requests
- Generated operations → API models: uses API types
- Auth middleware → Token provider: requests bearer token
- Caching token provider → Access token fetcher: fetches and refreshes
- Access token fetcher → JWT signer: signs client secret
- Access token fetcher → Client secret provider: requests client secret
- Access token fetcher → OAuth endpoint: exchanges credentials
- Application → Ad account context: builds account header