refactor(projects): move rest api call directly into run command module

This commit is contained in:
Mahyar Mirrashed
2025-03-13 16:36:41 -07:00
parent 81d5f639ae
commit 08732cab62
2 changed files with 7 additions and 20 deletions

View File

@@ -6,6 +6,8 @@ package cmd
import (
"errors"
"fmt"
"github.com/Infisical/infisical-merge/packages/api"
"github.com/go-resty/resty/v2"
"os"
"os/exec"
"os/signal"
@@ -480,7 +482,11 @@ func confirmProjectHasEnvironment(environmentSlug, projectId string, token *mode
projectId = workspaceFile.WorkspaceId
}
project, err := util.GetProjectDetails(accessToken, projectId)
httpClient := resty.New()
httpClient.SetAuthToken(accessToken).
SetHeader("Accept", "application/json")
project, err := api.CallGetProjectById(httpClient, projectId)
if err != nil {
return false, err
}

View File

@@ -1,19 +0,0 @@
package util
import (
"github.com/Infisical/infisical-merge/packages/api"
"github.com/go-resty/resty/v2"
)
func GetProjectDetails(accessToken string, projectId string) (api.Project, error) {
httpClient := resty.New()
httpClient.SetAuthToken(accessToken).
SetHeader("Accept", "application/json")
res, err := api.CallGetProjectById(httpClient, projectId)
if err != nil {
return api.Project{}, err
}
return res, nil
}