swagger: '2.0'
info:
  description: Gemalto TSH Transit Notification API
  termsOfService: Copyright (c) 2018 GEMALTO. All Rights Reserved
  title: Gemalto TSH Transit Notification API
  version: 1.0.20
schemes:
  - http
  - https
basePath: /tsh/ttnapi/1/0
consumes:
  - application/json
produces:
  - application/json
paths:
  /sendMessage:
    post:
      summary: Request to send a message to enduser device
      description: This method is used by TES to request TSH to send a message on the enduser device targeting a virtual card.
      operationId: sendMessage
      produces:
        - application/json
      parameters:
        - name: body
          in: body
          description: sendMessage request payload
          required: true
          schema:
            $ref: '#/definitions/sendMessageReq'
      responses:
        '200':
          description: sendMessage response payload
          schema:
            $ref: '#/definitions/sendMessageRes'
        '500':
          description: Internal Server Error
definitions:
  sendMessageReq:
    type: object
    required:
      - requestHeader
      - issuerId
      - cardId
      - messageDateTime
      - expirationDateTime
      - content
      - allowDeepLink
    properties:
      requestHeader:
        $ref: '#/definitions/requestHeader'
      issuerId:
        $ref: '#/definitions/issuerId'
      cardId:
        $ref: '#/definitions/cardId'
      messageDateTime:
        $ref: '#/definitions/messageDateTime'
      expirationDateTime:
        $ref: '#/definitions/expirationDateTime'
      content:
        $ref: '#/definitions/content'
      allowDeepLink:
        $ref: '#/definitions/allowDeepLink'
  sendMessageRes:
    type: object
    required:
      - responseHeader
    properties:
      responseHeader:
        $ref: '#/definitions/responseHeader'
  cardId:
    maxLength: 48
    minLength: 1
    type: string
    description: The Card Identifier. Unique for each card.
  messageDateTime:
    description: 'Date time representing when the message has been generated.<br/>RFC3339 format.<br/> Examples:<li>"2018-12-24T17:32:28Z"<li>"2019-10-02T10:00:00-05:00"'
    type: string
    format: date-time
  expirationDateTime:
    description: 'Date time representing when the message is no longer valid and should be removed.<br/>RFC3339 format.<br/> Examples:<li>"2018-12-24T17:32:28Z"<li>"2019-10-02T10:00:00-05:00"'
    type: string
    format: date-time
  content:
    description: Plain text message to be displayed to the user.
    type: string
    minLength: 1
    maxLength: 128
  allowDeepLink:
    description: A flag indicating if the message should "deep link" to the issuer's mobile application
    type: boolean
  issuerId:
    maxLength: 16
    minLength: 1
    type: string
    description: The Card Issuer Identifier. Unique for each card issuer.
  requestId:
    description: Unique request identifier
    maxLength: 48
    minLength: 1
    type: string
  responseId:
    description: Unique response identifier
    maxLength: 48
    minLength: 1
    type: string
  sessionId:
    description: Unique session identifier used to trace the calls across systems during a use case.
    maxLength: 48
    minLength: 1
    type: string
  requestHeader:
    type: object
    required:
      - requestId
      - sessionId
    properties:
      requestId:
        $ref: '#/definitions/requestId'
      sessionId:
        $ref: '#/definitions/sessionId'
      generationDateTime:
        $ref: '#/definitions/generationDateTime'
  generationDateTime:
    description: 'Date time representing when the request or response has been generated.<br/>RFC3339 format.<br/> Examples:<li>"2018-12-24T17:32:28Z"<li>"2019-10-02T10:00:00-05:00"'
    type: string
    format: date-time
  responseHeader:
    type: object
    required:
      - responseId
      - sessionId
      - statusCode
    properties:
      responseId:
        $ref: '#/definitions/responseId'
      sessionId:
        $ref: '#/definitions/sessionId'
      generationDateTime:
        $ref: '#/definitions/generationDateTime'
      statusCode:
        type: number
        description: |
          Status code to the request
          |Status code | Description|
          |-------|-------|
          |0|OK|
          |111|Missing mandatory parameter|
          |112|Bad parameter format|
          |113|Unknown issuer|          
          |118|Unknown session|
          |119|Unknown virtual card|                             
          |432|Operation is not allowed with current card state|     
          |911|Operation failed|          
          |921|Unexpected server error|
      statusMessage:
        type: string
        description: Textual status message
