Example #1
0
 class _queuing_task:
     endpoint = doc.String(description="The endpoint name")
     endpoint_uid = doc.String(description="The endpoint uid")
     priority = doc.Integer()
     task = doc.String(description="The test name")
     task_id = doc.String(description="The task id")
     status = doc.String()
Example #2
0
class LockLog:
    type = doc.String("lock or unlock")
    ip = doc.String("Locked ip")
    current_ip_owner = doc.Integer("Locked user's id")
    operator = doc.Integer("User's id who issues lock")
    lock_until = doc.String("lock or unlock date YYYY-mm-DD HH:MM:SS")
    id = doc.String("MongoDb id")
Example #3
0
class SimpleView(HTTPMethodView):

    ex1 = {'11': int, '123': str}

    @doc.tag("test")
    @doc.consumes(doc.String(name="X-API-VERSION"),
                  location="header",
                  required=True)
    @doc.consumes(doc.String(name="name"), location="query")
    @doc.response(200, ex1, description='123aaa')
    def get(self, request):
        return text("I am get method")

    @doc.consumes(doc.JsonBody({
        "useranme":
        doc.String("The name of your user account."),
        "password":
        doc.String("The password of your user account."),
    }),
                  content_type="Application/json",
                  location="body")
    def post(self, request):
        return text("I am post method")

    def put(self, request):
        return text("I am put method")

    def patch(self, request):
        return text("I am patch method")

    def delete(self, request):
        return text("I am delete method")
Example #4
0
class Auth(HTTPMethodView):
    @doc.description('登录接口,所需参数有username,password')
    @doc.consumes(
        doc.JsonBody({
            "device_id": doc.String("456"),
            "password": doc.String("123"),
        }),
        location="body",
    )
    @doc.response(400, {"msg": str}, description="帐号密码输错了")
    @doc.response(500, {'msg': str}, description="程序出错,找后端查看日志")
    @doc.response(403, {'msg': str}, description="未登录")
    def post(self, req):
        try:
            device_id = req.json['device_id']
            login_user = get_user_by_device_id(device_id)
            if login_user is None or req.json['password'] != login_user[
                    'password']:
                return response.json({'msg': '帐号不存在或密码错误'}, status=400)
            # 默认无法序列化实体类,使用 dict 代替
            req.ctx.session['user'] = login_user
            return response.json(login_user)
        except Exception as e:
            print(e)
            return response.json({'msg': '服务器错误'}, status=500)
Example #5
0
def json_schema_obj2model_obj(agent, msg_type, obj):
    rv = {}
    # print('\n\n-- key: {}, obj {}'.format(k, ppjson(obj)))
    required = obj.get('required', [])
    if 'properties' in obj:
        for p in obj['properties']:
            if p == 'proxy-did':
                rv[p] = doc.String(description=p, required=proxy_did_required(agent, msg_type))
            elif obj['properties'][p]['type'] == 'string':
                rv[p] = doc.String(description=p, required=(p in required))
            elif obj['properties'][p]['type'] == 'integer':
                rv[p] = doc.Integer(description=p, required=(p in required))
            elif obj['properties'][p]['type'] == 'array':
                sample_items = []  # sanic_openapi 0.4.0 chokes on empty items
                if obj['properties'][p]['items']['type'] == 'string':
                    sample_items.append(doc.String(description=p, required=(p in required)))
                elif obj['properties'][p]['items']['type'] == 'integer':
                    sample_items.append(doc.Integer(description=p, required=(p in required)))
                elif obj['properties'][p]['items']['type'] == 'object':
                    sample_items.append({k: k for k in obj['properties'][p]['items']['properties']})
                else:
                    sample_items.append('sample')
                rv[p] = doc.List(description=p, items=sample_items, required=(p in required))
            elif obj['properties'][p]['type'] == 'object':
                rv[p] = json_schema_obj2model_obj(agent, msg_type, obj['properties'][p])
    else:
        rv = doc.Dictionary(description='', required=True)
    # print('\n-->> returning {}'.format(rv))
    return rv
