Esempio n. 1
0
 def __init__(self,
              response=WithChallengeClientResponse,
              children=None,
              **kwargs):
     super().__init__(
         **kwargs,
         description=('The result of a challenge-blocked method.'
                      ' Contains information relevant to the open challenge'
                      ' needed to complete the method execution.'),
         response=response,
         children=merge(
             {
                 with_challenge_constants.CHALLENGE_COMPLETE:
                 Schema(
                     description=
                     'A flag indicating whether the challenge is complete',
                     types=types.BOOLEAN(),
                 ),
                 with_challenge_constants.OPEN_CHALLENGE_ID:
                 Schema(
                     description='The ID of the open challenge',
                     types=types.UUID(),
                 ),
             },
             children,
         ),
     )
Esempio n. 2
0
 def __init__(self, Model, **kwargs):
     self.model = Model
     super().__init__(
         **kwargs,
         description=
         ('This method can be used to create an account on the system with the'
          ' specified public key. This account will be bound to the public key'
          ' from which the request or connection originates.'),
         client=StructureSchema(
             description=
             ('If successful, the create function will return an acknowledgement'
              ' of the created account and a disclaimer.'),
             children={
                 create_constants.DISCLAIMER:
                 Schema(description=(
                     'The system disclaimer. This can also be found by accessing the System object.'
                 ), ),
                 create_constants.IP:
                 Schema(description=(
                     'The IP address used to create this account'), ),
                 create_constants.LONG_KEY_ID:
                 Schema(description=(
                     'The long key id of the GPG public key used to create this account'
                 ), ),
             }),
         children={
             account_fields.PUBLIC_KEY: AccountCreatePublicKeySchema(),
         })
Esempio n. 3
0
 def __init__(self, field, **kwargs):
     self.field = field
     super().__init__(**kwargs,
                      client=Schema(response=PropertyResponse),
                      children={
                          set_constants.NULL: Schema(types=types.BOOLEAN()),
                      })
Esempio n. 4
0
 def __init__(self, **kwargs):
     super().__init__(
         **kwargs,
         description=
         ('The schema for the Subscription create method.'
          ' This method can be run without arguments to create a challenge'
          ' originating from the method. When run with arguments, a duration'
          ' is required.'),
         origin=create_constants.ORIGIN,
         response=SubscriptionCreateResponse,
         children={
             subscription_fields.DURATION_IN_DAYS:
             Schema(
                 description=(
                     'The duration, measured in periods of 24 hours'
                     ' from the date of activation.'),
                 types=types.INTEGER(),
             ),
             subscription_fields.ACTIVATION_DATE:
             Schema(
                 description=
                 ('The activation date. This can be given as any valid date string.'
                  ' Once this date is passed, a process will run that verifies and activates'
                  ' the subscription. From this point, a request made from any IP address'
                  ' associated with the account will be responded to accordingly.'
                  ),
                 types=types.TIME(),
             ),
         },
     )
Esempio n. 5
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     self.children = {
         proxy_constants.ID: Schema(types=types.UUID()),
         proxy_constants.IP: Schema(),
         proxy_constants.CHANNEL: Schema(),
         proxy_constants.TRANSACTINO: Schema(types=types.ANY()),
     }
Esempio n. 6
0
 def __init__(self, **kwargs):
     super().__init__(
         **kwargs,
         response=FilterClientResponse,
         children={
             filter_constants.COUNT: Schema(types=types.INTEGER()),
             filter_constants.QUERY: Schema(),
         },
     )
Esempio n. 7
0
 def __init__(self, Model):
     self.model = Model
     super().__init__(
         origin=lock_constants.ORIGIN,
         response=AccountSuperadminLockResponse,
         children={
             lock_constants.LOCK: Schema(types=types.BOOLEAN()),
             lock_constants.ACCOUNT_ID: Schema(types=types.UUID()),
         },
     )
