original_string: public function create(
          LibraryType $library,
          string $path,
          int $expire = null,
          string $shareType = SharedLinkType::SHARE_TYPE_DOWNLOAD,
          string $password = null
      ): ?SharedLinkType {
          $uri = sprintf(
              '%s/repos/%s/file/shared-link/',
              $this->clipUri($this->client->getConfig('base_uri')),
              $library->id
          );
  
          $multiPartParams = [
              ['name' => 'p', 'contents' => $path],
              ['name' => 'share_type', 'contents' => $shareType],
          ];
  
          if (!is_null($expire)) {
              $multiPartParams[] = ['name' => 'expire', 'contents' => "$expire"];
          }
  
          if (!is_null($password)) {
              $multiPartParams[] = ['name' => 'password', 'contents' => $password];
          }
  
          $response = $this->client->request(
              'PUT',
              $uri,
              [
                  'headers'   => ['Accept' => 'application/json'],
                  'multipart' => $multiPartParams,
              ]
          );
  
          if ($response->getStatusCode() !== 201 || $response->hasHeader('Location') === false) {
              return null;
          }
  
          $url = $response->getHeader('Location')[0];
  
          return (new SharedLinkType)->fromArray([
              'url'       => $url,
              'expire'    => $expire,
              'password'  => $password,
              'path'      => $path,
              'shareType' => $shareType,
          ]);
      }
code: public function create(
          LibraryType $library,
          string $path,
          int $expire = null,
          string $shareType = SharedLinkType::SHARE_TYPE_DOWNLOAD,
          string $password = null
      ): ?SharedLinkType {
          $uri = sprintf(
              '%s/repos/%s/file/shared-link/',
              $this->clipUri($this->client->getConfig('base_uri')),
              $library->id
          );
  
          $multiPartParams = [
              ['name' => 'p', 'contents' => $path],
              ['name' => 'share_type', 'contents' => $shareType],
          ];
  
          if (!is_null($expire)) {
              $multiPartParams[] = ['name' => 'expire', 'contents' => "$expire"];
          }
  
          if (!is_null($password)) {
              $multiPartParams[] = ['name' => 'password', 'contents' => $password];
          }
  
          $response = $this->client->request(
              'PUT',
              $uri,
              [
                  'headers'   => ['Accept' => 'application/json'],
                  'multipart' => $multiPartParams,
              ]
          );
  
          if ($response->getStatusCode() !== 201 || $response->hasHeader('Location') === false) {
              return null;
          }
  
          $url = $response->getHeader('Location')[0];
  
          return (new SharedLinkType)->fromArray([
              'url'       => $url,
              'expire'    => $expire,
              'password'  => $password,
              'path'      => $path,
              'shareType' => $shareType,
          ]);
      }
code_tokens: public function create ( LibraryType $ library , string $ path , int $ expire = null , string $ shareType = SharedLinkType :: SHARE_TYPE_DOWNLOAD , string $ password = null ) : ? SharedLinkType { $ uri = sprintf ( '%s/repos/%s/file/shared-link/' , $ this -> clipUri ( $ this -> client -> getConfig ( 'base_uri' ) ) , $ library -> id ) ; $ multiPartParams = [ [ 'name' => 'p' , 'contents' => $ path ] , [ 'name' => 'share_type' , 'contents' => $ shareType ] , ] ; if ( ! is_null ( $ expire ) ) { $ multiPartParams [ ] = [ 'name' => 'expire' , 'contents' => "$expire" ] ; } if ( ! is_null ( $ password ) ) { $ multiPartParams [ ] = [ 'name' => 'password' , 'contents' => $ password ] ; } $ response = $ this -> client -> request ( 'PUT' , $ uri , [ 'headers' => [ 'Accept' => 'application/json' ] , 'multipart' => $ multiPartParams , ] ) ; if ( $ response -> getStatusCode ( ) !== 201 || $ response -> hasHeader ( 'Location' ) === false ) { return null ; } $ url = $ response -> getHeader ( 'Location' ) [ 0 ] ; return ( new SharedLinkType ) -> fromArray ( [ 'url' => $ url , 'expire' => $ expire , 'password' => $ password , 'path' => $ path , 'shareType' => $ shareType , ] ) ; }
docstring: Create share link
  
  @param LibraryType $library   Library instance
  @param string      $path      Path
  @param int         $expire    Expire in such many days
  @param string      $shareType Share type
  @param string      $password  Optional password string
  
  @return SharedLinkType|null
  @throws Exception
  @throws \GuzzleHttp\Exception\GuzzleException
docstring_tokens: Create share link