Skip to content

Commit

Permalink
fixup! refactoring: rename store APIs to upload
Browse files Browse the repository at this point in the history
Signed-off-by: Kairo Araujo <[email protected]>
  • Loading branch information
kairoaraujo committed Jan 24, 2024
1 parent 804bed9 commit 0a89fac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ require (
github.com/rs/xid v1.5.0 // indirect
github.com/sosodev/duration v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/swaggo/files/v2 v2.0.0 // indirect
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
Expand Down
10 changes: 5 additions & 5 deletions internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func New(metadataStore Storer, objectStore StorerGetter, cfg *config.Config, sql
r := mux.NewRouter()
s := &Server{metadataStore, objectStore, nil}

// TODO: remove from future version (v0.5.0) endpoint with version
// TODO: remove from future version (v0.6.0) endpoint with version
r.HandleFunc("/download/{gitoid}", s.DownloadHandler)
r.HandleFunc("/upload", s.UploadHandler)
if cfg.EnableGraphql {
Expand Down Expand Up @@ -95,7 +95,7 @@ func (s *Server) Router() *mux.Router {
return s.router
}

// @Summary Store
// @Summary Upload
// @Description stores an attestation
// @Produce json
// @Success 200 {object} api.StoreResponse
Expand Down Expand Up @@ -128,7 +128,7 @@ func (s *Server) Upload(ctx context.Context, r io.Reader) (api.UploadResponse, e
return api.UploadResponse{Gitoid: gid.String()}, nil
}

// @Summary Store
// @Summary Upload
// @Description stores an attestation
// @Produce json
// @Success 200 {object} api.StoreResponse
Expand Down Expand Up @@ -162,7 +162,7 @@ func (s *Server) UploadHandler(w http.ResponseWriter, r *http.Request) {
// @Produce json
// @Success 200 {object} dsse.Envelope
// @Tags attestation
// @Router /v1/donwload/{gitoid} [post]
// @Router /v1/download/{gitoid} [post]
func (s *Server) Download(ctx context.Context, gitoid string) (io.ReadCloser, error) {
if len(strings.TrimSpace(gitoid)) == 0 {
return nil, errors.New("gitoid parameter is required")
Expand All @@ -185,7 +185,7 @@ func (s *Server) Download(ctx context.Context, gitoid string) (io.ReadCloser, er
// @Produce json
// @Success 200 {object} dsse.Envelope
// @Deprecated
// @Router /donwload/{gitoid} [post]
// @Router /download/{gitoid} [post]
func (s *Server) DownloadHandler(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodGet {
http.Error(w, fmt.Sprintf("%s is an unsupported method", r.Method), http.StatusBadRequest)
Expand Down

0 comments on commit 0a89fac

Please sign in to comment.