Skip to content

Commit 9f51bdb

Browse files
authored
Merge pull request #59 from ricekot/update-graphql
Update GraphQL API
2 parents 3da7c88 + f50d945 commit 9f51bdb

File tree

2 files changed

+92
-1
lines changed

2 files changed

+92
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
55

66
## [Unreleased]
7-
7+
### Changed
8+
- Update APIs from GraphQL add-on.
89

910
## [0.0.17] - 2020-10-14
1011
### Added

src/zapv2/graphql.py

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,54 @@ class graphql(object):
2727
def __init__(self, zap):
2828
self.zap = zap
2929

30+
@property
31+
def option_args_type(self):
32+
"""
33+
Returns how arguments are currently specified.
34+
This component is optional and therefore the API will only work if it is installed
35+
"""
36+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'graphql/view/optionArgsType/')))
37+
38+
@property
39+
def option_max_args_depth(self):
40+
"""
41+
Returns the current maximum arguments generation depth.
42+
This component is optional and therefore the API will only work if it is installed
43+
"""
44+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'graphql/view/optionMaxArgsDepth/')))
45+
46+
@property
47+
def option_max_query_depth(self):
48+
"""
49+
Returns the current maximum query generation depth.
50+
This component is optional and therefore the API will only work if it is installed
51+
"""
52+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'graphql/view/optionMaxQueryDepth/')))
53+
54+
@property
55+
def option_optional_args_enabled(self):
56+
"""
57+
Returns whether or not optional arguments are currently specified.
58+
This component is optional and therefore the API will only work if it is installed
59+
"""
60+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'graphql/view/optionOptionalArgsEnabled/')))
61+
62+
@property
63+
def option_query_split_type(self):
64+
"""
65+
Returns the current level for which a single query is generated.
66+
This component is optional and therefore the API will only work if it is installed
67+
"""
68+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'graphql/view/optionQuerySplitType/')))
69+
70+
@property
71+
def option_request_method(self):
72+
"""
73+
Returns the current request method.
74+
This component is optional and therefore the API will only work if it is installed
75+
"""
76+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'graphql/view/optionRequestMethod/')))
77+
3078
def import_file(self, endurl, file, apikey=''):
3179
"""
3280
Imports a GraphQL Schema from a File.
@@ -43,3 +91,45 @@ def import_url(self, endurl, url=None, apikey=''):
4391
if url is not None:
4492
params['url'] = url
4593
return six.next(six.itervalues(self.zap._request(self.zap.base + 'graphql/action/importUrl/', params)))
94+
95+
def set_option_args_type(self, string, apikey=''):
96+
"""
97+
Sets how arguments are specified.
98+
This component is optional and therefore the API will only work if it is installed
99+
"""
100+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'graphql/action/setOptionArgsType/', {'String': string, 'apikey': apikey})))
101+
102+
def set_option_query_split_type(self, string, apikey=''):
103+
"""
104+
Sets the level for which a single query is generated.
105+
This component is optional and therefore the API will only work if it is installed
106+
"""
107+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'graphql/action/setOptionQuerySplitType/', {'String': string, 'apikey': apikey})))
108+
109+
def set_option_request_method(self, string, apikey=''):
110+
"""
111+
Sets the request method.
112+
This component is optional and therefore the API will only work if it is installed
113+
"""
114+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'graphql/action/setOptionRequestMethod/', {'String': string, 'apikey': apikey})))
115+
116+
def set_option_max_args_depth(self, integer, apikey=''):
117+
"""
118+
Sets the maximum arguments generation depth.
119+
This component is optional and therefore the API will only work if it is installed
120+
"""
121+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'graphql/action/setOptionMaxArgsDepth/', {'Integer': integer, 'apikey': apikey})))
122+
123+
def set_option_max_query_depth(self, integer, apikey=''):
124+
"""
125+
Sets the maximum query generation depth.
126+
This component is optional and therefore the API will only work if it is installed
127+
"""
128+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'graphql/action/setOptionMaxQueryDepth/', {'Integer': integer, 'apikey': apikey})))
129+
130+
def set_option_optional_args_enabled(self, boolean, apikey=''):
131+
"""
132+
Sets whether or not Optional Arguments should be specified.
133+
This component is optional and therefore the API will only work if it is installed
134+
"""
135+
return six.next(six.itervalues(self.zap._request(self.zap.base + 'graphql/action/setOptionOptionalArgsEnabled/', {'Boolean': boolean, 'apikey': apikey})))

0 commit comments

Comments
 (0)