addToBuilderAsBlocking static method

void addToBuilderAsBlocking(
  1. ObjCProtocolBuilder builder, {
  2. void connection_didFailWithError_(
    1. NSURLConnection,
    2. NSError
    )?,
  3. bool connectionShouldUseCredentialStorage_(
    1. NSURLConnection
    )?,
  4. void connection_willSendRequestForAuthenticationChallenge_(
    1. NSURLConnection,
    2. NSURLAuthenticationChallenge
    )?,
  5. bool connection_canAuthenticateAgainstProtectionSpace_(
    1. NSURLConnection,
    2. NSURLProtectionSpace
    )?,
  6. void connection_didReceiveAuthenticationChallenge_(
    1. NSURLConnection,
    2. NSURLAuthenticationChallenge
    )?,
  7. void connection_didCancelAuthenticationChallenge_(
    1. NSURLConnection,
    2. NSURLAuthenticationChallenge
    )?,
  8. bool $keepIsolateAlive = true,
})

Adds the implementation of the NSURLConnectionDelegate protocol to an existing objc.ObjCProtocolBuilder. All methods that can be implemented as blocking listeners will be.

Note: You cannot call this method after you have called builder.build.

Implementation

static void addToBuilderAsBlocking(
  objc.ObjCProtocolBuilder builder, {
  void Function(NSURLConnection, objc.NSError)? connection_didFailWithError_,
  bool Function(NSURLConnection)? connectionShouldUseCredentialStorage_,
  void Function(NSURLConnection, NSURLAuthenticationChallenge)?
  connection_willSendRequestForAuthenticationChallenge_,
  bool Function(NSURLConnection, NSURLProtectionSpace)?
  connection_canAuthenticateAgainstProtectionSpace_,
  void Function(NSURLConnection, NSURLAuthenticationChallenge)?
  connection_didReceiveAuthenticationChallenge_,
  void Function(NSURLConnection, NSURLAuthenticationChallenge)?
  connection_didCancelAuthenticationChallenge_,
  bool $keepIsolateAlive = true,
}) {
  NSURLConnectionDelegate.connection_didFailWithError_.implementAsBlocking(
    builder,
    connection_didFailWithError_,
  );
  NSURLConnectionDelegate.connectionShouldUseCredentialStorage_.implement(
    builder,
    connectionShouldUseCredentialStorage_,
  );
  NSURLConnectionDelegate
      .connection_willSendRequestForAuthenticationChallenge_
      .implementAsBlocking(
        builder,
        connection_willSendRequestForAuthenticationChallenge_,
      );
  NSURLConnectionDelegate.connection_canAuthenticateAgainstProtectionSpace_
      .implement(builder, connection_canAuthenticateAgainstProtectionSpace_);
  NSURLConnectionDelegate.connection_didReceiveAuthenticationChallenge_
      .implementAsBlocking(
        builder,
        connection_didReceiveAuthenticationChallenge_,
      );
  NSURLConnectionDelegate.connection_didCancelAuthenticationChallenge_
      .implementAsBlocking(
        builder,
        connection_didCancelAuthenticationChallenge_,
      );
  builder.addProtocol($protocol);
}