feat: add HTTP API and complete client workflows
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { Body, Controller, Get, Param, Post, Put } from '@nestjs/common';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import { RequireRecentAuthentication } from '../auth/require-recent-authentication.decorator';
|
||||
import { HttpConfigInput, OpenApiService } from './open-api.service';
|
||||
|
||||
@ApiTags('admin-http-open-api')
|
||||
@Controller('admin/enterprise-applications/:applicationId/http-api')
|
||||
export class AdminOpenApiController {
|
||||
constructor(private readonly service: OpenApiService) {}
|
||||
|
||||
@Get() getConfig(@Param('applicationId') applicationId: string) { return this.service.getConfig(applicationId); }
|
||||
@Put() @RequireRecentAuthentication() updateConfig(@Param('applicationId') applicationId: string, @Body() body: HttpConfigInput) { return this.service.updateConfig(applicationId, body); }
|
||||
@Get('credentials') listCredentials(@Param('applicationId') applicationId: string) { return this.service.listCredentials(applicationId); }
|
||||
@Post('credentials') @RequireRecentAuthentication() createCredential(@Param('applicationId') applicationId: string, @Body() body: { name?: string; expiresAt?: string; createdById?: string }) { return this.service.createCredential(applicationId, body); }
|
||||
@Post('credentials/:credentialId/revoke') @RequireRecentAuthentication() revokeCredential(@Param('applicationId') applicationId: string, @Param('credentialId') credentialId: string) { return this.service.revokeCredential(applicationId, credentialId); }
|
||||
@Get('webhooks') getWebhooks(@Param('applicationId') applicationId: string) { return this.service.getWebhookEndpoints(applicationId); }
|
||||
@Put('webhooks/:eventType') @RequireRecentAuthentication() upsertWebhook(@Param('applicationId') applicationId: string, @Param('eventType') eventType: string, @Body() body: { url: string; rotateSecret?: boolean; status?: string }) { return this.service.upsertWebhookEndpoint(applicationId, eventType, body); }
|
||||
@Get('requests') listRequests(@Param('applicationId') applicationId: string) { return this.service.listRequestLogs(applicationId); }
|
||||
@Get('webhook-deliveries') listDeliveries(@Param('applicationId') applicationId: string) { return this.service.listWebhookDeliveries(applicationId); }
|
||||
@Post('webhook-deliveries/:deliveryId/retry') @RequireRecentAuthentication() retryDelivery(@Param('applicationId') applicationId: string, @Param('deliveryId') deliveryId: string) { return this.service.retryWebhookDelivery(applicationId, deliveryId); }
|
||||
}
|
||||
Reference in New Issue
Block a user