Skip to content

Commit

Permalink
stash
Browse files Browse the repository at this point in the history
  • Loading branch information
dadav committed Mar 2, 2024
1 parent aecce2c commit 12ae9ba
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion internal/api/v3/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package v3

import (
"context"
"encoding/base64"
"errors"
"net/http"
"net/url"
Expand Down Expand Up @@ -34,11 +35,40 @@ func (s *ReleaseOperationsApi) AddRelease(ctx context.Context, addReleaseRequest
// TODO - update AddRelease with the required logic for this service method.
// Add api_release_operations_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation.

base64EncodedTarball := addReleaseRequest.File

decodedTarball, err := base64.StdEncoding.DecodeString(base64EncodedTarball)
if err != nil {
return gen.Response(400, gen.GetFile400Response{
Message: "foo",
Errors: []string{"foo"},
}), nil
}

tmpTarball, err := os.CreateTemp("/tmp", "release-tarball-*")
if err != nil {
return gen.Response(400, gen.GetFile400Response{
Message: "foo",
Errors: []string{"foo"},
}), nil
}

_, err = tmpTarball.Write(decodedTarball)
if err != nil {
return gen.Response(400, gen.GetFile400Response{
Message: "foo",
Errors: []string{"foo"},
}), nil
}

// Step 2: Extract metadata of module
// Step 3: Check if data is valid and release does not exist yet
// Step 4: Moved release to correct location

// TODO: Uncomment the next line to return response Response(201, ReleaseMinimal{}) or use other options such as http.Ok ...
// return Response(201, ReleaseMinimal{}), nil

// TODO: Uncomment the next line to return response Response(400, GetFile400Response{}) or use other options such as http.Ok ...
// return Response(400, GetFile400Response{}), nil

// TODO: Uncomment the next line to return response Response(401, GetUserSearchFilters401Response{}) or use other options such as http.Ok ...
// return Response(401, GetUserSearchFilters401Response{}), nil
Expand Down

0 comments on commit 12ae9ba

Please sign in to comment.