Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Laravel 11 #3

Merged
merged 2 commits into from
Mar 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 28 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,37 @@
name: Nuclino API Client
name: Tests

on: [push]

jobs:
nuclino-api-client-tests:
runs-on: ubuntu-latest
test:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.1', '8.2', '8.3']

steps:
- name: Checkout
uses: actions/checkout@v2
name: PHP ${{ matrix.php-versions }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: mbstring, intl
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl

- name: Execute tests (Unit and Feature tests) via PHPUnit
run: |
vendor/bin/phpunit
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress

- name: Execute static analysis
run: |
vendor/bin/phpstan
- name: Execute tests (Unit and Feature tests) via PHPUnit
run: |
vendor/bin/phpunit

- name: Execute static analysis
run: |
vendor/bin/phpstan

- name: Execute lint check
run: |
vendor/bin/pint --test
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
[Semantic Versioning](https://semver.org/spec/v2.0.0.html). Please note this changelog affects this package and not the
Nuclino API.

## [3.0.0]

### Added

- Add support for Laravel 11.
- Add pint for code style.

### Removed

- Drop support for PHP versions lower than 8.1

## [2.0.0]

### Changed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Easy to use client for the API of [Nuclino](https://www.nuclino.com/).

## Requirements

This package requires at least PHP 7.4.
This package requires at least PHP 8.1.

## Installation

Expand Down
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@
}
],
"require": {
"php": "^7.4|^8.0",
"php": "^8.1",
"ext-json": "*",
"guzzlehttp/guzzle": "^7.0",
"illuminate/http": "^8.74|^9.0|^10.0",
"illuminate/support": "^8.22|^9.0|^10.0"
"illuminate/http": "^8.74|^9.0|^10.0|^11.0",
"illuminate/support": "^8.22|^9.0|^10.0|^11.0"
},
"require-dev": {
"laravel/pint": "^1.14",
"phpstan/phpstan": "^1.2",
"phpunit/phpunit": "^9.0"
"phpunit/phpunit": "^9.0|^10.0"
},
"autoload": {
"psr-4": {
Expand Down
7 changes: 7 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"preset": "laravel",
"rules": {
"array_indentation": false,
"phpdoc_align": false
}
}
10 changes: 5 additions & 5 deletions src/Endpoints/ItemEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
trait ItemEndpoint
{
public function listItems(
string $teamId = null,
string $workspaceId = null,
?string $teamId = null,
?string $workspaceId = null,
int $limit = 100,
string $after = null
?string $after = null
): Response {
if ($limit > 100) {
$limit = 100;
Expand All @@ -30,8 +30,8 @@ public function listItems(

public function searchItems(
string $search,
string $teamId = null,
string $workspaceId = null,
?string $teamId = null,
?string $workspaceId = null,
int $limit = 100
): Response {
if ($limit > 100) {
Expand Down
2 changes: 1 addition & 1 deletion src/Endpoints/TeamEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

trait TeamEndpoint
{
public function listTeams(int $limit = 100, string $after = null): Response
public function listTeams(int $limit = 100, ?string $after = null): Response
{
if ($limit > 100) {
$limit = 100;
Expand Down
2 changes: 1 addition & 1 deletion src/Endpoints/WorkspaceEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

trait WorkspaceEndpoint
{
public function listWorkspaces(string $teamId = null, int $limit = 100, string $after = null): Response
public function listWorkspaces(?string $teamId = null, int $limit = 100, ?string $after = null): Response
{
if ($limit > 100) {
$limit = 100;
Expand Down
1 change: 1 addition & 0 deletions src/Enum/ItemObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
class ItemObject
{
public const ITEM = 'item';

public const CLUSTER = 'cluster';

public const AVAILABLE = [
Expand Down
5 changes: 5 additions & 0 deletions src/Models/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@
class Item implements Arrayable
{
private ?string $workspaceId = null;

private ?string $parentId = null;

private string $object = ItemObject::ITEM;

private string $title = '';

private string $content = '';

private ?int $index = null;

public function getWorkspaceId(): ?string
Expand Down
11 changes: 7 additions & 4 deletions src/Nuclino.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@

class Nuclino extends Factory
{
use FileEndpoint;
use ItemEndpoint;
use TeamEndpoint;
use WorkspaceEndpoint;
use ItemEndpoint;
use FileEndpoint;

private const TIMEOUT = 180;
private const VERSION = '1.0.0';
private const USER_AGENT = 'vdhicts-nuclino-api-client/' . self::VERSION;

private const VERSION = '3.0.0';

private const USER_AGENT = 'vdhicts-nuclino-api-client/'.self::VERSION;

private const BASE_URL = 'https://api.nuclino.com/';

protected string $apiKey;
Expand Down
2 changes: 1 addition & 1 deletion src/Support/RequestHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ public static function build(string $url, array $data): string
return $url;
}

return $url . '?' . $query;
return $url.'?'.$query;
}
}
2 changes: 1 addition & 1 deletion tests/Unit/NuclinoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function testRequest()
return
$request->hasHeader('Authorization', $apiKey) &&
$request->hasHeader('Accept', 'application/json') &&
$request->url() == 'https://api.nuclino.com/v0/items/' . $id;
$request->url() == 'https://api.nuclino.com/v0/items/'.$id;
});
}
}
Loading