| 20 | } |
| 21 | |
| 22 | func genOperation(summary string, description string, variables []*ai_api_dto.AiPromptVariable) *openapi3.Operation { |
| 23 | operation := openapi3.NewOperation() |
| 24 | operation.Summary = summary |
| 25 | operation.Description = description |
| 26 | operation.AddParameter(&openapi3.Parameter{ |
| 27 | Name: "Authorization", |
| 28 | In: "header", |
| 29 | Required: true, |
| 30 | Example: "{your_apipark_apikey}", |
| 31 | }) |
| 32 | operation.RequestBody = genRequestBody(variables) |
| 33 | operation.Responses = &openapi3.Responses{} |
| 34 | operation.Responses.Set("200", genResponse()) |
| 35 | return operation |
| 36 | } |
| 37 | |
| 38 | func genRequestBody(variables []*ai_api_dto.AiPromptVariable) *openapi3.RequestBodyRef { |
| 39 | requestBody := openapi3.NewRequestBody() |