Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twitter Timeline source kamelet #104

Merged
merged 3 commits into from
Mar 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@
* xref:ROOT:telegram-source.adoc[image:kamelets/telegram-source.svg[] Telegram Source]
* xref:ROOT:timer-source.adoc[image:kamelets/timer-source.svg[] Timer Source]
* xref:ROOT:twitter-search-source.adoc[image:kamelets/twitter-search-source.svg[] Twitter Search Source]
* xref:ROOT:twitter-timeline-source.adoc[image:kamelets/twitter-timeline-source.svg[] Twitter Timeline Source]
* xref:ROOT:webhook-source.adoc[image:kamelets/webhook-source.svg[] Webhook Source]
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
71 changes: 71 additions & 0 deletions docs/modules/ROOT/pages/twitter-timeline-source.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
= image:kamelets/twitter-timeline-source.svg[] Twitter Timeline Source

*Provided by: "Apache Software Foundation"*

Allows to get tweets from the timeline of a specific user from Twitter.

It requires tokens that can be obtained by creating an application
in the Twitter developer portal: https://developer.twitter.com/.

== Configuration Options

The following table summarizes the configuration options available for the `twitter-timeline-source` Kamelet:
[width="100%",cols="2,^2,3,^2,^2,^3",options="header"]
|===
| Property| Name| Description| Type| Default| Example
| *accessToken {empty}* *| Access Token| The Access Token from the Twitter application in the developer portal| string| |
| *accessTokenSecret {empty}* *| Access Token Secret| The Access Token Secret from the Twitter application in the developer portal| string| |
| *apiKey {empty}* *| API Key| The API Key from the Twitter application in the developer portal| string| |
| *apiKeySecret {empty}* *| API Key Secret| The API Key Secret from the Twitter application in the developer portal| string| |
| *user {empty}* *| User| The user we want to read the timeline| string| | `"ApacheCamel"`
|===

NOTE: Fields marked with ({empty}*) are mandatory.

== Usage

This section summarizes how the `twitter-timeline-source` can be used in various contexts.

=== Knative Source

The `twitter-timeline-source` Kamelet can be used as Knative source by binding it to a Knative object.

.twitter-timeline-source-binding.yaml
[source,yaml]
----
apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
name: twitter-timeline-source-binding
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1alpha1
name: twitter-timeline-source
properties:
accessToken: "The Access Token"
accessTokenSecret: "The Access Token Secret"
apiKey: "The API Key"
apiKeySecret: "The API Key Secret"
user: "ApacheCamel"
sink:
ref:
kind: InMemoryChannel
apiVersion: messaging.knative.dev/v1
name: mychannel

----

Make sure you have xref:latest@camel-k::installation/installation.adoc[Camel K installed] into the Kubernetes cluster you're connected to.

Save the `twitter-timeline-source-binding.yaml` file into your hard drive, then configure it according to your needs.

You can run the source using the following command:

[source,shell]
----
kubectl apply -f twitter-timeline-source-binding.yaml
----
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT
74 changes: 74 additions & 0 deletions twitter-timeline.kamelet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata:
name: twitter-timeline-source
annotations:
camel.apache.org/kamelet.icon: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjI1NnB4IiBoZWlnaHQ9IjIwOXB4IiB2aWV3Qm94PSIwIDAgMjU2IDIwOSIgdmVyc2lvbj0iMS4xIiB4bWx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: "Apache Software Foundation"
labels:
camel.apache.org/kamelet.type: "source"
camel.apache.org/kamelet.group: "Twitter"
spec:
definition:
title: "Twitter Timeline Source"
description: |-
Allows to get tweets from the timeline of a specific user from Twitter.

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
properties:
user:
title: User
description: The user we want to read the timeline
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
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
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
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
types:
out:
mediaType: application/json
flow:
from:
uri: "twitter-timeline:user"
parameters:
user: "{{user}}"
accessToken: "{{accessToken}}"
accessTokenSecret: "{{accessTokenSecret}}"
consumerKey: "{{apiKey}}"
consumerSecret: "{{apiKeySecret}}"
steps:
- marshal:
json: {}
- to: "kamelet:sink"