@yoonion/mimi-seed-mcp 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/threads/api.js +5 -5
- package/package.json +1 -1
package/dist/threads/api.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { metaApiError } from '../lib/meta-auth.js';
|
|
2
2
|
// Threads Graph API. Instagram 과 달리 base 가 하나뿐이라 토큰 prefix 분기가 없다.
|
|
3
3
|
// graph.threads.net/v1.0
|
|
4
|
-
// 게시 흐름은 인스타와 같은 2단계: container 생성(/threads) → publish(/threads_publish).
|
|
4
|
+
// 게시 흐름은 인스타와 같은 2단계: container 생성(/me/threads) → publish(/me/threads_publish).
|
|
5
5
|
// 차이: (1) 텍스트 전용 게시가 1급 시민(media_type=TEXT), (2) 미디어 컨테이너는 처리 시간이
|
|
6
6
|
// 필요해 publish 전에 status 를 폴링해야 한다, (3) 캐러셀 최대 20장(인스타는 10장).
|
|
7
7
|
const BASE = 'https://graph.threads.net/v1.0';
|
|
@@ -108,7 +108,7 @@ async function waitForContainer(cfg, containerId) {
|
|
|
108
108
|
throw new Error('미디어 처리 대기 시간 초과 (60초). 잠시 후 다시 시도하세요.');
|
|
109
109
|
}
|
|
110
110
|
async function publish(cfg, creationId) {
|
|
111
|
-
const published = await thFetch(cfg.accessToken,
|
|
111
|
+
const published = await thFetch(cfg.accessToken, '/me/threads_publish', { creation_id: creationId, access_token: cfg.accessToken }, 'POST');
|
|
112
112
|
return { id: published.id, permalink: await fetchPermalink(cfg, published.id) };
|
|
113
113
|
}
|
|
114
114
|
/** 텍스트 전용 게시 — Threads 의 핵심 유스케이스. imageUrl 을 주면 이미지 게시. */
|
|
@@ -120,7 +120,7 @@ export async function postText(cfg, text, imageUrl) {
|
|
|
120
120
|
};
|
|
121
121
|
if (imageUrl)
|
|
122
122
|
params.image_url = imageUrl;
|
|
123
|
-
const container = await thFetch(cfg.accessToken,
|
|
123
|
+
const container = await thFetch(cfg.accessToken, '/me/threads', params, 'POST');
|
|
124
124
|
if (imageUrl)
|
|
125
125
|
await waitForContainer(cfg, container.id); // 미디어만 처리 대기
|
|
126
126
|
return publish(cfg, container.id);
|
|
@@ -132,14 +132,14 @@ export async function postCarousel(cfg, imageUrls, text) {
|
|
|
132
132
|
// Step 1: 각 이미지를 children container 로 생성 (sequential — 부분 실패 시 명확)
|
|
133
133
|
const childIds = [];
|
|
134
134
|
for (const url of imageUrls) {
|
|
135
|
-
const child = await thFetch(cfg.accessToken,
|
|
135
|
+
const child = await thFetch(cfg.accessToken, '/me/threads', { media_type: 'IMAGE', image_url: url, is_carousel_item: 'true', access_token: cfg.accessToken }, 'POST');
|
|
136
136
|
childIds.push(child.id);
|
|
137
137
|
}
|
|
138
138
|
// children 이 모두 처리될 때까지 대기 (아무거나 처리 중이면 carousel 생성이 실패한다)
|
|
139
139
|
for (const id of childIds)
|
|
140
140
|
await waitForContainer(cfg, id);
|
|
141
141
|
// Step 2: carousel container 생성
|
|
142
|
-
const carousel = await thFetch(cfg.accessToken,
|
|
142
|
+
const carousel = await thFetch(cfg.accessToken, '/me/threads', { media_type: 'CAROUSEL', children: childIds.join(','), text, access_token: cfg.accessToken }, 'POST');
|
|
143
143
|
// 부모 컨테이너도 비동기로 조립되므로 완료 전에 publish 하지 않는다.
|
|
144
144
|
await waitForContainer(cfg, carousel.id);
|
|
145
145
|
// Step 3: publish
|
package/package.json
CHANGED