cybercog / laravel-youtrack-sdk

Laravel wrapper for the YouTrack PHP Software Development Kit provides set of tools to interact with JetBrains YouTrack.
https://komarev.com
MIT License
18 stars 6 forks source link

[BUG] endpointPathPrefix in YouTrackClient #10

Closed Shocky92 closed 4 years ago

Shocky92 commented 4 years ago

https://www.jetbrains.com/help/youtrack/incloud/api-rest-api-url-and-endpoints.html

According to documentation API endpoint starts with '/youtrack/api' or 'api'

So there's no need to add this to url

/src/Client/YouTrackClient.php

private $endpointPathPrefix = 'rest';

Function below

protected function buildUri(string $uri): string
    {
        return $this->endpointPathPrefix . '/' . ltrim($uri, '/');
    }

should look like this

protected function buildUri(string $uri): string
    {
        return ltrim($uri, '/');
    }

Or better make this variable configurable, that would help a lot.

antonkomarev commented 4 years ago

@Shocky92 I've implemented it this way because this prefix was default in self-hosted YouTrack application. It might be different in cloud solution.

I'm not sure I can dive into this issue right now. Feel free to commit PR to move it forward.

antonkomarev commented 4 years ago

Accordingly to the docs this rest prefix is deprecated. Old: https://www.jetbrains.com/help/youtrack/standalone/2019.2/Create-New-Issue.html New: https://www.jetbrains.com/help/youtrack/standalone/2019.2/resource-api-issues.html#create-Issue-method

antonkomarev commented 4 years ago

This feature implemented by @asteisiunas and published as cybercog/youtrack-rest-php minor 6.2.0 release. Just make composer update.