Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
doishub committed Jan 17, 2023
1 parent 5cda915 commit 6e32e37
Show file tree
Hide file tree
Showing 13 changed files with 352 additions and 16 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ $issues = $api->issues()
->paginate(0, 10)
->all();

// And now we use another entry point
// And now we use another endpoint
$projects = $api->projects()
->all();

Expand All @@ -67,7 +67,9 @@ Read the full <a href="https://oveleon.github.io/youtrack-api-php/" target="_bla
- A simple [ticket system](#) based on this API for the open source CMS Contao

## Contributing
The API currently supports only a subset of the available options. The basic structure has been prepared so that contributing and adding new entry points is easy. The structure should be self-explanatory, but feel free to [open an issue](https://github.com/oveleon/youtrack-api-php/issues/new) if you have any questions or comments. Supplementary queries or new entry points must be provided as [pull requests](https://github.com/oveleon/youtrack-api-php/pulls).
The API currently supports only a subset of the available options. The basic structure has been prepared so that contributing and adding new endpoints is easy. The structure should be self-explanatory, but feel free to [open an issue](https://github.com/oveleon/youtrack-api-php/issues/new) if you have any questions or comments. Supplementary queries or new entry points must be provided as [pull requests](https://github.com/oveleon/youtrack-api-php/pulls).

## ToDo:
- [ ] Create Documentation
- [ ] Provide more endpoints
- [ ] Extend existing endpoints (e.g. create Issue)
- [ ] Documentation
9 changes: 7 additions & 2 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
* [Connection](connection.md)
* [Quick start](quickstart.md)
* [Filter & Pagination](filter_pagination.md)
* [Fields](fields.md)

* Entry points
* [Issues](issues.md)
* Endpoints
* [Issues](issues/issues.md)
* [Comments](issues/comments.md)
* [Tags](issues/tags.md)
* [Time Tracking](issues/timetracking.md)
* [Projects](projects/projects.md)
2 changes: 1 addition & 1 deletion docs/connection.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ $httpClient = new HttpClient('https://example.myjetbrains.com', 'perm:your-token
?> To use a custom HTTP client, the `HttpClientInterface` can be used. The methods listed here must be provided for the API client.

## API Client
The API Client provides several entry points to simplify working with the YouTrack API. It is initialized with the previously created HTTP client.
The API Client provides several endpoints to simplify working with the YouTrack API. It is initialized with the previously created HTTP client.

```php
use Oveleon\YouTrack\Client;
Expand Down
10 changes: 10 additions & 0 deletions docs/fields.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Fields
The YouTrack API returns only the fields `id` and `$type` if no other fields are specified. In order to retrieve other fields already in the standard, which are often needed, this library adds standard fields for each endpoint.

## Define return fields
Before each query, the fields to be retrieved can be defined.

```php
$youtrack->issues()
->fields(['idReadable', 'summary', 'description'])
->all();
41 changes: 41 additions & 0 deletions docs/filter_pagination.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Filter & Pagination
Manipulators such as filters or pagination methods, must always be between the endpoint and the query:
```php
$youtrack->issues() // Endpoint
... // Filters or Pagination
->all(); // Query
```

## Filter
In YouTrack, these filters are called `queries`. Since we can also manipulate the URL query, we use the wording `filter` here.

```php
$youtrack->issues()
->filter('state:resolved')
->all();

// Multiple filters can also be applied
$youtrack->issues()
->filter('state:resolved')
->filter('for:me')
->all();

// Or separated with a space
$youtrack->issues()
->filter('state:resolved for:me')
->all();
```

## Pagination
The first parameter specifies the `offset`, the second the `limit`.
```php
$youtrack->issues()
->paginate(0, 10)
->all();

// In combination with filters
$youtrack->issues()
->filter('state:resolved')
->paginate(0, 10)
->all();
```
9 changes: 8 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@
<meta name="description" content="Description">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css">
<!--<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/css/theme-simple-dark.css">-->
<style>
.markdown-section a code{
color: #FF318C;
}
</style>
</head>
<body>
<div id="app"></div>
<script src="//cdn.jsdelivr.net/npm/docsify-edit-on-github"></script>
<script>
window.$docsify = {
name: 'YouTrack API for PHP',
logo: 'logo.svg',
themeColor: '#FF318C',
loadSidebar: true,
plugins: [
Expand All @@ -24,6 +29,8 @@
</script>
<!-- Docsify v4 -->
<script src="//cdn.jsdelivr.net/npm/docsify@4"></script>

<!-- Plugins -->
<script src="//cdn.jsdelivr.net/npm/docsify-copy-code/dist/docsify-copy-code.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-bash.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-php.min.js"></script>
Expand Down
9 changes: 0 additions & 9 deletions docs/issues.md

This file was deleted.

28 changes: 28 additions & 0 deletions docs/issues/comments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Issue Comments
```php
$youtrack->issues()
->comments()
```

##### `all()`
Returns all issue comments.

##### `one($issueId, $commentId)`
Returns a specific issue based on the issue and comment ID.

## Default return fields
```php
[
'id',
'text',
'textPreview',
'created',
'updated',
'author',
'issue',
'attachments',
'visibility',
'deleted'
]
```
!> Go to [Fields](fields.md) to learn more about default return fields.
53 changes: 53 additions & 0 deletions docs/issues/issues.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Issues
```php
// Endpoint
$youtrack->issues()
```

##### `all()`
Returns all issues.

##### `one($issueId)`
Returns a specific issue based on the issue ID.

##### `project($projectId)`
Returns all issues based on the project ID.

##### `customFields($issueId)`
Returns all custom fields based on the issue ID.

##### `attachments($issueId)`
Returns all attachments based on the issue ID.

## Sub-Endpoints

##### `comments()`
Returns the sub-endpoint for Comments.

##### `tags()`
Returns the sub-endpoint for Tags.

##### `timeTracking()`
Returns the sub-endpoint for Time Tracking.

## Default return fields
```php
[
'id',
'idReadable',
'summary',
'description',
'state',
'customFields' => [
'name',
'$type',
'value' => [
'name'
],
],
'project' => [
'name'
]
]
```
!> Go to [Fields](fields.md) to learn more about default return fields.
26 changes: 26 additions & 0 deletions docs/issues/tags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Issue Tags
```php
$youtrack->issues()
->tags()
```

##### `all($issueId)`
Returns all issue tags based on the issue ID.

## Default return fields
```php
[
'id',
'issues',
'color',
'untagOnResolve',
'visibleFor',
'updateableBy',
'readSharingSettings',
'tagSharingSettings',
'updateSharingSettings',
'owner',
'name'
]
```
!> Go to [Fields](fields.md) to learn more about default return fields.
38 changes: 38 additions & 0 deletions docs/issues/timetracking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Issue Time Tracking
```php
$youtrack->issues()
->timeTracking()
```

##### `all($issueId)`
Returns all issue time tracking items based on the issue ID.

##### `workItems($issueId)`
Returns a specific issue based on the issue ID.

## Default return fields
```php
[
'id',
'author' => [
'id'
],
'creator' => [
'id'
],
'text',
'textPreview',
'type',
'created',
'updated',
'duration' => [
'id',
'minutes',
'presentation'
],
'date',
'issue',
'attributes'
]
```
!> Go to [Fields](fields.md) to learn more about default return fields.
113 changes: 113 additions & 0 deletions docs/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 6e32e37

Please sign in to comment.