def thread_query_api(): g.parser.add_argument('subject', type=bounded_str, location='args') g.parser.add_argument('to', type=bounded_str, location='args') g.parser.add_argument('from', type=bounded_str, location='args') g.parser.add_argument('cc', type=bounded_str, location='args') g.parser.add_argument('bcc', type=bounded_str, location='args') g.parser.add_argument('any_email', type=bounded_str, location='args') g.parser.add_argument('started_before', type=timestamp, location='args') g.parser.add_argument('started_after', type=timestamp, location='args') g.parser.add_argument('last_message_before', type=timestamp, location='args') g.parser.add_argument('last_message_after', type=timestamp, location='args') g.parser.add_argument('filename', type=bounded_str, location='args') g.parser.add_argument('in', type=bounded_str, location='args') g.parser.add_argument('thread_id', type=valid_public_id, location='args') g.parser.add_argument('unread', type=strict_bool, location='args') g.parser.add_argument('starred', type=strict_bool, location='args') g.parser.add_argument('view', type=view, location='args') # For backwards-compatibility -- remove after deprecating tags API. g.parser.add_argument('tag', type=bounded_str, location='args') args = strict_parse_args(g.parser, request.args) # For backwards-compatibility -- remove after deprecating tags API. in_ = args['in'] or args['tag'] threads = filtering.threads( namespace_id=g.namespace.id, subject=args['subject'], thread_public_id=args['thread_id'], to_addr=args['to'], from_addr=args['from'], cc_addr=args['cc'], bcc_addr=args['bcc'], any_email=args['any_email'], started_before=args['started_before'], started_after=args['started_after'], last_message_before=args['last_message_before'], last_message_after=args['last_message_after'], filename=args['filename'], unread=args['unread'], starred=args['starred'], in_=in_, limit=args['limit'], offset=args['offset'], view=args['view'], db_session=g.db_session) # Use a new encoder object with the expand parameter set. encoder = APIEncoder(g.namespace.public_id, args['view'] == 'expanded') return encoder.jsonify(threads)
def thread_query_api(): g.parser.add_argument('subject', type=bounded_str, location='args') g.parser.add_argument('to', type=bounded_str, location='args') g.parser.add_argument('from', type=bounded_str, location='args') g.parser.add_argument('cc', type=bounded_str, location='args') g.parser.add_argument('bcc', type=bounded_str, location='args') g.parser.add_argument('any_email', type=bounded_str, location='args') g.parser.add_argument('started_before', type=timestamp, location='args') g.parser.add_argument('started_after', type=timestamp, location='args') g.parser.add_argument('last_message_before', type=timestamp, location='args') g.parser.add_argument('last_message_after', type=timestamp, location='args') g.parser.add_argument('filename', type=bounded_str, location='args') g.parser.add_argument('thread_id', type=valid_public_id, location='args') g.parser.add_argument('tag', type=bounded_str, location='args') g.parser.add_argument('view', type=view, location='args') args = strict_parse_args(g.parser, request.args) threads = filtering.threads( namespace_id=g.namespace.id, subject=args['subject'], thread_public_id=args['thread_id'], to_addr=args['to'], from_addr=args['from'], cc_addr=args['cc'], bcc_addr=args['bcc'], any_email=args['any_email'], started_before=args['started_before'], started_after=args['started_after'], last_message_before=args['last_message_before'], last_message_after=args['last_message_after'], filename=args['filename'], tag=args['tag'], limit=args['limit'], offset=args['offset'], view=args['view'], db_session=g.db_session) return g.encoder.jsonify(threads)
def thread_query_api(): g.parser.add_argument("subject", type=bounded_str, location="args") g.parser.add_argument("to", type=bounded_str, location="args") g.parser.add_argument("from", type=bounded_str, location="args") g.parser.add_argument("cc", type=bounded_str, location="args") g.parser.add_argument("bcc", type=bounded_str, location="args") g.parser.add_argument("any_email", type=bounded_str, location="args") g.parser.add_argument("started_before", type=timestamp, location="args") g.parser.add_argument("started_after", type=timestamp, location="args") g.parser.add_argument("last_message_before", type=timestamp, location="args") g.parser.add_argument("last_message_after", type=timestamp, location="args") g.parser.add_argument("filename", type=bounded_str, location="args") g.parser.add_argument("thread", type=valid_public_id, location="args") g.parser.add_argument("tag", type=bounded_str, location="args") args = strict_parse_args(g.parser, request.args) threads = filtering.threads( namespace_id=g.namespace.id, subject=args["subject"], thread_public_id=args["thread"], to_addr=args["to"], from_addr=args["from"], cc_addr=args["cc"], bcc_addr=args["bcc"], any_email=args["any_email"], started_before=args["started_before"], started_after=args["started_after"], last_message_before=args["last_message_before"], last_message_after=args["last_message_after"], filename=args["filename"], tag=args["tag"], limit=args["limit"], offset=args["offset"], db_session=g.db_session, ) return g.encoder.jsonify(threads)