Esempio n. 8
0
 def __init__(self, Model):
     self.model = Model
     super().__init__(
         description=(
             'The schema for the TransactionReport create method.'),
         response=TransactionReportCreateResponse,
         origin=create_constants.ORIGIN,
         children={
             transaction_report_fields.IS_ACTIVE:
             Schema(
                 description=(
                     'Whether or not the report should be initially active.'
                 ),
                 types=types.BOOLEAN(),
             ),
             transaction_report_fields.TARGET_ADDRESS:
             Schema(
                 description=('The address to watch'),
                 types=types.STRING(),
             ),
             transaction_report_fields.VALUE_EQUAL_TO:
             Schema(
                 description=
                 ('A match will be recorded if the integer Satoshi amount'
                  ' of an output to the target address is equal to this value.'
                  ' WARNING: cannot be used in conjunction with the value_less_than'
                  ' or value_greater_than properties.'),
                 types=types.POSITIVE_INTEGER(),
             ),
             transaction_report_fields.VALUE_LESS_THAN:
             Schema(
                 description=
                 ('A match will be recorded if the integer Satoshi amount'
                  ' of an output to the target address is less than this value,'
                  ' depending on the value of the value_greater_than property.'
                  ' WARNING: cannot be used in conjunction with the value_equal_to'
                  ' property.'),
                 types=types.POSITIVE_INTEGER(),
             ),
             transaction_report_fields.VALUE_GREATER_THAN:
             Schema(
                 description=
                 ('A match will be recorded if the integer Satoshi amount'
                  ' of an output to the target address is greater than this value,'
                  ' depending on the value of the value_less_than property.'
                  ' WARNING: cannot be used in conjunction with the value_equal_to'
                  ' property.'),
                 types=types.POSITIVE_INTEGER(),
             ),
         },
     )
Esempio n. 9
0
 def __init__(self, Model, mode=None, **kwargs):
     self.model = Model
     super().__init__(
         **kwargs,
         response=InstanceRelationshipResponse,
         description='Relationships on the model instance',
         children={
             relationship_field.name: Schema(
                 description=(
                     relationship_field.verbose_name if hasattr(
                         relationship_field, 'verbose_name') else
                     relationship_field.get_related_field().verbose_name),
                 types=[
                     types.REF(
                         description=
                         'A database reference to a single other model instance'
                     ),
                     types.ARRAY(
                         description=
                         'An array of references to multiple other model instances'
                     ),
                     types.NULL(description='A null value'),
                 ],
             )
             for relationship_field in self.model.objects.relationships(
                 mode=mode)
         })
Esempio n. 10
0
 def __init__(self,
              response=WithPaymentClientResponse,
              children=None,
              **kwargs):
     super().__init__(
         **kwargs,
         response=response,
         children=merge(
             {
                 with_payment_constants.PAYMENT_COMPLETE:
                 Schema(types=types.BOOLEAN()),
                 with_payment_constants.OPEN_PAYMENT_ID:
                 Schema(types=types.UUID()),
             },
             children,
         ),
     )
Esempio n. 11
0
 def __init__(self, Model, mode=None, **kwargs):
     self.model = Model
     super().__init__(
         **kwargs,
         response=SetResponse,
         template=PrototypeSchema(Model, mode=mode),
         client=Schema(),
     )
Esempio n. 12
0
 def setUp(self):
     self.non_nullable_key = 'non-nullable-key'
     self.non_nullable = [self.non_nullable_key]
     self.value = 'value'
     self.schema = PropertySchema(children={
         self.non_nullable_key: Schema(),
     })
     self.schema.non_nullable = self.non_nullable
Esempio n. 13
0
 def __init__(self, relationship, **kwargs):
     super().__init__(
         **kwargs,
         client=Schema(response=PropertyResponse),
         children={
             set_constants.ADD: ManySchema(relationship),
             set_constants.REMOVE: ManySchema(relationship),
         },
     )
Esempio n. 14
0
 def setUp(self):
     self.test_key = 'test_key'
     self.schema = StructureSchema(children={
         self.test_key:
         Schema(
             types=types.UUID(),
             response=PropertyResponse,
         ),
     }, )
Esempio n. 15
0
 def setUp(self):
     self.key = 'key'
     self.value = 'value'
     self.schema = StructureSchema(
         response=PropertyResponse,
         children={
             self.key: Schema(),
         },
     )
