Operations
FUNCTION
@skmtc/core 0.63.4toEndpointType
Determines the endpoint type based on HTTP method.
Signature
import { toEndpointType } from '@skmtc/core'
toEndpointType(operation: OasOperation): 'query' | 'mutation'Parameters
The OpenAPI operation to analyze
Example
const getOp = new OasOperation({ method: 'get', path: '/users' });
console.log(toEndpointType(getOp)); // 'query'
const postOp = new OasOperation({ method: 'post', path: '/users' });
console.log(toEndpointType(postOp)); // 'mutation'Returns
'query' | 'mutation'
'query' for GET and QUERY operations, 'mutation' for all others