<commit_before><?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

app('url')->forceRootUrl(config('aic.proxy_url'));
app('url')->forceScheme(config('aic.proxy_scheme'));

Route::group(['prefix' => 'v1'], function () {

    Route::any('/', function () {
        return redirect('/api/v1/swagger.json');
    });

    Route::any('swagger.json', 'SwaggerController@index')->name('doc-swagger');

    // Elasticsearch
    Route::match(['GET', 'POST'], 'search', 'SearchController@search');
    Route::match(['GET', 'POST'], '{resource}/search', 'SearchController@search');

    Route::match(['GET', 'POST'], 'msearch', 'SearchController@msearch');
    Route::match(['GET', 'POST'], 'msuggest', 'SearchController@msuggest');

    Route::match(['GET', 'POST'], 'autocomplete', 'SearchController@autocompleteWithTitle');
    Route::match(['GET', 'POST'], 'autosuggest', 'SearchController@autocompleteWithSource');

    // For debugging search, show generated request
    if (env('APP_ENV') === 'local') {
        Route::match(['GET', 'POST'], 'echo', 'SearchController@echo');
        Route::match(['GET', 'POST'], '{resource}/echo', 'SearchController@echo');
        Route::match(['GET', 'POST'], '{resource}/{id}/explain', 'SearchController@explain');
    }

    // Define all of our resource routes by looping through config
    foreach (config('resources.outbound.base') as $resource)
    {
        if (!isset($resource['endpoint']))
        {
            continue;
        }

        $isScoped = $resource['scope_of'] ?? false;
        $isRestricted = $resource['is_restricted'] ?? false;

        $controller = $isRestricted ? 'RestrictedResourceController' : 'ResourceController';

        Route::any($resource['endpoint'], $controller . '@' . ($isScoped ? 'indexScope' : 'index'));
        Route::any($resource['endpoint'] . '/{id}', $controller . '@' . ($isScoped ? 'showScope' : 'show'));

        if ($resource['endpoint'] == 'artworks') {
            Route::any($resource['endpoint'] . '/{id}/manifest.json', 'ArtworkController@manifest');
        }
    }

});
<commit_msg>Also serve IIIF manifests at /manifest [WEB-1809]<commit_after><?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

app('url')->forceRootUrl(config('aic.proxy_url'));
app('url')->forceScheme(config('aic.proxy_scheme'));

Route::group(['prefix' => 'v1'], function () {

    Route::any('/', function () {
        return redirect('/api/v1/swagger.json');
    });

    Route::any('swagger.json', 'SwaggerController@index')->name('doc-swagger');

    // Elasticsearch
    Route::match(['GET', 'POST'], 'search', 'SearchController@search');
    Route::match(['GET', 'POST'], '{resource}/search', 'SearchController@search');

    Route::match(['GET', 'POST'], 'msearch', 'SearchController@msearch');
    Route::match(['GET', 'POST'], 'msuggest', 'SearchController@msuggest');

    Route::match(['GET', 'POST'], 'autocomplete', 'SearchController@autocompleteWithTitle');
    Route::match(['GET', 'POST'], 'autosuggest', 'SearchController@autocompleteWithSource');

    // For debugging search, show generated request
    if (env('APP_ENV') === 'local') {
        Route::match(['GET', 'POST'], 'echo', 'SearchController@echo');
        Route::match(['GET', 'POST'], '{resource}/echo', 'SearchController@echo');
        Route::match(['GET', 'POST'], '{resource}/{id}/explain', 'SearchController@explain');
    }

    // Define all of our resource routes by looping through config
    foreach (config('resources.outbound.base') as $resource)
    {
        if (!isset($resource['endpoint']))
        {
            continue;
        }

        $isScoped = $resource['scope_of'] ?? false;
        $isRestricted = $resource['is_restricted'] ?? false;

        $controller = $isRestricted ? 'RestrictedResourceController' : 'ResourceController';

        Route::any($resource['endpoint'], $controller . '@' . ($isScoped ? 'indexScope' : 'index'));
        Route::any($resource['endpoint'] . '/{id}', $controller . '@' . ($isScoped ? 'showScope' : 'show'));

        if ($resource['endpoint'] == 'artworks') {
            Route::any($resource['endpoint'] . '/{id}/manifest', 'ArtworkController@manifest');
            Route::any($resource['endpoint'] . '/{id}/manifest.json', 'ArtworkController@manifest');
        }
    }

});

{'fraction_non_alphanumeric': 0.24771189812972544, 'fraction_numerical': 0.0015917230401910067, 'mean_word_length': 3.1272577996715927, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, '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': '3165499', 'n_tokens_mistral': 1385, 'n_tokens_neox': 1335, 'n_words': 285}