PUT API endpoint

@param string $url
@param string|null $access_token
@param string|array $parameters
@param string $contentType

@return array
181316
public function put($url, $access_token = null, $parameters = [], $contentType = 'text/xml')
    {
        return $this->doApiCall($url, 'PUT', $access_token, $parameters, $contentType);
    }
926379
public function put($url, $params = null) {
    $this->params = $params;
    $this->method = 'PUT';
    $this->url = $url;

    return $this->request();
  }
574046
public function post($url=NULL, $postdata=NULL) {
		/* Do note that that if you are going to POST JSON you need to set the
		 * content-type of the transfer AFTER you set the postfields, this is done
		 * if you provide the postdata here, if not, take care to do it or the
		 * content-type will be wrong */
		$curl = curl_init();
		curl_setopt($curl, CURLOPT_FAILONERROR, FALSE);
		curl_setopt($curl, CURLOPT_FOLLOWLOCATION, FALSE);
		curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
		curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
		curl_setopt($curl, CURLOPT_TIMEOUT, 30);
		curl_setopt($curl, CURLOPT_PORT, $this->api_port);

		if($this->api_is_https) {
			if(@CURLOPT_PROTOCOLS != 'CURLOPT_PROTOCOLS') {
				curl_setopt($curl, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS);
			}
			curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
			curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, TRUE);
		} else {
			if(@CURLOPT_PROTOCOLS != 'CURLOPT_PROTOCOLS') {
				curl_setopt($curl, CURLOPT_PROTOCOLS, CURLPROTO_HTTP);
			}
		}
		if(isset($postdata)) {
			curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
		}
		curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=utf-8'));
		curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
		curl_setopt($curl, CURLOPT_URL, $url);

		$body = curl_exec($curl);
		if($body === FALSE) {
			$error = curl_error($curl);
			if($error === NULL) {
				$error = 'Failed to connect to the Trusly API';
			}
			throw new Trustly_ConnectionException($error);
		}

		if($this->api_is_https) {
			$ssl_result = curl_getinfo($curl, CURLINFO_SSL_VERIFYRESULT);
			if($ssl_result !== 0) {

				$curl_x509_errors = array(
					'0' => 'X509_V_OK',
					'2' => 'X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT',
					'3' => 'X509_V_ERR_UNABLE_TO_GET_CRL',
					'4' => 'X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE',
					'5' => 'X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE',
					'6' => 'X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY',
					'7' => 'X509_V_ERR_CERT_SIGNATURE_FAILURE',
					'8' => 'X509_V_ERR_CRL_SIGNATURE_FAILURE',
					'9' => 'X509_V_ERR_CERT_NOT_YET_VALID',
					'10' => 'X509_V_ERR_CERT_HAS_EXPIRED',
					'11' => 'X509_V_ERR_CRL_NOT_YET_VALID',
					'12' => 'X509_V_ERR_CRL_HAS_EXPIRED',
					'13' => 'X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD',
					'14' => 'X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD',
					'15' => 'X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD',
					'16' => 'X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD',
					'17' => 'X509_V_ERR_OUT_OF_MEM',
					'18' => 'X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT',
					'19' => 'X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN',
					'20' => 'X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY',
					'21' => 'X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE',
					'22' => 'X509_V_ERR_CERT_CHAIN_TOO_LONG',
					'23' => 'X509_V_ERR_CERT_REVOKED',
					'24' => 'X509_V_ERR_INVALID_CA',
					'25' => 'X509_V_ERR_PATH_LENGTH_EXCEEDED',
					'26' => 'X509_V_ERR_INVALID_PURPOSE',
					'27' => 'X509_V_ERR_CERT_UNTRUSTED',
					'28' => 'X509_V_ERR_CERT_REJECTED',
					'29' => 'X509_V_ERR_SUBJECT_ISSUER_MISMATCH',
					'30' => 'X509_V_ERR_AKID_SKID_MISMATCH',
					'31' => 'X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH',
					'32' => 'X509_V_ERR_KEYUSAGE_NO_CERTSIGN',
					'50' => 'X509_V_ERR_APPLICATION_VERIFICATION'
				);

				$ssl_error_str = null;
				if(isset($curl_x509_errors[$ssl_result])) {
					$ssl_error_str = $curl_x509_errors[$ssl_result];
				}

				$error = 'Failed to connect to the Trusly API. SSL Verification error #' . $ssl_result . ($ssl_error_str?': ' . $ssl_error_str:'');
				throw new Trustly_ConnectionException($error);
			}
		}
		$response_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);

		return array($body, $response_code);
	}
611684
private function buildUrl($endpoint, $url_parameters = [], $special_url = null)
    {
        foreach ($url_parameters as $key => $value) {
            //@codeCoverageIgnoreStart
            $endpoint = str_replace('{'.$key.'}', $value, $endpoint);
            //@codeCoverageIgnoreEnd
        }

        if (is_null($special_url)) {
            $url = trim($this->api_base_url, "/ \t\n\r\0\x0B");
        } else {
            $url = $special_url;
        }
        $url = $url.'/'.trim($endpoint, "/ \t\n\r\0\x0B");

        return $url;
    }
800376
protected function sendByHttp(string $url, string $token = null) : void
    {
        $content = ['event' => static::NAME, 'data' => $this->data];

        $request = new Request($url, $content);
        if ($token) {
            $request->addHeader(Header::AUTHORIZATION, $token);
        }

        $request->send();
    }
