OzoneTool.fromSession constructor

OzoneTool.fromSession(
  1. Session session, {
  2. String? ozoneDid,
  3. Map<String, String>? headers,
  4. Protocol? protocol,
  5. String? service,
  6. String? relayService,
  7. Duration? timeout,
  8. RetryStrategy? retryConfig,
  9. GetClient? getClient,
  10. PostClient? postClient,
})

Returns the new instance of OzoneTool.

This builds a fresh atp.ATProto, and therefore a fresh core.ServiceContext carrying its own copy of session. When the same account also needs another client, build the atp.ATProto once and pass it to OzoneTool.fromAtproto instead — two contexts each holding a copy of one session race to spend a single-use refresh token.

The labeler proxy header built from ozoneDid is added to the context this OzoneTool sends through, not to the one atproto exposes: com.atproto.* calls made through atproto are not proxied to the ozone service.

Implementation

factory OzoneTool.fromSession(
  final core.Session session, {
  final String? ozoneDid,
  final Map<String, String>? headers,
  final core.Protocol? protocol,
  final String? service,
  final String? relayService,
  final Duration? timeout,
  final core.RetryStrategy? retryConfig,
  final core.GetClient? getClient,
  final core.PostClient? postClient,
}) => _OzoneTool.fromAtproto(
  atp.ATProto.fromSession(
    session,
    headers: headers,
    protocol: protocol,
    service: service,
    relayService: relayService,
    timeout: timeout,
    retryConfig: retryConfig,
    getClient: getClient,
    postClient: postClient,
  ),
  ozoneDid: ozoneDid,
);