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,
        ]);
    }