Spaces:
Runtime error
Runtime error
Download swagger/docs/docs.go from lifedebugger/event-booking-api: direct link, hf CLI and curl.
- Browser
- Download file 15.7 kB
-
https://huggingface.co/spaces/lifedebugger/event-booking-api/resolve/main/swagger/docs/docs.go
- Command line
-
hf download hf://spaces/lifedebugger/event-booking-api/swagger/docs/docs.go
-
curl -L -o docs.go https://huggingface.co/spaces/lifedebugger/event-booking-api/resolve/main/swagger/docs/docs.go
15.7 kB
| // Package docs Code generated by swaggo/swag. DO NOT EDIT | |
| package docs | |
| import "github.com/swaggo/swag" | |
| const docTemplate = `{ | |
| "schemes": {{ marshal .Schemes }}, | |
| "swagger": "2.0", | |
| "info": { | |
| "description": "{{escape .Description}}", | |
| "title": "{{.Title}}", | |
| "contact": { | |
| "name": "Abdan Hafidz" | |
| }, | |
| "license": { | |
| "name": "MIT", | |
| "url": "https://opensource.org/licenses/MIT" | |
| }, | |
| "version": "{{.Version}}" | |
| }, | |
| "host": "{{.Host}}", | |
| "basePath": "{{.BasePath}}", | |
| "paths": { | |
| "/v1/bookings": { | |
| "post": { | |
| "description": "Reserves tickets all-or-nothing and starts the payment hold", | |
| "consumes": [ | |
| "application/json" | |
| ], | |
| "produces": [ | |
| "application/json" | |
| ], | |
| "tags": [ | |
| "Booking" | |
| ], | |
| "summary": "Reserve tickets", | |
| "parameters": [ | |
| { | |
| "type": "string", | |
| "description": "Caller user ID", | |
| "name": "X-User-Id", | |
| "in": "header", | |
| "required": true | |
| }, | |
| { | |
| "type": "string", | |
| "description": "Idempotency key", | |
| "name": "Idempotency-Key", | |
| "in": "header", | |
| "required": true | |
| }, | |
| { | |
| "description": "Booking request", | |
| "name": "request", | |
| "in": "body", | |
| "required": true, | |
| "schema": { | |
| "$ref": "#/definitions/dto.CreateBookingRequest" | |
| } | |
| } | |
| ], | |
| "responses": { | |
| "201": { | |
| "description": "Created", | |
| "schema": { | |
| "$ref": "#/definitions/dto.SuccessResponse-dto_BookingResponse" | |
| } | |
| }, | |
| "400": { | |
| "description": "Bad Request", | |
| "schema": { | |
| "$ref": "#/definitions/dto.ErrorResponse" | |
| } | |
| }, | |
| "401": { | |
| "description": "Unauthorized", | |
| "schema": { | |
| "$ref": "#/definitions/dto.ErrorResponse" | |
| } | |
| }, | |
| "404": { | |
| "description": "Not Found", | |
| "schema": { | |
| "$ref": "#/definitions/dto.ErrorResponse" | |
| } | |
| }, | |
| "409": { | |
| "description": "Conflict", | |
| "schema": { | |
| "$ref": "#/definitions/dto.ErrorResponse" | |
| } | |
| }, | |
| "422": { | |
| "description": "Unprocessable Entity", | |
| "schema": { | |
| "$ref": "#/definitions/dto.ErrorResponse" | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/v1/bookings/{id}": { | |
| "get": { | |
| "produces": [ | |
| "application/json" | |
| ], | |
| "tags": [ | |
| "Booking" | |
| ], | |
| "summary": "Get one of your bookings", | |
| "parameters": [ | |
| { | |
| "type": "string", | |
| "description": "Caller user ID", | |
| "name": "X-User-Id", | |
| "in": "header", | |
| "required": true | |
| }, | |
| { | |
| "type": "string", | |
| "description": "Booking ID", | |
| "name": "id", | |
| "in": "path", | |
| "required": true | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "OK", | |
| "schema": { | |
| "$ref": "#/definitions/dto.SuccessResponse-dto_BookingResponse" | |
| } | |
| }, | |
| "404": { | |
| "description": "Not Found", | |
| "schema": { | |
| "$ref": "#/definitions/dto.ErrorResponse" | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/v1/bookings/{id}/cancel": { | |
| "post": { | |
| "produces": [ | |
| "application/json" | |
| ], | |
| "tags": [ | |
| "Booking" | |
| ], | |
| "summary": "Cancel a pending or confirmed booking before the event starts", | |
| "parameters": [ | |
| { | |
| "type": "string", | |
| "description": "Caller user ID", | |
| "name": "X-User-Id", | |
| "in": "header", | |
| "required": true | |
| }, | |
| { | |
| "type": "string", | |
| "description": "Booking ID", | |
| "name": "id", | |
| "in": "path", | |
| "required": true | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "OK", | |
| "schema": { | |
| "$ref": "#/definitions/dto.SuccessResponse-dto_BookingResponse" | |
| } | |
| }, | |
| "404": { | |
| "description": "Not Found", | |
| "schema": { | |
| "$ref": "#/definitions/dto.ErrorResponse" | |
| } | |
| }, | |
| "409": { | |
| "description": "Conflict", | |
| "schema": { | |
| "$ref": "#/definitions/dto.ErrorResponse" | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/v1/bookings/{id}/pay": { | |
| "post": { | |
| "description": "tok_success confirms; tok_decline and tok_timeout fail the booking and release its tickets", | |
| "consumes": [ | |
| "application/json" | |
| ], | |
| "produces": [ | |
| "application/json" | |
| ], | |
| "tags": [ | |
| "Booking" | |
| ], | |
| "summary": "Pay for a booking with the mock gateway", | |
| "parameters": [ | |
| { | |
| "type": "string", | |
| "description": "Caller user ID", | |
| "name": "X-User-Id", | |
| "in": "header", | |
| "required": true | |
| }, | |
| { | |
| "type": "string", | |
| "description": "Idempotency key", | |
| "name": "Idempotency-Key", | |
| "in": "header", | |
| "required": true | |
| }, | |
| { | |
| "type": "string", | |
| "description": "Booking ID", | |
| "name": "id", | |
| "in": "path", | |
| "required": true | |
| }, | |
| { | |
| "description": "Payment request", | |
| "name": "request", | |
| "in": "body", | |
| "required": true, | |
| "schema": { | |
| "$ref": "#/definitions/dto.PayBookingRequest" | |
| } | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "OK", | |
| "schema": { | |
| "$ref": "#/definitions/dto.SuccessResponse-dto_BookingResponse" | |
| } | |
| }, | |
| "402": { | |
| "description": "Payment Required", | |
| "schema": { | |
| "$ref": "#/definitions/dto.ErrorResponse" | |
| } | |
| }, | |
| "404": { | |
| "description": "Not Found", | |
| "schema": { | |
| "$ref": "#/definitions/dto.ErrorResponse" | |
| } | |
| }, | |
| "409": { | |
| "description": "Conflict", | |
| "schema": { | |
| "$ref": "#/definitions/dto.ErrorResponse" | |
| } | |
| }, | |
| "422": { | |
| "description": "Unprocessable Entity", | |
| "schema": { | |
| "$ref": "#/definitions/dto.ErrorResponse" | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "/v1/events/{id}": { | |
| "get": { | |
| "description": "Event with its ticket types and live availability", | |
| "produces": [ | |
| "application/json" | |
| ], | |
| "tags": [ | |
| "Event" | |
| ], | |
| "summary": "Get an event", | |
| "parameters": [ | |
| { | |
| "type": "string", | |
| "description": "Event ID", | |
| "name": "id", | |
| "in": "path", | |
| "required": true | |
| } | |
| ], | |
| "responses": { | |
| "200": { | |
| "description": "OK", | |
| "schema": { | |
| "$ref": "#/definitions/dto.SuccessResponse-dto_EventResponse" | |
| } | |
| }, | |
| "404": { | |
| "description": "Not Found", | |
| "schema": { | |
| "$ref": "#/definitions/dto.ErrorResponse" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "definitions": { | |
| "dto.BookingResponse": { | |
| "type": "object", | |
| "properties": { | |
| "created_at": { | |
| "type": "string" | |
| }, | |
| "currency": { | |
| "type": "string" | |
| }, | |
| "event_id": { | |
| "type": "string" | |
| }, | |
| "expires_at": { | |
| "type": "string" | |
| }, | |
| "id": { | |
| "type": "string" | |
| }, | |
| "quantity": { | |
| "type": "integer" | |
| }, | |
| "status": { | |
| "type": "string" | |
| }, | |
| "ticket_type_id": { | |
| "type": "string" | |
| }, | |
| "total_amount": { | |
| "type": "integer" | |
| }, | |
| "unit_price": { | |
| "type": "integer" | |
| }, | |
| "updated_at": { | |
| "type": "string" | |
| } | |
| } | |
| }, | |
| "dto.CreateBookingRequest": { | |
| "type": "object", | |
| "required": [ | |
| "quantity", | |
| "ticket_type_id" | |
| ], | |
| "properties": { | |
| "quantity": { | |
| "type": "integer", | |
| "maximum": 6, | |
| "minimum": 1 | |
| }, | |
| "ticket_type_id": { | |
| "type": "string" | |
| } | |
| } | |
| }, | |
| "dto.ErrorResponse": { | |
| "type": "object", | |
| "properties": { | |
| "code": { | |
| "type": "string" | |
| }, | |
| "errors": {}, | |
| "message": {}, | |
| "meta_data": {}, | |
| "status": { | |
| "type": "string" | |
| } | |
| } | |
| }, | |
| "dto.EventResponse": { | |
| "type": "object", | |
| "properties": { | |
| "currency": { | |
| "type": "string" | |
| }, | |
| "id": { | |
| "type": "string" | |
| }, | |
| "name": { | |
| "type": "string" | |
| }, | |
| "starts_at": { | |
| "type": "string" | |
| }, | |
| "ticket_types": { | |
| "type": "array", | |
| "items": { | |
| "$ref": "#/definitions/dto.TicketTypeResponse" | |
| } | |
| } | |
| } | |
| }, | |
| "dto.PayBookingRequest": { | |
| "type": "object", | |
| "required": [ | |
| "payment_token" | |
| ], | |
| "properties": { | |
| "payment_token": { | |
| "type": "string", | |
| "maxLength": 64 | |
| } | |
| } | |
| }, | |
| "dto.SuccessResponse-dto_BookingResponse": { | |
| "type": "object", | |
| "properties": { | |
| "data": { | |
| "$ref": "#/definitions/dto.BookingResponse" | |
| }, | |
| "message": {}, | |
| "meta_data": {}, | |
| "status": { | |
| "type": "string" | |
| } | |
| } | |
| }, | |
| "dto.SuccessResponse-dto_EventResponse": { | |
| "type": "object", | |
| "properties": { | |
| "data": { | |
| "$ref": "#/definitions/dto.EventResponse" | |
| }, | |
| "message": {}, | |
| "meta_data": {}, | |
| "status": { | |
| "type": "string" | |
| } | |
| } | |
| }, | |
| "dto.TicketTypeResponse": { | |
| "type": "object", | |
| "properties": { | |
| "available": { | |
| "type": "integer" | |
| }, | |
| "capacity": { | |
| "type": "integer" | |
| }, | |
| "id": { | |
| "type": "string" | |
| }, | |
| "name": { | |
| "type": "string" | |
| }, | |
| "price": { | |
| "type": "integer" | |
| } | |
| } | |
| } | |
| } | |
| }` | |
| // SwaggerInfo holds exported Swagger Info so clients can modify it | |
| var SwaggerInfo = &swag.Spec{ | |
| Version: "1.0.0", | |
| Host: "", | |
| BasePath: "/", | |
| Schemes: []string{"http", "https"}, | |
| Title: "Event Ticket Booking API", | |
| Description: "Minimal booking API built for integration and performance testing. Callers identify themselves with X-User-Id; payment is a mock selected by token (tok_success, tok_decline, tok_timeout).", | |
| InfoInstanceName: "swagger", | |
| SwaggerTemplate: docTemplate, | |
| LeftDelim: "{{", | |
| RightDelim: "}}", | |
| } | |
| func init() { | |
| swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) | |
| } | |