nodes: 0, module; 1, function_definition; 2, function_name:get; 3, parameters; 4, block; 5, identifier:self; 6, identifier:slug; 7, expression_statement; 8, expression_statement; 9, comment:# check if is accessible from api; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expression_statement; 15, expression_statement; 16, expression_statement; 17, expression_statement; 18, expression_statement; 19, return_statement; 20, comment:"""Get list of mappings.
  
          Url parameters:
              - from: filter "mappings from"
              - to: filter "mappings to"
              - page
              - per_page
              - match_type: s=substring, e=exact, sw=startswith
              - sortby: 'from' or 'to'
          """; 21, assignment; 22, call; 23, assignment; 24, call; 25, call; 26, call; 27, call; 28, call; 29, call; 30, assignment; 31, call; 32, identifier:kb; 33, call; 34, identifier:check_knowledge_access; 35, argument_list; 36, identifier:parser; 37, call; 38, attribute; 39, argument_list; 40, attribute; 41, argument_list; 42, attribute; 43, argument_list; 44, attribute; 45, argument_list; 46, attribute; 47, argument_list; 48, attribute; 49, argument_list; 50, identifier:args; 51, call; 52, attribute; 53, argument_list; 54, attribute; 55, argument_list; 56, identifier:kb; 57, attribute; 58, argument_list; 59, identifier:parser; 60, identifier:add_argument; 61, string; 62, keyword_argument; 63, keyword_argument; 64, identifier:parser; 65, identifier:add_argument; 66, string; 67, keyword_argument; 68, keyword_argument; 69, identifier:parser; 70, identifier:add_argument; 71, string; 72, keyword_argument; 73, keyword_argument; 74, identifier:parser; 75, identifier:add_argument; 76, string; 77, keyword_argument; 78, keyword_argument; 79, identifier:parser; 80, identifier:add_argument; 81, string; 82, keyword_argument; 83, keyword_argument; 84, identifier:parser; 85, identifier:add_argument; 86, string; 87, keyword_argument; 88, keyword_argument; 89, attribute; 90, argument_list; 91, identifier:KnwKBMappingsResource; 92, line_continuation:\; 93, identifier:search_mappings; 94, identifier:kb; 95, subscript; 96, subscript; 97, subscript; 98, subscript; 99, subscript; 100, subscript; 101, identifier:api; 102, identifier:get_kb_by_slug; 103, identifier:slug; 104, identifier:reqparse; 105, identifier:RequestParser; 106, string_content:from; 107, identifier:type; 108, identifier:str; 109, identifier:help; 110, string:"Return only entries where 'from' matches this."; 111, string_content:to; 112, identifier:type; 113, identifier:str; 114, identifier:help; 115, string:"Return only entries where 'to' matches this."; 116, string_content:page; 117, identifier:type; 118, identifier:int; 119, identifier:help; 120, string:"Require a specific page"; 121, string_content:per_page; 122, identifier:type; 123, identifier:int; 124, identifier:help; 125, string:"Set how much result per page"; 126, string_content:match_type; 127, identifier:type; 128, identifier:str; 129, identifier:help; 130, string:"s=substring, e=exact, sw=startswith"; 131, string_content:sortby; 132, identifier:type; 133, identifier:str; 134, identifier:help; 135, string:"the sorting criteria ('from' or 'to')"; 136, identifier:parser; 137, identifier:parse_args; 138, identifier:args; 139, string; 140, identifier:args; 141, string; 142, identifier:args; 143, string; 144, identifier:args; 145, string; 146, identifier:args; 147, string; 148, identifier:args; 149, string; 150, string_content:from; 151, string_content:to; 152, string_content:match_type; 153, string_content:sortby; 154, string_content:page; 155, string_content:per_page
code: def get(self, slug):
          """Get list of mappings.
  
          Url parameters:
              - from: filter "mappings from"
              - to: filter "mappings to"
              - page
              - per_page
              - match_type: s=substring, e=exact, sw=startswith
              - sortby: 'from' or 'to'
          """
          kb = api.get_kb_by_slug(slug)
  
          # check if is accessible from api
          check_knowledge_access(kb)
  
          parser = reqparse.RequestParser()
          parser.add_argument(
              'from', type=str,
              help="Return only entries where 'from' matches this.")
          parser.add_argument(
              'to', type=str,
              help="Return only entries where 'to' matches this.")
          parser.add_argument('page', type=int,
                              help="Require a specific page")
          parser.add_argument('per_page', type=int,
                              help="Set how much result per page")
          parser.add_argument('match_type', type=str,
                              help="s=substring, e=exact, sw=startswith")
          parser.add_argument('sortby', type=str,
                              help="the sorting criteria ('from' or 'to')")
          args = parser.parse_args()
          return KnwKBMappingsResource \
              .search_mappings(kb, args['from'], args['to'],
                               args['match_type'], args['sortby'],
                               args['page'], args['per_page'])