# ---------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ---------------------------------------------------------------------------
apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata:
  name: twitter-directmessage-source
  annotations:
    camel.apache.org/kamelet.support.level: "Stable"
    camel.apache.org/catalog.version: "3.21.0"
    camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjI1NnB4IiBoZWlnaHQ9IjIwOXB4IiB2aWV3Qm94PSIwIDAgMjU2IDIwOSIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWlkWU1pZCI+CiAgICA8Zz4KICAgICAgICA8cGF0aCBkPSJNMjU2LDI1LjQ1MDAyNTkgQzI0Ni41ODA4NDEsMjkuNjI3MjY3MiAyMzYuNDU4NDUxLDMyLjQ1MDQ4NjggMjI1LjgzNDE1NiwzMy43MjAyMzMzIEMyMzYuNjc4NTAzLDI3LjIxOTgwNTMgMjQ1LjAwNTgzLDE2LjkyNjk5MjkgMjQ4LjkyNzQzNyw0LjY2MzA3Njg1IEMyMzguNzc5NzY1LDEwLjY4MTI2MzMgMjI3LjUzOTMyNSwxNS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LjA5NzY2NSA3Ny43NTY5OTE4LDE2My41MjE4NSBDNTkuNzgyMDI1NywxNzcuNjA3OTgzIDM3LjEzNTQwMzYsMTg2LjAwNDYwNCAxMi41Mjg5MTQ3LDE4Ni4wMDQ2MDQgQzguMjg5ODcxNjEsMTg2LjAwNDYwNCA0LjEwODg4NDc0LDE4NS43NTY0NiAwLDE4NS4yNzE0MDkgQzIzLjI0MzEwMzMsMjAwLjE3MzEzOSA1MC44NTA3MjYxLDIwOC44Njc1MzIgODAuNTEwOTE4NSwyMDguODY3NTMyIEMxNzcuMTE2NTI5LDIwOC44Njc1MzIgMjI5Ljk0Mzk3NywxMjguODM2OTgyIDIyOS45NDM5NzcsNTkuNDMyNjAwMiBDMjI5Ljk0Mzk3Nyw1Ny4xNTUyOTY4IDIyOS44OTM0MTIsNTQuODkwMTY2NCAyMjkuNzkyMjgyLDUyLjYzODE0NTQgQzI0MC4wNTMyNTcsNDUuMjMzMTYzNSAyNDguOTU4MzM4LDM1Ljk4MjU1NDUgMjU2LDI1LjQ1MDAyNTkiIGZpbGw9IiM1NWFjZWUiPjwvcGF0aD4KICAgIDwvZz4KPC9zdmc+"
    camel.apache.org/provider: "Apache Software Foundation"
    camel.apache.org/kamelet.group: "Twitter"
    camel.apache.org/kamelet.namespace: "Social"
  labels:
    camel.apache.org/kamelet.type: "source"
spec:
  definition:
    title: "Twitter Direct Message Source"
    description: |-
      Allows to get all direct messages for your Twitter account.

      It requires tokens that can be obtained by creating an application 
      in the Twitter developer portal: https://developer.twitter.com/.
    required:
    - user
    - apiKey
    - apiKeySecret
    - accessToken
    - accessTokenSecret
    type: object
    properties:
      user:
        title: User
        description: The user we want to read the direct messages
        type: string
        example: "ApacheCamel"
      apiKey:
        title: API Key
        description: The API Key from the Twitter application in the developer portal
        type: string
        format: password
        x-descriptors:
        - urn:alm:descriptor:com.tectonic.ui:password
        - urn:camel:group:credentials
      apiKeySecret:
        title: API Key Secret
        description: The API Key Secret from the Twitter application in the developer portal
        type: string
        format: password
        x-descriptors:
        - urn:alm:descriptor:com.tectonic.ui:password
        - urn:camel:group:credentials
      accessToken:
        title: Access Token
        description: The Access Token from the Twitter application in the developer portal
        type: string
        format: password
        x-descriptors:
        - urn:alm:descriptor:com.tectonic.ui:password
        - urn:camel:group:credentials
      accessTokenSecret:
        title: Access Token Secret
        description: The Access Token Secret from the Twitter application in the developer portal
        type: string
        format: password
        x-descriptors:
        - urn:alm:descriptor:com.tectonic.ui:password
        - urn:camel:group:credentials
  types:
    out:
      mediaType: application/json
  dependencies:
    - "camel:jackson"
    - "camel:twitter"
    - "camel:kamelet"
  template:
    from:
      uri: "twitter-directmessage:{{user}}"
      parameters:
        accessToken: "{{accessToken}}"
        accessTokenSecret: "{{accessTokenSecret}}"
        consumerKey: "{{apiKey}}"
        consumerSecret: "{{apiKeySecret}}"
      steps:
      - marshal:
          json: {}
      - to: "kamelet:sink"