1.1.5 • Published 1 year ago

form-service-api v1.1.5

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

API endpoints for FormService ※ choose operator here: '>', '>=', '<', '<=', '=', 'contains';

  1. Form

1.1. post

  • Endpoint: FormService.post(data, form_type)
  • Params: #data:
    type:json, value: { target_field:'', data:{...} } ex:{ target_field: '$.Computer.Dell', data: { name: 'Dell', detail: { price: 10000, color: 'red', } }, }, #form_type: type: String, value:'form'
  • Description: Store form data on the blockchain.

1.2. getAll

  • Endpoint: FormService.getAll(form_type)
  • Params: #form_type: type:String, value:'form'
  • Return: Array of Object
  • Description: Return all form data stored on the blockchain.

1.3. getOne

  • Endpoint: FormService.getOne(target_field, form_type)
  • Params: #target_field: type:String, value:"" ex:'$.Computer.Hp' #form_type: type:'form'
  • Return: Object
  • Description: Return certain form data according to target_field on the blockchain

1.4. getMany

1.5. putOne

1.6. putMany

1.7. deleteOne

  • Endpoint: FormService.putMany(target_field, form_type)
  • Params: #target_field: type: String, value:'' ex:'$.Computer.Dell'

    #form_type: type:String, value:'form'

  • Return: True / False

  • Description: Delete certain form data according to target_field on the blockchain

1.8. deleteMany

1.9. deleteAll

  • Endpoint: FormService.deleteAll(form_type)
  • Params: #form_type: type:String, value:'form'
  • Return: True / False
  • Description: Delete all form data on the blockchain
  1. Function

2.1. post

  • Endpoint: FormService.post(data, form_type)
  • Params: #data: type:json, value:{ name:'', data:{ category:'', library:'', name:'', params:[], return_type:'' } } ex: { name: 'function2', data: { category: 'Logistics', library: 'Standard', name: 'Greater than', params: [ '20', { category: 'Math', library: 'Standard', name: 'Sum', params: '25', '30', return_type: 'numeric' }, ], return_type: 'numeric', } }, #form_type: type:String, value:'function'
  • Description: Store function on the blockchain

2.2. getOne

  • Endpoint: FormService.getOne(function_name, form_type)
  • Params: #function_name: type:String, value:'' ex:'function2' #form_type: type:String value:'function'
  • Return: Object
  • Description: Return a function according to given name on the blockchain

2.3. getAll

  • Endpoint: FormService.getAll(form_type)
  • Params: #form_type: type:String, value:'function'
  • Return: Array of Object
  • Description: Return all functions on the blockchain

2.4. putOne

  • Endpoint: FormService.putOne(data, form_type)
  • Params: #data: type:json, value:{ id: int, name:'', data:{ category:'', library:'', name:'', params:[], return_type:'' } } ex: {
    id:0, name: 'function3', data: { category: 'Logistics', library: 'Standard', name: 'Greater than', params: [ '20', { category: 'Math', library: 'Standard', name: 'Sum', params: '25', '30', return_type: 'numeric', }, ], return_type: 'numeric', }, }, #form_type: type:String, value:'function'
  • Return: True/False
  • Description: Update one function according to given name on the blockchain

2.5. deleteOne

  • Endpoint: FormService.deleteOne(function_name, form_type)
  • Params: #function_name: type:String, value:'' ex:'function3'

    #form_type: type:String, value:'function'

  • Return: True / False

  • Description: Delete one function according to given name on the blockchain

2.6. deleteAll

  • Endpoint: FormService.deleteAll(form_type)
  • Params: #form_type: type:String, value:'function'
  • Return: True / False
  • Description: Delete all functions on the blockchain

2.7. runFunction

  • Endpoint: FormService.runFunction(full_function)
  • Params: #full_function: type:String, value:'' ex:'SumOfPrices(10,20,30)'
  • Description: Calcualte function on the blockchain
  1. Rule

3.1. post

  • Endpoint: FormService.post(data, form_type)
  • Params: #data: type:json, value:{ name:'', condition:{ left:int, operator:'', right:{ category:'', library:'', name:'', params:[], return_type:'' }/int }, actions:[ { action_type:'', target_field:'', filter:{}/{key:'', operator:'', value:''} data:{key:'', value:''} },.... ] } ex: { name: 'rule_1', condition: { left: 100, operator: '>', right: { category: 'Math', library: 'Standard', name: 'Sum', params: '20', '30', return_type: 'numeric', }, }, actions: [ { action_type: 'Put', target_field: '', filter: { key: 'price', operator: '>', value: 'SumOfPrices(10, 20, 400)', }, , data: {color: 'grey'}, }, ], }, #form_type: type:String, value:'rule'
  • Description: Store a JSON data for rule on the blockchain.

3.2. getAll

  • Endpoint: FormService.getAll(form_type)
  • Params: #form_type: type:String, value:'rule'
  • Return: Array of Object
  • Description: Return all rules on the blockchain

3.3. getOne

  • Endpoint: FormService.getOne(rule_name, form_type)
  • Params: #rule_name: type:String, value:'' ex:'rule_1' #form_type: type:String, value:'rule'
  • Return: Object
  • Description: Return one rule according to given name on the blockchain

3.4. putOne

  • Endpoint: FormService.putOne(data, form_type)
  • Params: #data: type:json, value:{
    id:int, name:'', condition:{ left:int, operator:'', right:{ category:'', library:'', name:'', params:[], return_type:'' }/int }, actions:[ { action_type:'', target_field:'', filter:{}/{key:'', operator:'', value:''} data:{key:'', value:''}
                           },{...}
                       ]
           }
           ex:  {
                   name: 'rule_1',
                   condition: {
                   left: 100,
                   operator: '>',
                   right: {
                       category: 'Math',
                       library: 'Standard',
                       name: 'Sum',
                       params: ['20', '30'],
                       return_type: 'numeric',
                   },
                   },
                   actions: [
                   {
                       action_type: 'Put',
                       target_field: '',
                       filter: [
                       {
                           key: 'price',
                           operator: '>',
                           value: 'SumOfPrices(10, 20, 400)',
                       },
                       ],
                       data: {color: 'grey'},
                   },
                   ],
               },
    #form_type: type:String, value:'rule'
  • Return: True/False
  • Description: Update certain rule according to given id on the blockchain

3.5. deleteOne

  • Endpoint: FormService.deleteOne(rule_name, form_type)
  • Params: #rule_name: type:String, value:'', ex:'rule_1' #form_type: type:String, value:'rule'
  • Return: True/False
  • Description: Delete certain rule according to given name on the blockchain

3.6. deleteAll

  • Endpoint: FormService.deleteAll(form_type)
  • Params: #form_type: type:String, value:'rule'
  • Return: True / False
  • Description: Delete all rules on the blockchain

3.7 runRule

  • Endpoint: FormService.runRule(id)
  • Params: #id: type:int, value: ex:0, 1...
  • Description: Run rule and invokes all actions according to id on the blockchain
1.1.5

1 year ago