<commit_before>[![StyleCI](https://styleci.io/repos/87166365/shield)](https://styleci.io/repos/87166365)

# JDT API
This is an api wrapper around dingo api that allows you to not have to create any controllers but purely focus on processing your api requests.

A quick overview on how it works is you define the api class in your route and pass it over to the api controller and the rest is handled for you.

## Usage
There are 3 different types of api helpers you can create, all require you define validation rules for the data that is passed in.

```php
// routes/api.php
$api->get('/{id}', [
    'as' => 'api.user.title.read',
    'uses' => 'JDT\Api\Http\Controllers\ApiController@actionExecute',
    'api' => App\Modules\User\Api\UserTitle\Read::class,
]);

// app/Modules/User/Api/UserTitle/Read.php
<?php

declare(strict_types=1);

namespace App\Modules\User\Api\UserTitle;

use App\Modules\User\Entities\UserTitle;
use Illuminate\Database\Eloquent\Model;
use JDT\Api\Contracts\ApiEndpoint;
use JDT\Api\Field\Field;
use JDT\Api\Field\FieldList;
use JDT\Api\Traits\ModelEndpoint;

/**
 * Class Read
 * @package App\Modules\User\Api\UserTitle
 */
class Read implements ApiEndpoint
{
    use ModelEndpoint;

    const RUN_TYPE = self::TYPE_READ;

    /**
     * @inheritDoc
     */
    protected function getFields():FieldList
    {
        $fieldList = new FieldList();
        $fieldList->addField(new Field('id', 'required|exists:user_title,id,deleted_at,NULL'));

        return $fieldList;
    }

    /**
     * @inheritDoc
     */
    protected function getModel():Model
    {
        return new UserTitle();
    }
}
```

### ApiEndpoint

### ModelEndpoint

### MultipleEndpoint<commit_msg>Check packagist hook<commit_after>[![StyleCI](https://styleci.io/repos/87166365/shield)](https://styleci.io/repos/87166365)

# JDT API
This is an api wrapper around dingo api that allows you to not have to create any controllers but purely focus on processing your api requests.

A quick overview on how it works is you define the api class in your route and pass it over to the api controller and the rest is handled for you.

## Usage
There are 3 different types of api helpers you can create, all require you define validation rules for the data that is passed in.

```php
// routes/api.php
$api->get('/{id}', [
    'as' => 'api.user.title.read',
    'uses' => 'JDT\Api\Http\Controllers\ApiController@actionExecute',
    'api' => App\Modules\User\Api\UserTitle\Read::class,
]);

// app/Modules/User/Api/UserTitle/Read.php
<?php

declare(strict_types=1);

namespace App\Modules\User\Api\UserTitle;

use App\Modules\User\Entities\UserTitle;
use Illuminate\Database\Eloquent\Model;
use JDT\Api\Contracts\ApiEndpoint;
use JDT\Api\Field\Field;
use JDT\Api\Field\FieldList;
use JDT\Api\Traits\ModelEndpoint;

/**
 * Class Read
 * @package App\Modules\User\Api\UserTitle
 */
class Read implements ApiEndpoint
{
    use ModelEndpoint;

    const RUN_TYPE = self::TYPE_READ;

    /**
     * @inheritDoc
     */
    protected function getFields():FieldList
    {
        $fieldList = new FieldList();
        $fieldList->addField(new Field('id', 'required|exists:user_title,id,deleted_at,NULL'));

        return $fieldList;
    }

    /**
     * @inheritDoc
     */
    protected function getModel():Model
    {
        return new UserTitle();
    }
}

```

### ApiEndpoint

### ModelEndpoint

### MultipleEndpoint
{'fraction_non_alphanumeric': 0.1255868544600939, 'fraction_numerical': 0.01056338028169014, 'mean_word_length': 3.5453333333333332, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5571368', 'n_tokens_mistral': 1100, 'n_tokens_neox': 1071, 'n_words': 293}