960565
public String put(String url, String payload) throws AuthenticationException, ApiException {
		return performRequest(url, "PUT", null, null, payload);
	}
1176460
protected function add_access_token_endpoint( $git, $endpoint ) {
		// This will return if checking during shiny updates.
		if ( null === static::$options ) {
			return $endpoint;
		}
		$key              = null;
		$token            = null;
		$token_enterprise = null;

		switch ( $git->type->git ) {
			case 'github':
				$key              = 'access_token';
				$token            = 'github_access_token';
				$token_enterprise = 'github_enterprise_token';
				break;
			case 'gitlab':
				$key              = 'private_token';
				$token            = 'gitlab_access_token';
				$token_enterprise = 'gitlab_enterprise_token';
				break;
			case 'gitea':
				$key              = 'access_token';
				$token            = 'gitea_access_token';
				$token_enterprise = 'gitea_access_token';
				break;
			case 'bitbucket':
				return $endpoint;
		}

		// Add hosted access token.
		if ( ! empty( static::$options[ $token ] ) ) {
			$endpoint = add_query_arg( $key, static::$options[ $token ], $endpoint );
		}

		// Add Enterprise access token.
		if ( ! empty( $git->type->enterprise ) &&
			! empty( static::$options[ $token_enterprise ] )
		) {
			$endpoint = remove_query_arg( $key, $endpoint );
			$endpoint = add_query_arg( $key, static::$options[ $token_enterprise ], $endpoint );
		}

		// Add repo access token.
		if ( ! empty( static::$options[ $git->type->slug ] ) ) {
			$endpoint = remove_query_arg( $key, $endpoint );
			$endpoint = add_query_arg( $key, static::$options[ $git->type->slug ], $endpoint );
		}

		return $endpoint;
	}
1249548
public function put(string $url, array $params = [])
    {
        return $this->send('PUT', $url, [
            $this->bodyFormat => $params,
        ]);
    }
987083
public function getRedirectLocation($parameters, $access_token) {
        $location = array();
        array_push($location, $parameters['redirect_uri'] . '#state=' . $parameters['state']);
        array_push($location, 'access_token=' . $access_token);
        array_push($location, 'token_type=Bearer');

        return implode('&', $location);
    }
123158
public function put(String $url = NULL, $data = NULL)
    {
        return $this->_customRequest($url, URL::buildQuery($this->data ?? $data), __FUNCTION__);
    }
1272808
public function post(string $method, string $access_token, array $params = array()) {
        $params = $this->formatParams($params);
        $params[static::PARAM_ACCESS_TOKEN] = $access_token;

        if (!isset($params[static::PARAM_VERSION])) {
            $params[static::PARAM_VERSION] = $this->version;
        }

        if ($this->language && !isset($params[static::PARAM_LANG])) {
            $params[static::PARAM_LANG] = $this->language;
        }

        $url = $this->host . '/' . $method;

        try {
            $response = $this->http_client->post($url, $params);
        } catch (TransportRequestException $e) {
            throw new VKClientException($e);
        }

        return $this->parseResponse($response);
    }
801666
public function contentTypeToResponseFormat($contentType, $url = null)
    {
        if (!empty($url)) {
            $url = parse_url($url, PHP_URL_PATH);
        }

        $contentTypeClean = strstr($contentType, ';') ? substr($contentType, 0,
                strpos($contentType, ';')) : $contentType;

        switch ($url) {
            case '/login-logout/login';
                $responseFormat = 'json';
                break;
            default :
                switch ($contentTypeClean) {
                    case 'text/javascript':
                        $responseFormat = 'js';
                        break;

                    default:
                        $responseFormat = Formats::contentTypeToSuffix($contentTypeClean);
                        break;
                }
                break;
        }

        return $responseFormat;
    }
117370
public function put($url, $params = array(), $options = array())
    {
        return $this->request($url, self::PUT, $params, $options);
    }
993533
public function post($url, array $parameters = array(), $content = null)
    {
        return $this->call(Request::METHOD_POST, $url, $parameters, $content);
    }
791094
public function put($parameters = null)
    {
        $this->setOption(CURLOPT_PUT, true);
        if ($parameters !== null) {
            $this->setParameters($parameters);
        }

        return $this->execute();
    }
237691
public function put($url, $data = null, $headers = [], $options = [])
    {
        return $this->createRequestShortcut('PUT', $url, $data, $headers, $options);
    }
325160
public static MaterialAddResult materialAdd(String accessToken,
                                                MediaType type, InputStream inputStream) {
        HttpPost httpPost = new HttpPost(BASE_URI + "/shakearound/material/add");
        byte[] data;
        try {
            data = StreamUtils.copyToByteArray(inputStream);
        } catch (IOException e) {
            logger.error("", e);
            throw new RuntimeException(e);
        }

        MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder
                .create().addBinaryBody("media", data, ContentType.DEFAULT_BINARY, "temp." + type.fileSuffix());
        HttpEntity reqEntity = multipartEntityBuilder
                .addTextBody(PARAM_ACCESS_TOKEN, API.accessToken(accessToken))
                .addTextBody("type", type.uploadType()).build();
        httpPost.setEntity(reqEntity);

        return LocalHttpClient.executeJsonResult(httpPost,
                MaterialAddResult.class);
    }