Esempio n. 16
0
 def __init__(self, **kwargs):
     super().__init__(
         **kwargs,
         description=('The schema for the challenge result. Contains the'
                      ' outcome of the evaluation.'),
         children={
             respond_constants.CHALLENGE_ID:
             Schema(
                 description=
                 'The ID of the Challenge that is in the process of being verified',
                 types=types.UUID(),
             ),
             respond_constants.IS_VERIFIED:
             Schema(
                 description=
                 'A flag indicating whether the verification has been successful',
                 types=types.BOOLEAN(),
             ),
         },
     )
Esempio n. 17
0
 def __init__(self, **kwargs):
   super().__init__(
     **kwargs,
     description=(
       'The schema for the Payment get method.'
       ' It can be filtered by the open status of'
       ' the payment and the payment ID'
     ),
     response=PaymentGetResponse,
     children={
       get_constants.PAYMENT_ID: Schema(
         description='The payment ID',
         types=types.UUID(),
       ),
       payment_fields.IS_OPEN: Schema(
         description='The payment open status',
         types=types.BOOLEAN(),
       ),
     },
   )
Esempio n. 18
0
 def __init__(self, **kwargs):
     super().__init__(
         **kwargs,
         description=(
             'The schema for the Challenge respond method.'
             ' Processes a request based on the ID of the challenge,'
             ' returning the result of the challenge evaluation.'),
         client=ChallengeRespondClientSchema(),
         children={
             respond_constants.CHALLENGE_ID:
             Schema(
                 description='The ID of the challenge in question',
                 types=types.UUID(),
             ),
             respond_constants.CONTENT:
             Schema(description=(
                 'The decrypted text of the challenge,'
                 ' having been re-encrypted to the public'
                 ' key of the service and put into ascii armor format.'), ),
         },
     )
Esempio n. 19
0
 def __init__(self, Model, **kwargs):
     self.model = Model
     super().__init__(
         **kwargs,
         description=('The schema for the FeeReport activate method.'),
         response=FeeReportActivateResponse,
         origin=activate_constants.ORIGIN,
         children={
             activate_constants.FEE_REPORT_ID:
             Schema(
                 description='The ID of the FeeReport is question.',
                 types=types.UUID(),
             ),
             fee_report_fields.IS_ACTIVE:
             Schema(
                 description=('A boolean value that designates whether'
                              ' the report should be active.'),
                 types=types.BOOLEAN(),
             ),
         },
     )
Esempio n. 20
0
 def __init__(self, Model, **kwargs):
     self.model = Model
     super().__init__(
         **kwargs,
         description=('The schema for the FeeReport get method.'
                      ' Basic filters are available for the ID and'
                      ' active status of the FeeReport.'),
         response=FeeReportGetResponse,
         children={
             get_constants.FEE_REPORT_ID:
             Schema(
                 description='The ID of the FeeReport in question.',
                 types=types.UUID(),
             ),
             fee_report_fields.IS_ACTIVE:
             Schema(
                 description='The active status of the FeeReport.',
                 types=types.BOOLEAN(),
             ),
         },
     )
Esempio n. 21
0
 def __init__(self, **kwargs):
     super().__init__(
         **kwargs,
         description=('The schema for the Challenge delete method.'),
         children={
             delete_constants.CHALLENGE_ID:
             Schema(
                 description=('The challenge ID to delete'),
                 types=types.UUID(),
             ),
         },
     )
Esempio n. 22
0
 def __init__(self, **kwargs):
     super().__init__(
         **kwargs,
         description=('The schema for the Subscription get method.'
                      ' Filters can be applied for the active status'
                      ' and the ID of the subscription.'),
         response=SubscriptionGetResponse,
         children={
             get_constants.SUBSCRIPTION_ID:
             Schema(
                 description=('The subscription ID'),
                 types=types.UUID(),
             ),
             subscription_fields.IS_ACTIVE:
             Schema(
                 description=
                 ('The subscription active status. If omitted, all subscriptions'
                  ' are returned.'),
                 types=types.BOOLEAN(),
             ),
         },
     )
