@postpeer/node 0.5.0 → 0.6.0
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/CHANGELOG.md +19 -0
- package/api-promise.js.map +1 -1
- package/client.d.mts +5 -5
- package/client.d.mts.map +1 -1
- package/client.d.ts +5 -5
- package/client.d.ts.map +1 -1
- package/client.js +75 -19
- package/client.js.map +1 -1
- package/client.mjs +77 -21
- package/client.mjs.map +1 -1
- package/core/api-promise.d.mts.map +1 -1
- package/core/api-promise.d.ts.map +1 -1
- package/core/api-promise.js.map +1 -1
- package/core/api-promise.mjs.map +1 -1
- package/core/error.d.mts.map +1 -1
- package/core/error.d.ts.map +1 -1
- package/core/error.js +2 -2
- package/core/error.js.map +1 -1
- package/core/error.mjs +2 -2
- package/core/error.mjs.map +1 -1
- package/error.js.map +1 -1
- package/index.d.mts +1 -1
- package/index.d.mts.map +1 -1
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js.map +1 -1
- package/index.mjs +1 -1
- package/index.mjs.map +1 -1
- package/internal/builtin-types.d.mts +5 -5
- package/internal/builtin-types.d.mts.map +1 -1
- package/internal/builtin-types.d.ts +5 -5
- package/internal/builtin-types.d.ts.map +1 -1
- package/internal/detect-platform.d.mts.map +1 -1
- package/internal/detect-platform.d.ts.map +1 -1
- package/internal/detect-platform.js.map +1 -1
- package/internal/detect-platform.mjs.map +1 -1
- package/internal/errors.js +6 -5
- package/internal/errors.js.map +1 -1
- package/internal/errors.mjs +6 -5
- package/internal/errors.mjs.map +1 -1
- package/internal/headers.js +2 -2
- package/internal/headers.js.map +1 -1
- package/internal/headers.mjs +2 -2
- package/internal/headers.mjs.map +1 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +7 -1
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +7 -1
- package/internal/parse.mjs.map +1 -1
- package/internal/qs/utils.d.mts.map +1 -1
- package/internal/qs/utils.d.ts.map +1 -1
- package/internal/qs/utils.js +1 -2
- package/internal/qs/utils.js.map +1 -1
- package/internal/qs/utils.mjs +1 -2
- package/internal/qs/utils.mjs.map +1 -1
- package/internal/request-options.d.mts.map +1 -1
- package/internal/request-options.d.ts.map +1 -1
- package/internal/request-options.js.map +1 -1
- package/internal/request-options.mjs.map +1 -1
- package/internal/shim-types.d.mts.map +1 -1
- package/internal/shim-types.d.ts.map +1 -1
- package/internal/shims.d.mts.map +1 -1
- package/internal/shims.d.ts.map +1 -1
- package/internal/shims.js.map +1 -1
- package/internal/shims.mjs.map +1 -1
- package/internal/to-file.d.mts.map +1 -1
- package/internal/to-file.d.ts.map +1 -1
- package/internal/to-file.js.map +1 -1
- package/internal/to-file.mjs.map +1 -1
- package/internal/types.d.mts +17 -11
- package/internal/types.d.mts.map +1 -1
- package/internal/types.d.ts +17 -11
- package/internal/types.d.ts.map +1 -1
- package/internal/utils/log.d.mts.map +1 -1
- package/internal/utils/log.d.ts.map +1 -1
- package/internal/utils/log.js +9 -2
- package/internal/utils/log.js.map +1 -1
- package/internal/utils/log.mjs +9 -2
- package/internal/utils/log.mjs.map +1 -1
- package/internal/utils/query.js.map +1 -1
- package/internal/utils/query.mjs.map +1 -1
- package/internal/utils/uuid.d.mts.map +1 -1
- package/internal/utils/uuid.d.ts.map +1 -1
- package/internal/utils/uuid.js +2 -4
- package/internal/utils/uuid.js.map +1 -1
- package/internal/utils/uuid.mjs +2 -4
- package/internal/utils/uuid.mjs.map +1 -1
- package/package.json +1 -1
- package/resource.js.map +1 -1
- package/resources/connect/connect.d.mts +4 -4
- package/resources/connect/connect.d.mts.map +1 -1
- package/resources/connect/connect.d.ts +4 -4
- package/resources/connect/connect.d.ts.map +1 -1
- package/resources/connect/connect.js.map +1 -1
- package/resources/connect/connect.mjs +1 -1
- package/resources/connect/connect.mjs.map +1 -1
- package/resources/connect/index.d.mts +1 -1
- package/resources/connect/index.d.mts.map +1 -1
- package/resources/connect/index.d.ts +1 -1
- package/resources/connect/index.d.ts.map +1 -1
- package/resources/connect/index.js +0 -2
- package/resources/connect/index.js.map +1 -1
- package/resources/connect/index.mjs +1 -3
- package/resources/connect/index.mjs.map +1 -1
- package/resources/connect/integrations.d.mts +21 -4
- package/resources/connect/integrations.d.mts.map +1 -1
- package/resources/connect/integrations.d.ts +21 -4
- package/resources/connect/integrations.d.ts.map +1 -1
- package/resources/connect/integrations.js +3 -3
- package/resources/connect/integrations.js.map +1 -1
- package/resources/connect/integrations.mjs +3 -3
- package/resources/connect/integrations.mjs.map +1 -1
- package/resources/health.d.mts +1 -1
- package/resources/health.d.mts.map +1 -1
- package/resources/health.d.ts +1 -1
- package/resources/health.d.ts.map +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +0 -5
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -6
- package/resources/index.mjs.map +1 -1
- package/resources/media.d.mts.map +1 -1
- package/resources/media.d.ts.map +1 -1
- package/resources/platforms.d.mts +1 -1
- package/resources/platforms.d.mts.map +1 -1
- package/resources/platforms.d.ts +1 -1
- package/resources/platforms.d.ts.map +1 -1
- package/resources/posts/index.d.mts +2 -2
- package/resources/posts/index.d.mts.map +1 -1
- package/resources/posts/index.d.ts +2 -2
- package/resources/posts/index.d.ts.map +1 -1
- package/resources/posts/index.js +0 -2
- package/resources/posts/index.js.map +1 -1
- package/resources/posts/index.mjs +2 -4
- package/resources/posts/index.mjs.map +1 -1
- package/resources/posts/posts.d.mts +14 -7
- package/resources/posts/posts.d.mts.map +1 -1
- package/resources/posts/posts.d.ts +14 -7
- package/resources/posts/posts.d.ts.map +1 -1
- package/resources/posts/posts.js.map +1 -1
- package/resources/posts/posts.mjs +1 -1
- package/resources/posts/posts.mjs.map +1 -1
- package/resources/posts/scheduled.d.mts +2 -2
- package/resources/posts/scheduled.d.mts.map +1 -1
- package/resources/posts/scheduled.d.ts +2 -2
- package/resources/posts/scheduled.d.ts.map +1 -1
- package/resources/posts/scheduled.js.map +1 -1
- package/resources/posts/scheduled.mjs.map +1 -1
- package/src/api-promise.ts +1 -1
- package/src/client.ts +180 -79
- package/src/core/api-promise.ts +7 -2
- package/src/core/error.ts +22 -24
- package/src/error.ts +1 -1
- package/src/index.ts +15 -1
- package/src/internal/builtin-types.ts +14 -9
- package/src/internal/detect-platform.ts +5 -1
- package/src/internal/errors.ts +7 -7
- package/src/internal/headers.ts +2 -2
- package/src/internal/parse.ts +10 -2
- package/src/internal/qs/utils.ts +1 -4
- package/src/internal/request-options.ts +1 -5
- package/src/internal/shim-types.ts +2 -2
- package/src/internal/shims.ts +3 -1
- package/src/internal/to-file.ts +7 -7
- package/src/internal/types.ts +20 -16
- package/src/internal/utils/log.ts +30 -8
- package/src/internal/utils/query.ts +1 -1
- package/src/internal/utils/uuid.ts +3 -5
- package/src/resource.ts +1 -1
- package/src/resources/connect/connect.ts +14 -4
- package/src/resources/connect/index.ts +7 -2
- package/src/resources/connect/integrations.ts +32 -5
- package/src/resources/health.ts +1 -1
- package/src/resources/index.ts +14 -5
- package/src/resources/media.ts +1 -4
- package/src/resources/platforms.ts +2 -4
- package/src/resources/posts/index.ts +17 -2
- package/src/resources/posts/posts.ts +29 -10
- package/src/resources/posts/scheduled.ts +7 -3
- package/src/uploads.ts +1 -1
- package/src/version.ts +1 -1
- package/uploads.js.map +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
package/src/internal/headers.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import { isReadonlyArray } from
|
|
3
|
+
import { isReadonlyArray } from './utils/values';
|
|
4
4
|
|
|
5
5
|
type HeaderValue = string | undefined | null;
|
|
6
6
|
export type HeadersLike =
|
|
@@ -51,7 +51,7 @@ function* iterateHeaders(headers: HeadersLike): IterableIterator<readonly [strin
|
|
|
51
51
|
}
|
|
52
52
|
for (let row of iter) {
|
|
53
53
|
const name = row[0];
|
|
54
|
-
if (typeof name !==
|
|
54
|
+
if (typeof name !== 'string') throw new TypeError('expected header name to be a string');
|
|
55
55
|
const values = isReadonlyArray(row[1]) ? row[1] : [row[1]];
|
|
56
56
|
let didClear = false;
|
|
57
57
|
for (const value of values) {
|
package/src/internal/parse.ts
CHANGED
|
@@ -16,7 +16,6 @@ export type APIResponseProps = {
|
|
|
16
16
|
export async function defaultParseResponse<T>(client: Postpeer, props: APIResponseProps): Promise<T> {
|
|
17
17
|
const { response, requestLogID, retryOfRequestLogID, startTime } = props;
|
|
18
18
|
const body = await (async () => {
|
|
19
|
-
|
|
20
19
|
// fetch refuses to read the body when the status code is 204.
|
|
21
20
|
if (response.status === 204) {
|
|
22
21
|
return null as T;
|
|
@@ -43,6 +42,15 @@ export async function defaultParseResponse<T>(client: Postpeer, props: APIRespon
|
|
|
43
42
|
const text = await response.text();
|
|
44
43
|
return text as unknown as T;
|
|
45
44
|
})();
|
|
46
|
-
loggerFor(client).debug(
|
|
45
|
+
loggerFor(client).debug(
|
|
46
|
+
`[${requestLogID}] response parsed`,
|
|
47
|
+
formatRequestDetails({
|
|
48
|
+
retryOfRequestLogID,
|
|
49
|
+
url: response.url,
|
|
50
|
+
status: response.status,
|
|
51
|
+
body,
|
|
52
|
+
durationMs: Date.now() - startTime,
|
|
53
|
+
}),
|
|
54
|
+
);
|
|
47
55
|
return body;
|
|
48
56
|
}
|
package/src/internal/qs/utils.ts
CHANGED
|
@@ -62,10 +62,7 @@ export function merge(
|
|
|
62
62
|
if (isArray(target)) {
|
|
63
63
|
target.push(source);
|
|
64
64
|
} else if (target && typeof target === 'object') {
|
|
65
|
-
if (
|
|
66
|
-
(options && (options.plainObjects || options.allowPrototypes)) ||
|
|
67
|
-
!has(Object.prototype, source)
|
|
68
|
-
) {
|
|
65
|
+
if ((options && (options.plainObjects || options.allowPrototypes)) || !has(Object.prototype, source)) {
|
|
69
66
|
target[source] = true;
|
|
70
67
|
}
|
|
71
68
|
} else {
|
|
@@ -76,14 +76,10 @@ export type RequestOptions = {
|
|
|
76
76
|
defaultBaseURL?: string | undefined;
|
|
77
77
|
|
|
78
78
|
__binaryResponse?: boolean | undefined;
|
|
79
|
-
|
|
80
79
|
};
|
|
81
80
|
|
|
82
81
|
export type EncodedContent = { bodyHeaders: HeadersLike; body: BodyInit };
|
|
83
|
-
export type RequestEncoder = (request: {
|
|
84
|
-
headers: NullableHeaders;
|
|
85
|
-
body: unknown;
|
|
86
|
-
}) => EncodedContent;
|
|
82
|
+
export type RequestEncoder = (request: { headers: NullableHeaders; body: unknown }) => EncodedContent;
|
|
87
83
|
|
|
88
84
|
export const FallbackEncoder: RequestEncoder = ({ headers, body }) => {
|
|
89
85
|
return {
|
|
@@ -19,8 +19,8 @@ type _ConditionalNodeReadableStream<R = any> =
|
|
|
19
19
|
typeof globalThis extends { ReadableStream: any } ? never : _NodeReadableStream<R>;
|
|
20
20
|
|
|
21
21
|
type _ReadableStream<R = any> = NeverToAny<
|
|
22
|
-
([0] extends [1 & _DOMReadableStream<R>] ? never : _DOMReadableStream<R>)
|
|
23
|
-
([0] extends [1 & _ConditionalNodeReadableStream<R>] ? never : _ConditionalNodeReadableStream<R>)
|
|
22
|
+
| ([0] extends [1 & _DOMReadableStream<R>] ? never : _DOMReadableStream<R>)
|
|
23
|
+
| ([0] extends [1 & _ConditionalNodeReadableStream<R>] ? never : _ConditionalNodeReadableStream<R>)
|
|
24
24
|
>;
|
|
25
25
|
|
|
26
26
|
export type { _ReadableStream as ReadableStream };
|
package/src/internal/shims.ts
CHANGED
|
@@ -27,7 +27,9 @@ export function makeReadableStream(...args: ReadableStreamArgs): ReadableStream
|
|
|
27
27
|
if (typeof ReadableStream === 'undefined') {
|
|
28
28
|
// Note: All of the platforms / runtimes we officially support already define
|
|
29
29
|
// `ReadableStream` as a global, so this should only ever be hit on unsupported runtimes.
|
|
30
|
-
throw new Error(
|
|
30
|
+
throw new Error(
|
|
31
|
+
'`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`',
|
|
32
|
+
);
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
return new ReadableStream(...args);
|
package/src/internal/to-file.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BlobPart, getName, makeFile, isAsyncIterable } from
|
|
1
|
+
import { BlobPart, getName, makeFile, isAsyncIterable } from './uploads';
|
|
2
2
|
import type { FilePropertyBag } from './builtin-types';
|
|
3
3
|
import { checkFileSupport } from './uploads';
|
|
4
4
|
|
|
@@ -65,8 +65,11 @@ const isResponseLike = (value: any): value is ResponseLike =>
|
|
|
65
65
|
typeof value.url === 'string' &&
|
|
66
66
|
typeof value.blob === 'function';
|
|
67
67
|
|
|
68
|
-
export type ToFileInput =
|
|
69
|
-
|
|
68
|
+
export type ToFileInput =
|
|
69
|
+
| FileLike
|
|
70
|
+
| ResponseLike
|
|
71
|
+
| Exclude<BlobLikePart, string>
|
|
72
|
+
| AsyncIterable<BlobLikePart>;
|
|
70
73
|
|
|
71
74
|
/**
|
|
72
75
|
* Helper for creating a {@link File} to pass to an SDK upload method from a variety of different data formats
|
|
@@ -116,9 +119,7 @@ export async function toFile(
|
|
|
116
119
|
return makeFile(parts, name, options);
|
|
117
120
|
}
|
|
118
121
|
|
|
119
|
-
async function getBytes(
|
|
120
|
-
value: BlobLikePart | AsyncIterable<BlobLikePart>,
|
|
121
|
-
): Promise<Array<BlobPart>> {
|
|
122
|
+
async function getBytes(value: BlobLikePart | AsyncIterable<BlobLikePart>): Promise<Array<BlobPart>> {
|
|
122
123
|
let parts: Array<BlobPart> = [];
|
|
123
124
|
if (
|
|
124
125
|
typeof value === 'string' ||
|
|
@@ -151,4 +152,3 @@ function propsForError(value: unknown): string {
|
|
|
151
152
|
const props = Object.getOwnPropertyNames(value);
|
|
152
153
|
return `; props: [${props.map((p) => `"${p}"`).join(', ')}]`;
|
|
153
154
|
}
|
|
154
|
-
|
package/src/internal/types.ts
CHANGED
|
@@ -7,34 +7,39 @@ export type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
|
|
7
7
|
|
|
8
8
|
export type FinalizedRequestInit = RequestInit & { headers: Headers };
|
|
9
9
|
|
|
10
|
-
type NotAny<T> = [0] extends [
|
|
10
|
+
type NotAny<T> = [0] extends [1 & T] ? never : T;
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Some environments overload the global fetch function, and Parameters<T> only gets the last signature.
|
|
14
14
|
*/
|
|
15
|
-
type OverloadedParameters<T> =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
(...args: infer C): unknown;
|
|
19
|
-
(...args: infer D): unknown;
|
|
20
|
-
}
|
|
21
|
-
? A | B | C | D
|
|
22
|
-
: T extends {
|
|
15
|
+
type OverloadedParameters<T> =
|
|
16
|
+
T extends (
|
|
17
|
+
{
|
|
23
18
|
(...args: infer A): unknown;
|
|
24
19
|
(...args: infer B): unknown;
|
|
25
20
|
(...args: infer C): unknown;
|
|
21
|
+
(...args: infer D): unknown;
|
|
26
22
|
}
|
|
27
|
-
?
|
|
28
|
-
|
|
23
|
+
) ?
|
|
24
|
+
A | B | C | D
|
|
25
|
+
: T extends (
|
|
26
|
+
{
|
|
27
|
+
(...args: infer A): unknown;
|
|
28
|
+
(...args: infer B): unknown;
|
|
29
|
+
(...args: infer C): unknown;
|
|
30
|
+
}
|
|
31
|
+
) ?
|
|
32
|
+
A | B | C
|
|
33
|
+
: T extends (
|
|
34
|
+
{
|
|
29
35
|
(...args: infer A): unknown;
|
|
30
36
|
(...args: infer B): unknown;
|
|
31
37
|
}
|
|
32
|
-
?
|
|
33
|
-
|
|
34
|
-
? A
|
|
38
|
+
) ?
|
|
39
|
+
A | B
|
|
40
|
+
: T extends (...args: infer A) => unknown ? A
|
|
35
41
|
: never;
|
|
36
42
|
|
|
37
|
-
|
|
38
43
|
/**
|
|
39
44
|
* These imports attempt to get types from a parent package's dependencies.
|
|
40
45
|
* Unresolved bare specifiers can trigger [automatic type acquisition][1] in some projects, which
|
|
@@ -69,7 +74,6 @@ type NodeFetch2RequestInit = NotAny<import('../node_modules/@types/node-fetch/in
|
|
|
69
74
|
type NodeFetch3RequestInit = NotAny<import('../node_modules/node-fetch').RequestInit> | NotAny<import('../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/node-fetch').RequestInit>;
|
|
70
75
|
/** @ts-ignore For users who use Deno */ /* prettier-ignore */
|
|
71
76
|
type FetchRequestInit = NonNullable<OverloadedParameters<typeof fetch>[1]>;
|
|
72
|
-
|
|
73
77
|
|
|
74
78
|
type RequestInits =
|
|
75
79
|
| NotAny<UndiciTypesRequestInit>
|
|
@@ -4,7 +4,7 @@ import { hasOwn } from './values';
|
|
|
4
4
|
import { type Postpeer } from '../../client';
|
|
5
5
|
import { RequestOptions } from '../request-options';
|
|
6
6
|
|
|
7
|
-
type LogFn = (message: string, ...rest: unknown[]) => void
|
|
7
|
+
type LogFn = (message: string, ...rest: unknown[]) => void;
|
|
8
8
|
export type Logger = {
|
|
9
9
|
error: LogFn;
|
|
10
10
|
warn: LogFn;
|
|
@@ -21,14 +21,22 @@ const levelNumbers = {
|
|
|
21
21
|
debug: 500,
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
export const parseLogLevel = (
|
|
24
|
+
export const parseLogLevel = (
|
|
25
|
+
maybeLevel: string | undefined,
|
|
26
|
+
sourceName: string,
|
|
27
|
+
client: Postpeer,
|
|
28
|
+
): LogLevel | undefined => {
|
|
25
29
|
if (!maybeLevel) {
|
|
26
30
|
return undefined;
|
|
27
31
|
}
|
|
28
32
|
if (hasOwn(levelNumbers, maybeLevel)) {
|
|
29
33
|
return maybeLevel;
|
|
30
|
-
}
|
|
31
|
-
loggerFor(client).warn(
|
|
34
|
+
}
|
|
35
|
+
loggerFor(client).warn(
|
|
36
|
+
`${sourceName} was set to ${JSON.stringify(maybeLevel)}, expected one of ${JSON.stringify(
|
|
37
|
+
Object.keys(levelNumbers),
|
|
38
|
+
)}`,
|
|
39
|
+
);
|
|
32
40
|
return undefined;
|
|
33
41
|
};
|
|
34
42
|
|
|
@@ -89,11 +97,25 @@ export const formatRequestDetails = (details: {
|
|
|
89
97
|
body?: unknown;
|
|
90
98
|
}) => {
|
|
91
99
|
if (details.options) {
|
|
92
|
-
details.options = {...details.options};
|
|
100
|
+
details.options = { ...details.options };
|
|
93
101
|
delete details.options['headers']; // redundant + leaks internals
|
|
94
102
|
}
|
|
95
103
|
if (details.headers) {
|
|
96
|
-
details.headers = Object.fromEntries(
|
|
104
|
+
details.headers = Object.fromEntries(
|
|
105
|
+
(details.headers instanceof Headers ? [...details.headers] : Object.entries(details.headers)).map(
|
|
106
|
+
([name, value]) => [
|
|
107
|
+
name,
|
|
108
|
+
(
|
|
109
|
+
name.toLowerCase() === 'x-access-key' ||
|
|
110
|
+
name.toLowerCase() === 'authorization' ||
|
|
111
|
+
name.toLowerCase() === 'cookie' ||
|
|
112
|
+
name.toLowerCase() === 'set-cookie'
|
|
113
|
+
) ?
|
|
114
|
+
'***'
|
|
115
|
+
: value,
|
|
116
|
+
],
|
|
117
|
+
),
|
|
118
|
+
);
|
|
97
119
|
}
|
|
98
120
|
if ('retryOfRequestLogID' in details) {
|
|
99
121
|
if (details.retryOfRequestLogID) {
|
|
@@ -101,5 +123,5 @@ export const formatRequestDetails = (details: {
|
|
|
101
123
|
}
|
|
102
124
|
delete details.retryOfRequestLogID;
|
|
103
125
|
}
|
|
104
|
-
return details
|
|
105
|
-
}
|
|
126
|
+
return details;
|
|
127
|
+
};
|
|
@@ -10,10 +10,8 @@ export let uuid4 = function () {
|
|
|
10
10
|
return crypto.randomUUID();
|
|
11
11
|
}
|
|
12
12
|
const u8 = new Uint8Array(1);
|
|
13
|
-
const randomByte = crypto
|
|
14
|
-
|
|
15
|
-
: () => (Math.random() * 0xff) & 0xff;
|
|
16
|
-
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c) =>
|
|
13
|
+
const randomByte = crypto ? () => crypto.getRandomValues(u8)[0]! : () => (Math.random() * 0xff) & 0xff;
|
|
14
|
+
return '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, (c) =>
|
|
17
15
|
(+c ^ (randomByte() & (15 >> (+c / 4)))).toString(16),
|
|
18
16
|
);
|
|
19
|
-
}
|
|
17
|
+
};
|
package/src/resource.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** @deprecated Import from ./core/resource instead */
|
|
2
|
-
export * from
|
|
2
|
+
export * from './core/resource';
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../core/resource';
|
|
4
4
|
import * as IntegrationsAPI from './integrations';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
IntegrationDisconnectResponse,
|
|
7
|
+
IntegrationListParams,
|
|
8
|
+
IntegrationListResponse,
|
|
9
|
+
Integrations,
|
|
10
|
+
} from './integrations';
|
|
6
11
|
import { APIPromise } from '../../core/api-promise';
|
|
7
12
|
import { RequestOptions } from '../../internal/request-options';
|
|
8
13
|
import { path } from '../../internal/utils/path';
|
|
@@ -13,7 +18,11 @@ export class Connect extends APIResource {
|
|
|
13
18
|
/**
|
|
14
19
|
* Get OAuth URL for a platform
|
|
15
20
|
*/
|
|
16
|
-
getOAuthURL(
|
|
21
|
+
getOAuthURL(
|
|
22
|
+
platform: 'twitter' | 'instagram' | 'youtube' | 'tiktok' | 'pinterest' | 'linkedin' | 'bluesky',
|
|
23
|
+
query: ConnectGetOAuthURLParams | null | undefined = {},
|
|
24
|
+
options?: RequestOptions,
|
|
25
|
+
): APIPromise<ConnectGetOAuthURLResponse> {
|
|
17
26
|
return this._client.get(path`/v1/connect/${platform}`, { query, ...options });
|
|
18
27
|
}
|
|
19
28
|
}
|
|
@@ -34,12 +43,13 @@ Connect.Integrations = Integrations;
|
|
|
34
43
|
export declare namespace Connect {
|
|
35
44
|
export {
|
|
36
45
|
type ConnectGetOAuthURLResponse as ConnectGetOAuthURLResponse,
|
|
37
|
-
type ConnectGetOAuthURLParams as ConnectGetOAuthURLParams
|
|
46
|
+
type ConnectGetOAuthURLParams as ConnectGetOAuthURLParams,
|
|
38
47
|
};
|
|
39
48
|
|
|
40
49
|
export {
|
|
41
50
|
Integrations as Integrations,
|
|
42
51
|
type IntegrationListResponse as IntegrationListResponse,
|
|
43
|
-
type IntegrationDisconnectResponse as IntegrationDisconnectResponse
|
|
52
|
+
type IntegrationDisconnectResponse as IntegrationDisconnectResponse,
|
|
53
|
+
type IntegrationListParams as IntegrationListParams,
|
|
44
54
|
};
|
|
45
55
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
export { Connect, type ConnectGetOAuthURLResponse, type ConnectGetOAuthURLParams } from './connect'
|
|
4
|
-
export {
|
|
3
|
+
export { Connect, type ConnectGetOAuthURLResponse, type ConnectGetOAuthURLParams } from './connect';
|
|
4
|
+
export {
|
|
5
|
+
Integrations,
|
|
6
|
+
type IntegrationListResponse,
|
|
7
|
+
type IntegrationDisconnectResponse,
|
|
8
|
+
type IntegrationListParams,
|
|
9
|
+
} from './integrations';
|
|
@@ -7,10 +7,13 @@ import { path } from '../../internal/utils/path';
|
|
|
7
7
|
|
|
8
8
|
export class Integrations extends APIResource {
|
|
9
9
|
/**
|
|
10
|
-
* List
|
|
10
|
+
* List integrations connected to this project
|
|
11
11
|
*/
|
|
12
|
-
list(
|
|
13
|
-
|
|
12
|
+
list(
|
|
13
|
+
query: IntegrationListParams | null | undefined = {},
|
|
14
|
+
options?: RequestOptions,
|
|
15
|
+
): APIPromise<IntegrationListResponse> {
|
|
16
|
+
return this._client.get('/v1/connect/integrations', { query, ...options });
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
/**
|
|
@@ -24,7 +27,16 @@ export class Integrations extends APIResource {
|
|
|
24
27
|
export interface IntegrationListResponse {
|
|
25
28
|
integrations: Array<IntegrationListResponse.Integration>;
|
|
26
29
|
|
|
30
|
+
limit: number;
|
|
31
|
+
|
|
32
|
+
page: number;
|
|
33
|
+
|
|
27
34
|
success: boolean;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Total matched integrations across all pages
|
|
38
|
+
*/
|
|
39
|
+
total: number;
|
|
28
40
|
}
|
|
29
41
|
|
|
30
42
|
export namespace IntegrationListResponse {
|
|
@@ -46,7 +58,7 @@ export namespace IntegrationListResponse {
|
|
|
46
58
|
*/
|
|
47
59
|
imageUrl: string | null;
|
|
48
60
|
|
|
49
|
-
platform: 'twitter' | 'instagram' | 'youtube' | 'tiktok' | 'pinterest' | 'linkedin';
|
|
61
|
+
platform: 'twitter' | 'instagram' | 'youtube' | 'tiktok' | 'pinterest' | 'linkedin' | 'bluesky';
|
|
50
62
|
|
|
51
63
|
/**
|
|
52
64
|
* The user ID on the platform, or null if not yet retrieved
|
|
@@ -61,9 +73,24 @@ export interface IntegrationDisconnectResponse {
|
|
|
61
73
|
success: boolean;
|
|
62
74
|
}
|
|
63
75
|
|
|
76
|
+
export interface IntegrationListParams {
|
|
77
|
+
/**
|
|
78
|
+
* Page size (1-100)
|
|
79
|
+
*/
|
|
80
|
+
limit?: number;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Page number
|
|
84
|
+
*/
|
|
85
|
+
page?: number;
|
|
86
|
+
|
|
87
|
+
platform?: 'twitter' | 'instagram' | 'youtube' | 'tiktok' | 'pinterest' | 'linkedin' | 'bluesky';
|
|
88
|
+
}
|
|
89
|
+
|
|
64
90
|
export declare namespace Integrations {
|
|
65
91
|
export {
|
|
66
92
|
type IntegrationListResponse as IntegrationListResponse,
|
|
67
|
-
type IntegrationDisconnectResponse as IntegrationDisconnectResponse
|
|
93
|
+
type IntegrationDisconnectResponse as IntegrationDisconnectResponse,
|
|
94
|
+
type IntegrationListParams as IntegrationListParams,
|
|
68
95
|
};
|
|
69
96
|
}
|
package/src/resources/health.ts
CHANGED
|
@@ -31,6 +31,6 @@ export interface HealthVerifyAccessKeyResponse {
|
|
|
31
31
|
export declare namespace Health {
|
|
32
32
|
export {
|
|
33
33
|
type HealthCheckResponse as HealthCheckResponse,
|
|
34
|
-
type HealthVerifyAccessKeyResponse as HealthVerifyAccessKeyResponse
|
|
34
|
+
type HealthVerifyAccessKeyResponse as HealthVerifyAccessKeyResponse,
|
|
35
35
|
};
|
|
36
36
|
}
|
package/src/resources/index.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
export { Connect, type ConnectGetOAuthURLResponse, type ConnectGetOAuthURLParams } from './connect/connect'
|
|
4
|
-
export { Health, type HealthCheckResponse, type HealthVerifyAccessKeyResponse } from './health'
|
|
5
|
-
export { Media, type MediaUploadResponse, type MediaUploadParams } from './media'
|
|
6
|
-
export { Platforms, type PlatformListResponse } from './platforms'
|
|
7
|
-
export {
|
|
3
|
+
export { Connect, type ConnectGetOAuthURLResponse, type ConnectGetOAuthURLParams } from './connect/connect';
|
|
4
|
+
export { Health, type HealthCheckResponse, type HealthVerifyAccessKeyResponse } from './health';
|
|
5
|
+
export { Media, type MediaUploadResponse, type MediaUploadParams } from './media';
|
|
6
|
+
export { Platforms, type PlatformListResponse } from './platforms';
|
|
7
|
+
export {
|
|
8
|
+
Posts,
|
|
9
|
+
type Status,
|
|
10
|
+
type PostCreateResponse,
|
|
11
|
+
type PostRetrieveResponse,
|
|
12
|
+
type PostListResponse,
|
|
13
|
+
type PostDeleteResponse,
|
|
14
|
+
type PostCreateParams,
|
|
15
|
+
type PostListParams,
|
|
16
|
+
} from './posts/posts';
|
package/src/resources/media.ts
CHANGED
|
@@ -34,8 +34,5 @@ export interface MediaUploadParams {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export declare namespace Media {
|
|
37
|
-
export {
|
|
38
|
-
type MediaUploadResponse as MediaUploadResponse,
|
|
39
|
-
type MediaUploadParams as MediaUploadParams
|
|
40
|
-
};
|
|
37
|
+
export { type MediaUploadResponse as MediaUploadResponse, type MediaUploadParams as MediaUploadParams };
|
|
41
38
|
}
|
|
@@ -19,14 +19,12 @@ export interface PlatformListResponse {
|
|
|
19
19
|
|
|
20
20
|
export namespace PlatformListResponse {
|
|
21
21
|
export interface Platform {
|
|
22
|
-
name: 'twitter' | 'instagram' | 'youtube' | 'tiktok' | 'pinterest' | 'linkedin';
|
|
22
|
+
name: 'twitter' | 'instagram' | 'youtube' | 'tiktok' | 'pinterest' | 'linkedin' | 'bluesky';
|
|
23
23
|
|
|
24
24
|
status: 'prod' | 'beta' | 'dev';
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export declare namespace Platforms {
|
|
29
|
-
export {
|
|
30
|
-
type PlatformListResponse as PlatformListResponse
|
|
31
|
-
};
|
|
29
|
+
export { type PlatformListResponse as PlatformListResponse };
|
|
32
30
|
}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
export {
|
|
4
|
-
|
|
3
|
+
export {
|
|
4
|
+
Posts,
|
|
5
|
+
type Status,
|
|
6
|
+
type PostCreateResponse,
|
|
7
|
+
type PostRetrieveResponse,
|
|
8
|
+
type PostListResponse,
|
|
9
|
+
type PostDeleteResponse,
|
|
10
|
+
type PostCreateParams,
|
|
11
|
+
type PostListParams,
|
|
12
|
+
} from './posts';
|
|
13
|
+
export {
|
|
14
|
+
Scheduled,
|
|
15
|
+
type ScheduledListResponse,
|
|
16
|
+
type ScheduledCancelResponse,
|
|
17
|
+
type ScheduledRescheduleResponse,
|
|
18
|
+
type ScheduledRescheduleParams,
|
|
19
|
+
} from './scheduled';
|
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../core/resource';
|
|
4
4
|
import * as ScheduledAPI from './scheduled';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
Scheduled,
|
|
7
|
+
ScheduledCancelResponse,
|
|
8
|
+
ScheduledListResponse,
|
|
9
|
+
ScheduledRescheduleParams,
|
|
10
|
+
ScheduledRescheduleResponse,
|
|
11
|
+
} from './scheduled';
|
|
6
12
|
import { APIPromise } from '../../core/api-promise';
|
|
7
13
|
import { RequestOptions } from '../../internal/request-options';
|
|
8
14
|
import { path } from '../../internal/utils/path';
|
|
@@ -49,7 +55,10 @@ export class Posts extends APIResource {
|
|
|
49
55
|
* const posts = await client.posts.list();
|
|
50
56
|
* ```
|
|
51
57
|
*/
|
|
52
|
-
list(
|
|
58
|
+
list(
|
|
59
|
+
query: PostListParams | null | undefined = {},
|
|
60
|
+
options?: RequestOptions,
|
|
61
|
+
): APIPromise<PostListResponse> {
|
|
53
62
|
return this._client.get('/v1/posts/', { query, ...options });
|
|
54
63
|
}
|
|
55
64
|
|
|
@@ -66,7 +75,7 @@ export class Posts extends APIResource {
|
|
|
66
75
|
}
|
|
67
76
|
}
|
|
68
77
|
|
|
69
|
-
export type Status = 'draft' | 'pending' | 'scheduled' | 'publishing' | 'published' | 'failed' | 'partial'
|
|
78
|
+
export type Status = 'draft' | 'pending' | 'scheduled' | 'publishing' | 'published' | 'failed' | 'partial';
|
|
70
79
|
|
|
71
80
|
export interface PostCreateResponse {
|
|
72
81
|
platforms: Array<PostCreateResponse.Platform>;
|
|
@@ -91,7 +100,7 @@ export interface PostCreateResponse {
|
|
|
91
100
|
|
|
92
101
|
export namespace PostCreateResponse {
|
|
93
102
|
export interface Platform {
|
|
94
|
-
platform: 'twitter' | 'instagram' | 'youtube' | 'tiktok' | 'pinterest' | 'linkedin';
|
|
103
|
+
platform: 'twitter' | 'instagram' | 'youtube' | 'tiktok' | 'pinterest' | 'linkedin' | 'bluesky';
|
|
95
104
|
|
|
96
105
|
success: boolean;
|
|
97
106
|
|
|
@@ -104,6 +113,12 @@ export namespace PostCreateResponse {
|
|
|
104
113
|
* Direct URL to the published post
|
|
105
114
|
*/
|
|
106
115
|
platformPostUrl?: string;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Warning message when the post published but a non-critical follow-up action
|
|
119
|
+
* failed
|
|
120
|
+
*/
|
|
121
|
+
warningMessage?: string;
|
|
107
122
|
}
|
|
108
123
|
}
|
|
109
124
|
|
|
@@ -160,7 +175,7 @@ export namespace PostRetrieveResponse {
|
|
|
160
175
|
export interface Platform {
|
|
161
176
|
errorMessage: string | null;
|
|
162
177
|
|
|
163
|
-
platform: 'twitter' | 'instagram' | 'youtube' | 'tiktok' | 'pinterest' | 'linkedin';
|
|
178
|
+
platform: 'twitter' | 'instagram' | 'youtube' | 'tiktok' | 'pinterest' | 'linkedin' | 'bluesky';
|
|
164
179
|
|
|
165
180
|
platformPostId: string | null;
|
|
166
181
|
|
|
@@ -172,6 +187,8 @@ export namespace PostRetrieveResponse {
|
|
|
172
187
|
publishedAt: string | null;
|
|
173
188
|
|
|
174
189
|
status: 'draft' | 'pending' | 'scheduled' | 'publishing' | 'published' | 'failed' | 'partial';
|
|
190
|
+
|
|
191
|
+
warningMessage: string | null;
|
|
175
192
|
}
|
|
176
193
|
}
|
|
177
194
|
}
|
|
@@ -234,7 +251,7 @@ export namespace PostListResponse {
|
|
|
234
251
|
export interface Platform {
|
|
235
252
|
errorMessage: string | null;
|
|
236
253
|
|
|
237
|
-
platform: 'twitter' | 'instagram' | 'youtube' | 'tiktok' | 'pinterest' | 'linkedin';
|
|
254
|
+
platform: 'twitter' | 'instagram' | 'youtube' | 'tiktok' | 'pinterest' | 'linkedin' | 'bluesky';
|
|
238
255
|
|
|
239
256
|
platformPostId: string | null;
|
|
240
257
|
|
|
@@ -246,6 +263,8 @@ export namespace PostListResponse {
|
|
|
246
263
|
publishedAt: string | null;
|
|
247
264
|
|
|
248
265
|
status: 'draft' | 'pending' | 'scheduled' | 'publishing' | 'published' | 'failed' | 'partial';
|
|
266
|
+
|
|
267
|
+
warningMessage: string | null;
|
|
249
268
|
}
|
|
250
269
|
}
|
|
251
270
|
}
|
|
@@ -293,7 +312,7 @@ export namespace PostCreateParams {
|
|
|
293
312
|
*/
|
|
294
313
|
accountId: string;
|
|
295
314
|
|
|
296
|
-
platform: 'twitter' | 'instagram' | 'youtube' | 'tiktok' | 'pinterest' | 'linkedin';
|
|
315
|
+
platform: 'twitter' | 'instagram' | 'youtube' | 'tiktok' | 'pinterest' | 'linkedin' | 'bluesky';
|
|
297
316
|
|
|
298
317
|
/**
|
|
299
318
|
* Platform-specific options. See TwitterConfigurations, YouTubeConfigurations,
|
|
@@ -340,7 +359,7 @@ export interface PostListParams {
|
|
|
340
359
|
/**
|
|
341
360
|
* Filter by platform (repeatable — OR logic)
|
|
342
361
|
*/
|
|
343
|
-
platform?: Array<'twitter' | 'instagram' | 'youtube' | 'tiktok' | 'pinterest' | 'linkedin'>;
|
|
362
|
+
platform?: Array<'twitter' | 'instagram' | 'youtube' | 'tiktok' | 'pinterest' | 'linkedin' | 'bluesky'>;
|
|
344
363
|
|
|
345
364
|
/**
|
|
346
365
|
* ISO 8601 lower bound on scheduledFor
|
|
@@ -367,7 +386,7 @@ export declare namespace Posts {
|
|
|
367
386
|
type PostListResponse as PostListResponse,
|
|
368
387
|
type PostDeleteResponse as PostDeleteResponse,
|
|
369
388
|
type PostCreateParams as PostCreateParams,
|
|
370
|
-
type PostListParams as PostListParams
|
|
389
|
+
type PostListParams as PostListParams,
|
|
371
390
|
};
|
|
372
391
|
|
|
373
392
|
export {
|
|
@@ -375,6 +394,6 @@ export declare namespace Posts {
|
|
|
375
394
|
type ScheduledListResponse as ScheduledListResponse,
|
|
376
395
|
type ScheduledCancelResponse as ScheduledCancelResponse,
|
|
377
396
|
type ScheduledRescheduleResponse as ScheduledRescheduleResponse,
|
|
378
|
-
type ScheduledRescheduleParams as ScheduledRescheduleParams
|
|
397
|
+
type ScheduledRescheduleParams as ScheduledRescheduleParams,
|
|
379
398
|
};
|
|
380
399
|
}
|
|
@@ -43,7 +43,11 @@ export class Scheduled extends APIResource {
|
|
|
43
43
|
* );
|
|
44
44
|
* ```
|
|
45
45
|
*/
|
|
46
|
-
reschedule(
|
|
46
|
+
reschedule(
|
|
47
|
+
postID: string,
|
|
48
|
+
body: ScheduledRescheduleParams,
|
|
49
|
+
options?: RequestOptions,
|
|
50
|
+
): APIPromise<ScheduledRescheduleResponse> {
|
|
47
51
|
return this._client.patch(path`/v1/posts/scheduled/${postID}`, { body, ...options });
|
|
48
52
|
}
|
|
49
53
|
}
|
|
@@ -88,7 +92,7 @@ export namespace ScheduledListResponse {
|
|
|
88
92
|
|
|
89
93
|
export namespace Post {
|
|
90
94
|
export interface Platform {
|
|
91
|
-
platform: 'twitter' | 'instagram' | 'youtube' | 'tiktok' | 'pinterest' | 'linkedin';
|
|
95
|
+
platform: 'twitter' | 'instagram' | 'youtube' | 'tiktok' | 'pinterest' | 'linkedin' | 'bluesky';
|
|
92
96
|
|
|
93
97
|
status: 'draft' | 'pending' | 'scheduled' | 'publishing' | 'published' | 'failed' | 'partial';
|
|
94
98
|
}
|
|
@@ -138,6 +142,6 @@ export declare namespace Scheduled {
|
|
|
138
142
|
type ScheduledListResponse as ScheduledListResponse,
|
|
139
143
|
type ScheduledCancelResponse as ScheduledCancelResponse,
|
|
140
144
|
type ScheduledRescheduleResponse as ScheduledRescheduleResponse,
|
|
141
|
-
type ScheduledRescheduleParams as ScheduledRescheduleParams
|
|
145
|
+
type ScheduledRescheduleParams as ScheduledRescheduleParams,
|
|
142
146
|
};
|
|
143
147
|
}
|