-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3603 from ActiveState/DX-3162
Unify graphQL client code
- Loading branch information
Showing
9 changed files
with
441 additions
and
456 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package gqlclient | ||
|
||
type TestRequest struct { | ||
q string | ||
vars map[string]interface{} | ||
headers map[string][]string | ||
} | ||
|
||
func NewTestRequest(q string) *TestRequest { | ||
return &TestRequest{ | ||
q: q, | ||
vars: make(map[string]interface{}), | ||
headers: make(map[string][]string), | ||
} | ||
} | ||
|
||
func (r *TestRequest) Query() string { | ||
return r.q | ||
} | ||
|
||
func (r *TestRequest) Vars() (map[string]interface{}, error) { | ||
return r.vars, nil | ||
} | ||
|
||
func (r *TestRequest) Headers() map[string][]string { | ||
return r.headers | ||
} | ||
|
||
type TestRequestWithFiles struct { | ||
*TestRequest | ||
files []File | ||
} | ||
|
||
func NewTestRequestWithFiles(q string) *TestRequestWithFiles { | ||
return &TestRequestWithFiles{ | ||
TestRequest: NewTestRequest(q), | ||
files: make([]File, 0), | ||
} | ||
} | ||
|
||
func (r *TestRequestWithFiles) Files() []File { | ||
return r.files | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.