MCPcopy Create free account
hub / github.com/googleapis/google-api-python-client / ResourceMethodParameters

Class ResourceMethodParameters

googleapiclient/discovery.py:986–1073  ·  view source on GitHub ↗

Represents the parameters associated with a method. Attributes: argmap: Map from method parameter name (string) to query parameter name (string). required_params: List of required parameters (represented by parameter name as string). repeated_params: List o

Source from the content-addressed store, hash-verified

984
985# TODO(dhermes): Convert this class to ResourceMethod and make it callable
986class ResourceMethodParameters(object):
987 """Represents the parameters associated with a method.
988
989 Attributes:
990 argmap: Map from method parameter name (string) to query parameter name
991 (string).
992 required_params: List of required parameters (represented by parameter
993 name as string).
994 repeated_params: List of repeated parameters (represented by parameter
995 name as string).
996 pattern_params: Map from method parameter name (string) to regular
997 expression (as a string). If the pattern is set for a parameter, the
998 value for that parameter must match the regular expression.
999 query_params: List of parameters (represented by parameter name as string)
1000 that will be used in the query string.
1001 path_params: Set of parameters (represented by parameter name as string)
1002 that will be used in the base URL path.
1003 param_types: Map from method parameter name (string) to parameter type. Type
1004 can be any valid JSON schema type; valid values are 'any', 'array',
1005 'boolean', 'integer', 'number', 'object', or 'string'. Reference:
1006 http://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.1
1007 enum_params: Map from method parameter name (string) to list of strings,
1008 where each list of strings is the list of acceptable enum values.
1009 """
1010
1011 def __init__(self, method_desc):
1012 """Constructor for ResourceMethodParameters.
1013
1014 Sets default values and defers to set_parameters to populate.
1015
1016 Args:
1017 method_desc: Dictionary with metadata describing an API method. Value
1018 comes from the dictionary of methods stored in the 'methods' key in
1019 the deserialized discovery document.
1020 """
1021 self.argmap = {}
1022 self.required_params = []
1023 self.repeated_params = []
1024 self.pattern_params = {}
1025 self.query_params = []
1026 # TODO(dhermes): Change path_params to a list if the extra URITEMPLATE
1027 # parsing is gotten rid of.
1028 self.path_params = set()
1029 self.param_types = {}
1030 self.enum_params = {}
1031
1032 self.set_parameters(method_desc)
1033
1034 def set_parameters(self, method_desc):
1035 """Populates maps and lists based on method description.
1036
1037 Iterates through each parameter for the method and parses the values from
1038 the parameter dictionary.
1039
1040 Args:
1041 method_desc: Dictionary with metadata describing an API method. Value
1042 comes from the dictionary of methods stored in the 'methods' key in
1043 the deserialized discovery document.

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…