@param int $oauthClientId
@param string $url The URL for this callback.
@param string[] $customHeaders

@return BunqResponseInt
763336
public static function create(int $oauthClientId, string $url, array $customHeaders = []): BunqResponseInt
    {
        $apiClient = new ApiClient(static::getApiContext());
        $responseRaw = $apiClient->post(
            vsprintf(
                self::ENDPOINT_URL_CREATE,
                [static::determineUserId(), $oauthClientId]
            ),
            [self::FIELD_URL => $url],
            $customHeaders
        );

        return BunqResponseInt::castFromBunqResponse(
            static::processForId($responseRaw)
        );
    }
1355330
public static function create(array $cards, array $customHeaders = []): BunqResponseCardBatch
    {
        $apiClient = new ApiClient(static::getApiContext());
        $responseRaw = $apiClient->post(
            vsprintf(
                self::ENDPOINT_URL_CREATE,
                [static::determineUserId()]
            ),
            [self::FIELD_CARDS => $cards],
            $customHeaders
        );

        return BunqResponseCardBatch::castFromBunqResponse(
            static::fromJson($responseRaw, self::OBJECT_TYPE_POST)
        );
    }
1317864
public static function create(
        ApiContext $apiContext,
        string $clientPublicKey
    ): BunqResponseInstallation {
        $installation = new static($clientPublicKey);

        $apiClient = new ApiClient($apiContext);
        $responseRaw = $apiClient->post(self::ENDPOINT_URL_POST, $installation->jsonSerialize(), []);

        return BunqResponseInstallation::castFromBunqResponse(
            static::classFromJson($responseRaw)
        );
    }
709711
public static function get(
        string $tabUuid,
        int $tabAttachmentTabId,
        array $customHeaders = []
    ): BunqResponseTabAttachmentTab {
        $apiClient = new ApiClient(static::getApiContext());
        $responseRaw = $apiClient->get(
            vsprintf(
                self::ENDPOINT_URL_READ,
                [$tabUuid, $tabAttachmentTabId]
            ),
            [],
            $customHeaders
        );

        return BunqResponseTabAttachmentTab::castFromBunqResponse(
            static::fromJson($responseRaw, self::OBJECT_TYPE_GET)
        );
    }
55692
protected function temporaryCredentialsProtocolHeader($uri)
    {
        $parameters = array_merge($this->baseProtocolParameters(), array(
            'oauth_callback' => $this->clientCredentials->getCallbackUri(),
        ));

        $parameters['oauth_signature'] = $this->signature->sign($uri, $parameters, 'POST');

        return $this->normalizeProtocolParameters($parameters);
    }
908234
private String getOAuth2Header(OAuth2Compatible oAuth2Compatible) throws OAuthException {
    if (adsLibConfiguration.isAutoRefreshOAuth2TokenEnabled()) {
      try {
        oAuth2Helper.refreshCredential(oAuth2Compatible.getOAuth2Credential());
      } catch (IOException e) {
        throw new OAuthException("OAuth2 token could not be refreshed.", e);
      }
    }

    return oAuth2AuthorizationHeaderProvider.getOAuth2AuthorizationHeader(oAuth2Compatible);
  }
705943
function createOAuthWrapper(oauthkey,
	oauthsecret, headers) {

	return new OAuthClient(
				'https://api.7digital.com/1.2/oauth/requesttoken',
				accessTokenUrl,
				oauthkey, oauthsecret, '1.0', null, 'HMAC-SHA1', 32, headers);
}
588979
public static function get(
        int $shareInviteBankResponseId,
        array $customHeaders = []
    ): BunqResponseShareInviteBankResponse {
        $apiClient = new ApiClient(static::getApiContext());
        $responseRaw = $apiClient->get(
            vsprintf(
                self::ENDPOINT_URL_READ,
                [static::determineUserId(), $shareInviteBankResponseId]
            ),
            [],
            $customHeaders
        );

        return BunqResponseShareInviteBankResponse::castFromBunqResponse(
            static::fromJson($responseRaw, self::OBJECT_TYPE_GET)
        );
    }
1035490
public function post($url, $data, array $customHeaders = [])
    {
        return $this->handleFailover(function() use ($url, $data, $customHeaders) {
            $response = $this->executeRequest(HttpHelper::METHOD_POST, $url, $data, $customHeaders);

            return $this->parseResponse($response);
        });
    }
