# name: determines the name of the form. It should follow the guidelines of a name
# string, optional
name: Calculate score

# type: Determines the type of service task.
# string, follows the rules of an identifier
type: httpRequest

# retries: Number of times to retry
# optional, number
retries: 3

# PROPERTIES SPECIFIC TO "httpRequest" service task

# method: Defines the method to use
# string, required. Can be any of GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD
method: POST

# url: The URL
# string, required
url: http://example.com/myEndpoint/{{candidate.email}}

# query: Key/Value pairs for the query string
# object, optional
query:

  # the key of this object can be any text
  # the value can be any:
  # - text
  # - field - {{candidate.id}}
  # - variable - {{_vars.initiator.email}}
  # - secret - {{_secrets.mySecret}}
  # - a mix of them
  a: any text
  b: "{{text_candidate.uuid_id}}"
  d: "{{_secrets.mySecret}}"
  e: "{{_vars.initiator.id}}"
  f: A mix of anything {{_vars.initiator.email}} {{_secrets.abc}}

# headers: key/value pairs of the headers to be sent to the request
# object, optional
headers:

  # the key of this object can be any text
  # the value can be any text, field, variable, secret or a mix of them
  Authorization: Bearer {{_secrets.myToken}} {{text_candidate.uuid_id}}

# Body: The body to be sent in the HTTP Request.
# optional, can be either:
# - a string
# - an object
#
# if body is a string, it can be multiline, and can include any fields, variables, secrets.
# body: this is the body to be sent {{candidate.id}}
#
# if body is an object, the object properties will be sent as form data
body:

  myKey: myValue
  anotherKey: "{{_secrets.mySecret}} {{text_candidate.uuid_id}}"

# mapping: Configures how the result will be processed
# object, optional
mapping:

  _vars.response: "{{body}}"
  table_candidate.text_score: "{{body.data.score}}"
  _vars.statusCode: "{{statusCode}}"
  _vars.expireDate: "{{headers.expires}}"
