MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / genOperation

Function genOperation

module/ai-api/schema.go:22–36  ·  view source on GitHub ↗
(summary string, description string, variables []*ai_api_dto.AiPromptVariable)

Source from the content-addressed store, hash-verified

20}
21
22func 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
38func genRequestBody(variables []*ai_api_dto.AiPromptVariable) *openapi3.RequestBodyRef {
39 requestBody := openapi3.NewRequestBody()

Callers 2

TestSchemaBuildFunction · 0.85
updateAPIDocMethod · 0.85

Calls 3

genRequestBodyFunction · 0.85
genResponseFunction · 0.85
SetMethod · 0.65

Tested by 1

TestSchemaBuildFunction · 0.68