Esempio n. 23
0
 def __init__(self, Model, **kwargs):
     self.model = Model
     super().__init__(
         **kwargs,
         response=QueryResponse,
         children={
             filter_constants.KEY:
             Schema(
                 description='',
                 types=types.STRING(),
             ),
             filter_constants.VALUE:
             Schema(
                 description='',
                 types=types.STRING(),
             ),
             filter_constants.AND:
             ArraySchema(template=Schema(), ),
             filter_constants.OR:
             ArraySchema(template=Schema(), ),
         },
     )
Esempio n. 24
0
 def __init__(self, Model, mode=None, **kwargs):
     self.model = Model
     super().__init__(
         **kwargs,
         response=PrototypeResponse,
         client=Schema(types=types.BOOLEAN()),
         children={
             schema_constants.ATTRIBUTES:
             AttributesSchema(Model, mode=mode),
             schema_constants.RELATIONSHIPS:
             RelationshipsSchema(Model, mode=mode),
         },
     )
Esempio n. 25
0
 def __init__(self, **kwargs):
     super().__init__(
         **kwargs,
         description=('The schema for the Challenge get method.'
                      ' Returns instances of the Challenge class and'
                      ' includes a simple filter for the open status'
                      ' of each object.'),
         response=ChallengeGetResponse,
         children={
             get_constants.CHALLENGE_ID:
             Schema(
                 description=('The challenge ID'),
                 types=types.UUID(),
             ),
             challenge_fields.IS_OPEN:
             Schema(
                 description=('Filter the list of challenges'
                              ' by their open states.'),
                 types=types.BOOLEAN(),
             ),
         },
     )
Esempio n. 26
0
 def __init__(self, Model):
     self.model = Model
     super().__init__(description=('The schema for the IP create method.'),
                      origin=create_constants.ORIGIN,
                      response=IPCreateResponse,
                      client=IPCreateClientSchema(),
                      children={
                          ip_fields.VALUE:
                          Schema(
                              description=('Must be a valid IPv4 address.'),
                              types=types.IP_ADDRESS(),
                          ),
                      })
Esempio n. 27
0
 def __init__(self, Model, mode=None, **kwargs):
     self.model = Model
     self.mode = mode
     super().__init__(
         **kwargs,
         response=RelationshipResponse,
         children={
             relationship.name: Schema(
                 description='',
                 types=types.BOOLEAN(),
             )
             for relationship in Model.objects.relationships(mode=mode)
         },
     )
Esempio n. 28
0
 def __init__(self, Model, mode=None, **kwargs):
   self.model = Model
   self.mode = mode
   super().__init__(
     **kwargs,
     response=AttributeResponse,
     children={
       attribute.name: Schema(
         description='Attribute flag for {}'.format(attribute.name),
         types=types.BOOLEAN(),
       )
       for attribute in Model.objects.attributes(mode=mode)
     },
   )
Esempio n. 29
0
 def __init__(self, Model, **kwargs):
     self.model = Model
     super().__init__(
         **kwargs,
         description=('The schema for the Address get method.'),
         response=AddressGetResponse,
         children={
             get_constants.ADDRESS_ID:
             Schema(
                 description='The address ID',
                 types=types.UUID(),
             ),
         },
     )
Esempio n. 30
0
 def __init__(self, Model, **kwargs):
     self.model = Model
     super().__init__(
         **kwargs,
         description=('The schema for the FeeReport create method.'),
         response=FeeReportCreateResponse,
         origin=create_constants.ORIGIN,
         children={
             fee_report_fields.BLOCKS_TO_INCLUDE:
             Schema(
                 description=
                 ('The number of blocks over which to calculate the average.'
                  ' Defaults to 1 if omitted.'),
                 types=types.INTEGER(),
             ),
             fee_report_fields.IS_ACTIVE:
             Schema(
                 description=(
                     'Whether or not the report should be initially active.'
                     ' Defaults to true if omitted.'),
                 types=types.BOOLEAN(),
             ),
         },
     )