This repository was archived by the owner on Jan 26, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change
1
+ """Validate parameter values for the Gitcoin API client."""
1
2
2
3
# Valid parameter values as seen at
3
4
# https://github.com/gitcoinco/web/blob/84babc30611c281c817582b4d677dda6366def83/app/dashboard/models.py#L119-L168
25
26
}
26
27
27
28
def _validate_options (field_name , value ):
29
+ """Validate values for the given field name."""
28
30
if value in options [field_name ]:
29
31
return value
30
32
msg = 'Unknown value "{val}" for field "{name}".'
31
33
raise ValueError (msg .format (val = value , name = field_name ))
32
34
33
35
def experience_level (value ):
36
+ """Validate values for "experience_level"."""
34
37
return _validate_options ('experience_level' , value )
35
38
36
39
def project_length (value ):
40
+ """Validate values for "project_length"."""
37
41
return _validate_options ('project_length' , value )
38
42
39
43
def bounty_type (value ):
44
+ """Validate values for "bounty_type"."""
40
45
return _validate_options ('bounty_type' , value )
41
46
42
47
def idx_status (value ):
48
+ """Validate values for "idx_status"."""
43
49
return _validate_options ('idx_status' , value )
44
50
45
51
def order_by (direction ):
52
+ """Validate values for "order_by"."""
46
53
if direction in options ['order_by' ]:
47
54
return direction
48
55
if direction [0 :1 ] == '-' and direction [1 :] in options ['order_by' ]:
You can’t perform that action at this time.
0 commit comments