Example #6
0
class ChatModel:
    id = doc.String('대화 오브젝트 id')
    type = doc.String()  # image, text
    question_id = doc.String()
    sender = doc.String()  # mentor, mentee
    message = doc.String()
    timestamp = doc.Integer()
Example #7
0
class FeedbackModel:
    id = doc.String('대화 오브젝트 id')
    question_id = doc.String()
    sender = doc.String()  # mentor, mentee
    user_id = doc.String()
    message = doc.String()
    timestamp = doc.Integer()
Example #8
0
class TeacherRequestModel:
    id = doc.String('선생님 리뷰 요청 오브젝트 id')
    question_id = doc.String()
    chat_id = doc.String()
    school = doc.String('학교 이름')
    message = doc.String('메세지')
    timestamp = doc.Integer()
Example #9
0
class VideoSearchRequest:
    search_str = doc.String()
    channel_link = doc.String()
    order_by = doc.String()
    offset = doc.Integer()
    limit = doc.Integer()
    favorites = Trinary()
Example #10
0
class ChannelModel:
    id = doc.Integer()
    url = doc.String()
    name = doc.String()
    match_regex = doc.String()
    link = doc.String()
    directory = doc.String()
Example #11
0
 class model:
     lock_id = doc.String("lock id")
     lock_type = doc.String("Lock type")
     ip = doc.Integer("ip")
     lock_date = doc.String("Ip's lock date")
     unlock_date = doc.String("Ip's unlock date")
     lock_by_user_id = doc.String("Locked by who")
Example #12
0
 class _test_suite:
     id = doc.String()
     test_suite = doc.String()
     path = doc.String()
     test_cases = doc.List(doc.String())
     variables = doc.JsonBody()
     author = doc.String()
Example #13
0
class TwitcastChannelModel:
    id = doc.String("Twitcaster user id")
    name = doc.String("Twitcaster channel name.")
    description = doc.String("The Channel Description.")
    thumbnail = doc.String("The Channel profile picture.")
    followerCount = doc.Integer("The channels followers count.")
    level = doc.Integer("The channels level.")
Example #14
0
 class endpoint(organization_team):
     endpoint_uid = doc.String(name='uid',
                               description='The endpoint\'s uid')
     tests = doc.List(doc.String(),
                      description='The tests that the endpoint supports')
     endpoint_name = doc.String()
     enable = doc.Boolean()  #default=False)
Example #15
0
class ListInput(Input):

    rule = {
        'per_page': doc.String(description='每页多少条',
                               default='20',
                               label='per_page'),
        'page': doc.String(description='第几页', default='1', label='page'),
    }
Example #16
0
 class _team:
     label = doc.String(description='The team name')
     owner = doc.String(description='The team owner\'s name')
     owner_email = doc.String(description='The team owner\'s email')
     organization_id = doc.String(
         description=
         'The ID of the organization that the team belongs to')
     value = doc.String(description='The team ID')
Example #17
0
class Card:
    nameOnCard = doc.String('The name on the card')
    cardNumber = doc.String('The number of the card')
    expirationMonth = doc.String('The expiration month of the card.')
    expirationYear = doc.String('The expiration year of the card.')
    securityCode = doc.String('The security code of the card.')
    billingAddress = doc.Object(
        Address, 'The billing address associated with the card.')
Example #18
0
class Person:
    id = doc.Integer("ID")
    username = doc.String("Username")
    email = doc.String("Email", required=False)
    phone = doc.String("Phone", required=False)
    sex = doc.String("Sex")
    zone = doc.String("Zone", required=False)
    create_datetime = doc.Integer("Created", required=False)
class Index:
    """
    Swagger documentation of a successful keys/index endpoint response.
    """

    oldest = doc.String(
        "The index of the oldest relevant TEK Chunk (no older than 14 days).")
    newest = doc.String("The index of the newest available TEK Chunk.")
