105 lines
3.8 KiB
TypeScript
105 lines
3.8 KiB
TypeScript
|
|
import { queryParams, type RouteQueryOptions, type RouteDefinition, type RouteFormDefinition, applyUrlDefaults } from './../../../../../wayfinder'
|
||
|
|
/**
|
||
|
|
* @see \App\Modules\Movies\Http\Controllers\Browse\Entities\ActorShowController::show
|
||
|
|
* @see app/Modules/Movies/Http/Controllers/Browse/Entities/ActorShowController.php:12
|
||
|
|
* @route '/api/actors/{actor}'
|
||
|
|
*/
|
||
|
|
export const show = (args: { actor: string | number } | [actor: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
|
||
|
|
url: show.url(args, options),
|
||
|
|
method: 'get',
|
||
|
|
})
|
||
|
|
|
||
|
|
show.definition = {
|
||
|
|
methods: ["get","head"],
|
||
|
|
url: '/api/actors/{actor}',
|
||
|
|
} satisfies RouteDefinition<["get","head"]>
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @see \App\Modules\Movies\Http\Controllers\Browse\Entities\ActorShowController::show
|
||
|
|
* @see app/Modules/Movies/Http/Controllers/Browse/Entities/ActorShowController.php:12
|
||
|
|
* @route '/api/actors/{actor}'
|
||
|
|
*/
|
||
|
|
show.url = (args: { actor: string | number } | [actor: string | number ] | string | number, options?: RouteQueryOptions) => {
|
||
|
|
if (typeof args === 'string' || typeof args === 'number') {
|
||
|
|
args = { actor: args }
|
||
|
|
}
|
||
|
|
|
||
|
|
if (Array.isArray(args)) {
|
||
|
|
args = {
|
||
|
|
actor: args[0],
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
args = applyUrlDefaults(args)
|
||
|
|
|
||
|
|
const parsedArgs = {
|
||
|
|
actor: args.actor,
|
||
|
|
}
|
||
|
|
|
||
|
|
return show.definition.url
|
||
|
|
.replace('{actor}', parsedArgs.actor.toString())
|
||
|
|
.replace(/\/+$/, '') + queryParams(options)
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @see \App\Modules\Movies\Http\Controllers\Browse\Entities\ActorShowController::show
|
||
|
|
* @see app/Modules/Movies/Http/Controllers/Browse/Entities/ActorShowController.php:12
|
||
|
|
* @route '/api/actors/{actor}'
|
||
|
|
*/
|
||
|
|
show.get = (args: { actor: string | number } | [actor: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'get'> => ({
|
||
|
|
url: show.url(args, options),
|
||
|
|
method: 'get',
|
||
|
|
})
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @see \App\Modules\Movies\Http\Controllers\Browse\Entities\ActorShowController::show
|
||
|
|
* @see app/Modules/Movies/Http/Controllers/Browse/Entities/ActorShowController.php:12
|
||
|
|
* @route '/api/actors/{actor}'
|
||
|
|
*/
|
||
|
|
show.head = (args: { actor: string | number } | [actor: string | number ] | string | number, options?: RouteQueryOptions): RouteDefinition<'head'> => ({
|
||
|
|
url: show.url(args, options),
|
||
|
|
method: 'head',
|
||
|
|
})
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @see \App\Modules\Movies\Http\Controllers\Browse\Entities\ActorShowController::show
|
||
|
|
* @see app/Modules/Movies/Http/Controllers/Browse/Entities/ActorShowController.php:12
|
||
|
|
* @route '/api/actors/{actor}'
|
||
|
|
*/
|
||
|
|
const showForm = (args: { actor: string | number } | [actor: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||
|
|
action: show.url(args, options),
|
||
|
|
method: 'get',
|
||
|
|
})
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @see \App\Modules\Movies\Http\Controllers\Browse\Entities\ActorShowController::show
|
||
|
|
* @see app/Modules/Movies/Http/Controllers/Browse/Entities/ActorShowController.php:12
|
||
|
|
* @route '/api/actors/{actor}'
|
||
|
|
*/
|
||
|
|
showForm.get = (args: { actor: string | number } | [actor: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||
|
|
action: show.url(args, options),
|
||
|
|
method: 'get',
|
||
|
|
})
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @see \App\Modules\Movies\Http\Controllers\Browse\Entities\ActorShowController::show
|
||
|
|
* @see app/Modules/Movies/Http/Controllers/Browse/Entities/ActorShowController.php:12
|
||
|
|
* @route '/api/actors/{actor}'
|
||
|
|
*/
|
||
|
|
showForm.head = (args: { actor: string | number } | [actor: string | number ] | string | number, options?: RouteQueryOptions): RouteFormDefinition<'get'> => ({
|
||
|
|
action: show.url(args, {
|
||
|
|
[options?.mergeQuery ? 'mergeQuery' : 'query']: {
|
||
|
|
_method: 'HEAD',
|
||
|
|
...(options?.query ?? options?.mergeQuery ?? {}),
|
||
|
|
}
|
||
|
|
}),
|
||
|
|
method: 'get',
|
||
|
|
})
|
||
|
|
|
||
|
|
show.form = showForm
|
||
|
|
|
||
|
|
const actors = {
|
||
|
|
show: Object.assign(show, show),
|
||
|
|
}
|
||
|
|
|
||
|
|
export default actors
|