51276
public static function create(string $attachmentPublicUuid, array $customHeaders = []): BunqResponseString
    {
        $apiClient = new ApiClient(static::getApiContext());
        $responseRaw = $apiClient->post(
            vsprintf(
                self::ENDPOINT_URL_CREATE,
                []
            ),
            [self::FIELD_ATTACHMENT_PUBLIC_UUID => $attachmentPublicUuid],
            $customHeaders
        );

        return BunqResponseString::castFromBunqResponse(
            static::processForUuid($responseRaw)
        );
    }
1289128
private function initializeClient($url, HttpClient $client = null)
    {
        if ($client) {
            return $this->client = $client;
        }

        return $this->client = $this->createDefaultHttpClient($url);
    }
1062834
public static function get(int $monetaryAccountJointId, array $customHeaders = []): BunqResponseMonetaryAccountJoint
    {
        $apiClient = new ApiClient(static::getApiContext());
        $responseRaw = $apiClient->get(
            vsprintf(
                self::ENDPOINT_URL_READ,
                [static::determineUserId(), $monetaryAccountJointId]
            ),
            [],
            $customHeaders
        );

        return BunqResponseMonetaryAccountJoint::castFromBunqResponse(
            static::fromJson($responseRaw, self::OBJECT_TYPE_GET)
        );
    }
290602
protected function passIssueToken(array $parameters, ClientInterface $determinedClient = null): ResponseInterface
    {
        // if client is not given we interpret it as a 'default' client should be used
        if ($determinedClient === null) {
            $determinedClient = $this->passGetIntegration()->passReadDefaultClient();
            if ($determinedClient->hasCredentials() === true) {
                throw new OAuthTokenBodyException(OAuthTokenBodyException::ERROR_UNAUTHORIZED_CLIENT);
            }
        }

        if ($determinedClient !== null && $determinedClient->isPasswordGrantEnabled() === false) {
            throw new OAuthTokenBodyException(OAuthTokenBodyException::ERROR_UNAUTHORIZED_CLIENT);
        }

        $scope = $this->passGetScope($parameters);
        list ($isScopeValid, $scopeList, $isScopeModified) =
            $this->passGetIntegration()->passValidateScope($determinedClient, $scope);
        if ($isScopeValid === false) {
            throw new OAuthTokenBodyException(OAuthTokenBodyException::ERROR_INVALID_SCOPE);
        }

        if (($userName = $this->passGetUserName($parameters)) === null ||
            ($password = $this->passGetPassword($parameters)) === null
        ) {
            throw new OAuthTokenBodyException(OAuthTokenBodyException::ERROR_INVALID_REQUEST);
        }

        $response = $this->passGetIntegration()->passValidateCredentialsAndCreateAccessTokenResponse(
            $userName,
            $password,
            $determinedClient,
            $isScopeModified,
            $scopeList,
            $parameters
        );

        return $response;
    }
704288
public void configureAuthorizationFlow(String clientId, String clientSecret, String redirectURI) {
    for(Authentication auth : authentications.values()) {
      if (auth instanceof OAuth) {
        OAuth oauth = (OAuth) auth;
        oauth.getTokenRequestBuilder()
              .setClientId(clientId)
              .setClientSecret(clientSecret)
              .setRedirectURI(redirectURI);
        oauth.getAuthenticationRequestBuilder()
              .setClientId(clientId)
              .setRedirectURI(redirectURI);
        return;
      }
    }
  }
718281
public function getAuthorizationHeader($url, array $params, array $overrides = [])
    {
        $headers = $this->prepareHeaders('POST', $url, $params, $overrides);

        $headers = implode(',', array_map(function($name, $value){
            return sprintf('%s="%s"', $name, $value);
        }, array_keys($headers), $headers));

        return sprintf('OAuth realm="",%s', $headers);
    }
416645
public static function get(int $draftShareInviteBankId, array $customHeaders = []): BunqResponseDraftShareInviteBank
    {
        $apiClient = new ApiClient(static::getApiContext());
        $responseRaw = $apiClient->get(
            vsprintf(
                self::ENDPOINT_URL_READ,
                [static::determineUserId(), $draftShareInviteBankId]
            ),
            [],
            $customHeaders
        );

        return BunqResponseDraftShareInviteBank::castFromBunqResponse(
            static::fromJson($responseRaw, self::OBJECT_TYPE_GET)
        );
    }
1115230
public static function get(int $rewardId, array $customHeaders = []): BunqResponseReward
    {
        $apiClient = new ApiClient(static::getApiContext());
        $responseRaw = $apiClient->get(
            vsprintf(
                self::ENDPOINT_URL_READ,
                [static::determineUserId(), $rewardId]
            ),
            [],
            $customHeaders
        );

        return BunqResponseReward::castFromBunqResponse(
            static::fromJson($responseRaw, self::OBJECT_TYPE_GET)
        );
    }