Skip to content

Commit

Permalink
Merge pull request #31 from amazeeio/fixes
Browse files Browse the repository at this point in the history
Fixes
  • Loading branch information
shreddedbacon authored Nov 25, 2019
2 parents 87448b0 + 0d62582 commit 56dafb1
Show file tree
Hide file tree
Showing 8 changed files with 139 additions and 3 deletions.
17 changes: 17 additions & 0 deletions api/backups.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package api

import (
"encoding/json"
"errors"

"github.com/machinebox/graphql"
)

Expand Down Expand Up @@ -29,6 +31,9 @@ func (api *Interface) AddBackup(backup AddBackup) ([]byte, error) {
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand All @@ -50,6 +55,9 @@ func (api *Interface) DeleteBackup(backup DeleteBackup) ([]byte, error) {
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand All @@ -74,6 +82,9 @@ func (api *Interface) UpdateRestore(update UpdateRestore) ([]byte, error) {
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand Down Expand Up @@ -102,6 +113,9 @@ func (api *Interface) GetAllEnvironmentBackups() ([]byte, error) {
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand Down Expand Up @@ -134,5 +148,8 @@ func (api *Interface) GetEnvironmentBackups(backups EnvironmentBackups) ([]byte,
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}
17 changes: 17 additions & 0 deletions api/environments.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package api

import (
"encoding/json"
"errors"

"github.com/machinebox/graphql"
)

Expand All @@ -26,6 +28,9 @@ func (api *Interface) GetEnvironmentByName(environment EnvironmentByName, fragme
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand Down Expand Up @@ -76,6 +81,9 @@ func (api *Interface) AddOrUpdateEnvironment(environment AddUpdateEnvironment) (
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand All @@ -101,6 +109,9 @@ func (api *Interface) UpdateEnvironment(environment UpdateEnvironment) ([]byte,
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand All @@ -124,6 +135,9 @@ func (api *Interface) DeleteEnvironment(environment DeleteEnvironment) ([]byte,
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand All @@ -149,5 +163,8 @@ func (api *Interface) SetEnvironmentServices(environment SetEnvironmentServices)
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}
26 changes: 26 additions & 0 deletions api/groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package api

import (
"encoding/json"
"errors"

"github.com/machinebox/graphql"
)

Expand All @@ -25,6 +27,9 @@ func (api *Interface) AddGroup(group AddGroup) ([]byte, error) {
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand All @@ -50,6 +55,9 @@ func (api *Interface) AddGroupWithParent(group AddGroup) ([]byte, error) {
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand Down Expand Up @@ -77,6 +85,9 @@ func (api *Interface) UpdateGroup(group UpdateGroup) ([]byte, error) {
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand All @@ -100,6 +111,9 @@ func (api *Interface) DeleteGroup(group AddGroup) ([]byte, error) {
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand Down Expand Up @@ -127,6 +141,9 @@ func (api *Interface) AddUserToGroup(user AddUserToGroup) ([]byte, error) {
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand All @@ -151,6 +168,9 @@ func (api *Interface) AddGroupToProject(group ProjectToGroup) ([]byte, error) {
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand All @@ -175,6 +195,9 @@ func (api *Interface) RemoveGroupFromProject(group ProjectToGroup) ([]byte, erro
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand All @@ -200,5 +223,8 @@ func (api *Interface) RemoveUserFromGroup(user UserGroup) ([]byte, error) {
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}
50 changes: 50 additions & 0 deletions api/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package api

import (
"encoding/json"
"errors"

"github.com/machinebox/graphql"
)

Expand Down Expand Up @@ -40,6 +42,9 @@ func (api *Interface) GetOpenShiftInfoForProject(project Project) ([]byte, error
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand Down Expand Up @@ -70,6 +75,9 @@ func (api *Interface) AddProject(project ProjectPatch, fragment string) ([]byte,
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand Down Expand Up @@ -97,6 +105,9 @@ func (api *Interface) UpdateProject(project UpdateProject, fragment string) ([]b
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand All @@ -118,6 +129,9 @@ func (api *Interface) DeleteProject(project Project) ([]byte, error) {
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand All @@ -139,6 +153,9 @@ func (api *Interface) GetProductionEnvironmentForProject(project Project) ([]byt
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand All @@ -164,6 +181,9 @@ func (api *Interface) GetEnvironmentByOpenshiftProjectName(environment Environme
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand Down Expand Up @@ -192,6 +212,9 @@ func (api *Interface) GetProjectsByGitURL(project Project) ([]byte, error) {
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand All @@ -216,6 +239,9 @@ func (api *Interface) GetProjectByName(project Project, fragment string) ([]byte
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand All @@ -239,6 +265,9 @@ func (api *Interface) GetAllProjects(fragment string) ([]byte, error) {
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand All @@ -265,6 +294,9 @@ func (api *Interface) GetRocketChatInfoForProject(project Project, fragment stri
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand All @@ -291,6 +323,9 @@ func (api *Interface) GetSlackInfoForProject(project Project, fragment string) (
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand All @@ -315,6 +350,9 @@ func (api *Interface) GetActiveSystemForProject(project Project, task string) ([
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand All @@ -338,6 +376,9 @@ func (api *Interface) GetEnvironmentsForProject(project Project) ([]byte, error)
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand All @@ -359,6 +400,9 @@ func (api *Interface) GetDeploymentByRemoteID(deployment Deployment) ([]byte, er
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand Down Expand Up @@ -389,6 +433,9 @@ func (api *Interface) AddDeployment(deployment Deployment) ([]byte, error) {
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}

Expand All @@ -413,5 +460,8 @@ func (api *Interface) UpdateDeployment(deployment UpdateDeployment) ([]byte, err
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}
5 changes: 5 additions & 0 deletions api/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package api

import (
"encoding/json"
"errors"

"github.com/machinebox/graphql"
)

Expand All @@ -26,5 +28,8 @@ func (api *Interface) UpdateTask(task UpdateTask) ([]byte, error) {
if err != nil {
return []byte(""), err
}
if string(jsonBytes) == "null" {
return []byte(""), errors.New("graphql: returned null")
}
return jsonBytes, nil
}
Loading

0 comments on commit 56dafb1

Please sign in to comment.