storj/private/apigen/example/gen.go
Egon Elbre 794a4cc365 private/apigen: make code compile with 1.16
Our Test Versions still requires 1.16 to be compatible with our oldest
uplink versions. These changes make the code compile with 1.16.

Also, it makes go generate work in private/apigen/example.

Change-Id: Ib2f7493941a16f361328fe01d2be293f26123719
2022-09-02 16:34:46 +03:00

41 lines
739 B
Go

// Copyright (C) 2022 Storj Labs, Inc.
// See LICENSE for copying information.
//go:build ignore
// +build ignore
package main
import (
"time"
"storj.io/common/uuid"
"storj.io/storj/private/apigen"
)
func main() {
a := &apigen.API{PackageName: "example"}
g := a.Group("TestAPI", "testapi")
g.Post("/{path}", &apigen.Endpoint{
MethodName: "GenTestAPI",
Response: struct {
ID uuid.UUID
Date time.Time
PathParam string
Body string
}{},
Request: struct{ Content string }{},
QueryParams: []apigen.Param{
apigen.NewParam("id", uuid.UUID{}),
apigen.NewParam("date", time.Time{}),
},
PathParams: []apigen.Param{
apigen.NewParam("path", ""),
},
})
a.MustWriteGo("api.gen.go")
}