Skip to content

Commit 4fd9df3

Browse files
lanbytescursoragent
andcommitted
Align the provider with competitor X reads and writes.
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 3d58009 commit 4fd9df3

16 files changed

Lines changed: 555 additions & 16 deletions

File tree

.github/workflows/release.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
with:
2424
gpg_private_key: ${{ secrets.TERRAFORM_GPG_SECRET_KEY }}
2525
passphrase: ${{ secrets.TERRAFORM_GPG_PASSPHRASE }}
26+
git_user_signingkey: false
2627
- uses: goreleaser/goreleaser-action@v6
2728
with:
2829
args: release --clean

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ crash.log
88
.DS_Store
99
.env
1010
.env.local
11+
.secrets/
1112
**/.speakeasy/temp/
1213
**/.speakeasy/logs/
1314
.speakeasy/reports

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
# TwexAPI Terraform Provider: Twitter API for search, followers, DMs & X automation
22

3-
Use the TwexAPI Terraform provider to read X profiles and account balance, follow accounts, and post tweets.
3+
Use the TwexAPI Terraform provider to read X profiles and tweets, follow accounts, and post, like, retweet, or bookmark.
44
It wraps the [Go SDK](https://github.com/twexapi-dev/x-api-scraper-go). Search, timelines, DMs, communities, and other reads stay on the REST API or language SDKs.
55

66
[REST API](https://docs.twexapi.io) | [Go SDK](https://github.com/twexapi-dev/x-api-scraper-go) | [TypeScript SDK](https://github.com/twexapi-dev/x-api-scraper-typescript) | [Dashboard](https://twexapi.io/dashboard)
77

8-
This provider is a thin Terraform Plugin Framework wrapper. Speakeasy does not generate Terraform on the current TwexAPI workspace plan.
8+
This provider is a thin Terraform Plugin Framework wrapper over the Go SDK, the same approach as the competitor provider.
99

1010
## Common Twitter & X tasks
1111

1212
| Task | REST Route | Terraform |
1313
| ------------------------------- | ----------------------------------- | -------------------------------------------------- |
1414
| Read an X profile | `GET /twitter/{screen_name}/about` | `data.x-api-scraper_user_about` |
15+
| Read a tweet | `POST /twitter/tweets/lookup` | `data.x-api-scraper_tweet` |
1516
| Read TwexAPI account balance | `GET /balance` | `data.x-api-scraper_account` |
1617
| Follow an account | `POST /twitter/user/follow` | `x-api-scraper_follow` |
1718
| Post or reply | `POST /twitter/tweets/create` | `x-api-scraper_tweet` |
19+
| Like / retweet / bookmark | tweet action routes | `x-api-scraper_like`, `_retweet`, `_bookmark` |
1820
| Search tweets without the X API | `POST /twitter/advanced_search/page` | Use the [Go SDK](https://github.com/twexapi-dev/x-api-scraper-go) |
1921

2022
## Package & registry trust
@@ -25,6 +27,7 @@ This provider is a thin Terraform Plugin Framework wrapper. Speakeasy does not g
2527
- Docs: [docs.twexapi.io](https://docs.twexapi.io)
2628
- License: MIT
2729
- Dashboard: [twexapi.io/dashboard](https://twexapi.io/dashboard)
30+
- Release signing key: [`gpg-public.asc`](./gpg-public.asc)
2831

2932
## Install
3033

@@ -107,4 +110,15 @@ resource "x-api-scraper_tweet" "announcement" {
107110

108111
Changing `tweet_content` replaces the resource. Destroy deletes the tweet.
109112

113+
## Like, retweet, or bookmark
114+
115+
```hcl
116+
resource "x-api-scraper_like" "example" {
117+
tweet_id = data.x-api-scraper_tweet.example.tweet_id
118+
cookie = var.twitter_cookie
119+
}
120+
```
121+
122+
Destroy reverses the action.
123+
110124
Not affiliated with X Corp.

docs/data-sources/tweet.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
page_title: "x-api-scraper_tweet Data Source"
3+
---
4+
5+
# x-api-scraper_tweet
6+
7+
Read a tweet by id. Maps to the competitor `x_tweet` data source.
8+
9+
## Example Usage
10+
11+
```hcl
12+
data "x-api-scraper_tweet" "example" {
13+
tweet_id = "20"
14+
}
15+
```
16+
17+
## Schema
18+
19+
### Required
20+
21+
- `tweet_id` (String)
22+
23+
### Read-Only
24+
25+
- `text` (String)
26+
- `created_at` (String)
27+
- `screen_name` (String)
28+
- `user_id` (String)
29+
- `favorite_count` (Number)
30+
- `retweet_count` (Number)
31+
- `reply_count` (Number)
32+
- `data_json` (String) Raw tweet payload as JSON.

docs/data-sources/user_about.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ page_title: "x-api-scraper_user_about Data Source"
44

55
# x-api-scraper_user_about
66

7-
Read an X profile by screen name.
7+
Read an X profile by screen name. Maps to the competitor `x_user` data source.
88

99
## Example Usage
1010

@@ -27,3 +27,7 @@ data "x-api-scraper_user_about" "example" {
2727
- `avatar` (String)
2828
- `created_at` (String)
2929
- `is_blue_verified` (Boolean)
30+
- `verification` (Boolean)
31+
- `account_based_in` (String)
32+
- `affiliate_username` (String)
33+
- `username_changes_count` (Number)

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Terraform provider for TwexAPI Twitter search, followers, DMs, and
55

66
# TwexAPI Provider
77

8-
Manage a small set of TwexAPI reads and writes as Terraform resources. Use a language SDK for search and pagination.
8+
Manage TwexAPI reads and writes as Terraform data sources and resources. It wraps the Go SDK. Search and pagination stay on the language SDKs.
99

1010
## Example Usage
1111

docs/resources/bookmark.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
page_title: "x-api-scraper_bookmark Resource"
3+
---
4+
5+
# x-api-scraper_bookmark
6+
7+
Bookmark a tweet. Destroy removes the bookmark.
8+
9+
## Example Usage
10+
11+
```hcl
12+
resource "x-api-scraper_bookmark" "example" {
13+
tweet_id = "20"
14+
cookie = var.twitter_cookie
15+
}
16+
```
17+
18+
## Schema
19+
20+
### Required
21+
22+
- `tweet_id` (String)
23+
- `cookie` (String, Sensitive)
24+
25+
### Read-Only
26+
27+
- `id` (String)

docs/resources/like.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
page_title: "x-api-scraper_like Resource"
3+
---
4+
5+
# x-api-scraper_like
6+
7+
Like a tweet. Destroy unlikes it.
8+
9+
## Example Usage
10+
11+
```hcl
12+
resource "x-api-scraper_like" "example" {
13+
tweet_id = "20"
14+
cookie = var.twitter_cookie
15+
}
16+
```
17+
18+
## Schema
19+
20+
### Required
21+
22+
- `tweet_id` (String)
23+
- `cookie` (String, Sensitive)
24+
25+
### Read-Only
26+
27+
- `id` (String)

docs/resources/retweet.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
page_title: "x-api-scraper_retweet Resource"
3+
---
4+
5+
# x-api-scraper_retweet
6+
7+
Retweet a tweet. Destroy deletes the retweet.
8+
9+
## Example Usage
10+
11+
```hcl
12+
resource "x-api-scraper_retweet" "example" {
13+
tweet_id = "20"
14+
cookie = var.twitter_cookie
15+
}
16+
```
17+
18+
## Schema
19+
20+
### Required
21+
22+
- `tweet_id` (String)
23+
- `cookie` (String, Sensitive)
24+
25+
### Read-Only
26+
27+
- `id` (String)

examples/basic/main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ data "x-api-scraper_user_about" "example" {
1212
screen_name = "elonmusk"
1313
}
1414

15+
data "x-api-scraper_tweet" "example" {
16+
tweet_id = "20"
17+
}
18+
1519
output "user_id" {
1620
value = data.x-api-scraper_user_about.example.user_id
1721
}
22+
23+
output "tweet_text" {
24+
value = data.x-api-scraper_tweet.example.text
25+
}

0 commit comments

Comments
 (0)