예제 #1
0
    def _build_field_name_map(self):
        # Here's how to get the field-to-name mapping from the issues resource...
        # The following is best, but it only shows the create screen types.
        #     issue_key = "issue/createmeta?projectKeys=JAMP&expand=projects.issuetypes.fields"
        #  To find all mappings in the system, use the 'search' mechanism, which might fail if the
        #  ...create screen or edit screen do not contain these fields.
        #      issue_key = "search?maxResults=1&expand=names"
        issue_key = "search?maxResults=1&expand=names"
        resource = Resource(issue_key,
                            options=self._options,
                            session=self._session)

        resource.find(
            None
        )  # 'find(None)' loads the resource, but doesn't return anything

        map = {}
        for key, value in resource.raw['names'].items():
            map[value] = key

        return map
예제 #2
0
    def __init__(self, options, session, raw=None):
        Resource.__init__(self, 'pokerng/{0}', options, session)
        if raw:
            self._parse_raw(raw)

        # Specify the API for the poker session.
        self._session.headers['content-type'] = 'application/json'
        options = self._options.copy()
        options.update({
            'rest_path':
            'pokerng',
            'rest_api_version':
            '1.0',
            # HACK: The `?withUserKeys=true` querystring is used only with `PUT` requests, but the Jira library does
            #  not allow adding custom data to the URL, so we're using this with all types of requests.
            #  It could be possible to avoid using this, but this API is undocumented and it would require some
            #  guessing how users should be passed within a request.
            'path':
            f'session/id/{self.sessionId}?withUserKeys=true',
        })
        # This attribute is used by the superclass for querying the API.
        self.self = self._base_url.format(**options)
예제 #3
0
 def _build_resource(self, resource_format):
     resource = Resource(resource_format,
                         options=self._options,
                         session=self._session)
     resource.find(None)  # Simply calling find() populates the Resource
     return resource
예제 #4
0
 def __init__(self, options, session, raw=None):
     options['agile_rest_path'] = 'teams-api'
     Resource.__init__(self, 'team/{0}', options, session, raw)
     if raw:
         self._parse_raw(raw)
예제 #5
0
 def __init__(self, options, session, raw=None):
     Resource.__init__(self, 'report/{0}', options, session)
     if raw:
         self._parse_raw(raw)