Example #20
0
class YouTubeScheduleModel:
    id = doc.String("A youtube video ID")
    title = doc.String("The video title.")
    startTime = doc.Integer(
        "Scheduled stream start time in UTC.",
        choices=[int(datetime.now(pytz.timezone("UTC")).timestamp())],
    )
    channel = doc.String("YouTube Channel ID.")
Example #21
0
class TwitchChannelModel:
    id = doc.String("Twitch username")
    user_id = doc.String("Twitch user id.")
    name = doc.String("Twitch channel name.")
    description = doc.String("The Channel Description.")
    thumbnail = doc.String("The Channel profile picture.")
    followerCount = doc.Integer("The channels followers count.")
    viewCount = doc.Integer("The channels views count.")
Example #22
0
class TwitcastChannelModel:
    id = doc.String("Twitcaster user id")
    name = doc.String("Twitcaster channel name.")
    description = doc.String("The Channel Description.")
    thumbnail = doc.String("The Channel profile picture.")
    followerCount = doc.Integer("The channels followers count.")
    level = doc.Integer("The channels level.")
    platform = doc.String(description="(Ignore this)", choices=["twitcasting"])
Example #23
0
 class HTTP_Check:
     hostname = doc.String("URL or hostname of the website to check")
     redirects = doc.Boolean(
         "Enables/disables the following of redirects (301/302)")
     check_string = doc.Boolean(
         "Enables/disables searching for a specified text string on the page"
     )
     keywords = doc.String(
         "The string to search for if check_string is enabled")
Example #24
0
class TrainDoc:
    bot_id = doc.String(description="bot_id",
                        required=True,
                        name="bot_id",
                        choices=["rasa-demo"])
    sender_id = doc.String(description="sender_id",
                           required=True,
                           name="sender_id",
                           choices=["fjdsafjdsfjdsi"])
Example #25
0
class PublishDoc:
    bot_id = doc.String(description="bot_id",
                        required=True,
                        name="bot_id",
                        choices=["rasa-demo"])
    mode = doc.String(description="mode",
                      required=True,
                      name="mode",
                      choices=["test", "product"])
Example #26
0
class ParseDoc:
    bot_id = doc.String(description="bot_id",
                        required=True,
                        name="bot_id",
                        choices=["rasa-demo"])
    question = doc.String(description="question",
                          required=True,
                          name="question",
                          choices=["hello", "bye"])
Example #27
0
class ItemPostRequest:
    brand = doc.String()
    name = doc.String(required=True)
    item_size = doc.Float(required=True)
    unit = doc.String(required=True)
    count = doc.Float(required=True)
    category = doc.String()
    subcategory = doc.String()
    expiration_date = doc.Date()
Example #28
0
class TwitcastLiveModel:
    id = doc.String("A twitcasting stream ID")
    title = doc.String("The stream title.")
    startTime = doc.Integer(
        "Scheduled stream start time in UTC.",
        choices=[int(datetime.now(pytz.timezone("UTC")).timestamp())],
    )
    channel = doc.String("Twitcaster channel ID.")
    webtype = doc.String(description="(Ignore this)", choices=["twitcasting"])
Example #29
0
class PayerCardPayment:
    amount = doc.String("The amount of the payment")
    currency = doc.String('The currency of the payment')
    card = doc.Object(Card, 'Card object that will be used')
    payer = doc.Object(Payer, 'Payer Object', required=False)
    payerId = doc.String('Payer id if already exist', required=False)
    accountKey = doc.String('The key of the account to send the funds to',
                            required=False)
    description = doc.String('A short description of the payment.')
Example #30
0
class PayerBankPayment:
    amount = doc.String("The amount of the payment")
    currency = doc.String('The currency of the payment')
    bank = doc.Object(Bank, 'The bank object to use for the bank payment')
    payer = doc.Object(Payer, 'Payer Object', required=False)
    payerId = doc.String('Payer id if already exist', required=False)
    accountKey = doc.String('The key of the account to send the funds to',
                            required=False)
    description = doc.String('A short description of the payment.')