@streamscloud/streams-api-client 3.2.0 → 3.2.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.
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Post, Stream } from './types';
|
|
2
2
|
export declare class EmbedContentApiClient {
|
|
3
3
|
private readonly gqlEndpoint;
|
|
4
|
-
private readonly
|
|
5
|
-
constructor(gqlEndpoint: string,
|
|
4
|
+
private readonly clientId;
|
|
5
|
+
constructor(gqlEndpoint: string, clientId: string);
|
|
6
6
|
getPosts(ids: string[]): Promise<Post[] | undefined>;
|
|
7
7
|
getStreams(ids: string[]): Promise<Stream[] | undefined>;
|
|
8
8
|
private queryGql;
|
|
@@ -3,10 +3,10 @@ import EmbedStreamsQuery from './operations/streams-query.graphql.js';
|
|
|
3
3
|
|
|
4
4
|
class EmbedContentApiClient {
|
|
5
5
|
gqlEndpoint;
|
|
6
|
-
|
|
7
|
-
constructor(gqlEndpoint,
|
|
6
|
+
clientId;
|
|
7
|
+
constructor(gqlEndpoint, clientId) {
|
|
8
8
|
this.gqlEndpoint = gqlEndpoint;
|
|
9
|
-
this.
|
|
9
|
+
this.clientId = clientId;
|
|
10
10
|
}
|
|
11
11
|
async getPosts(ids) {
|
|
12
12
|
const response = await this.queryGql(EmbedPostsQuery, {
|
|
@@ -33,7 +33,7 @@ class EmbedContentApiClient {
|
|
|
33
33
|
method: 'POST',
|
|
34
34
|
headers: {
|
|
35
35
|
'Content-Type': 'application/json',
|
|
36
|
-
'x-initiator': this.
|
|
36
|
+
'x-initiator': this.clientId
|
|
37
37
|
},
|
|
38
38
|
body: JSON.stringify({
|
|
39
39
|
query,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { EmbedContentApiClient } from './embed-content-api-client';
|
|
2
|
-
export declare const createEmbedContentClient: (endpointUrl: string,
|
|
2
|
+
export declare const createEmbedContentClient: (endpointUrl: string, clientId?: string) => EmbedContentApiClient;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EmbedContentApiClient } from './embed-content-api-client.js';
|
|
2
2
|
|
|
3
|
-
const createEmbedContentClient = (endpointUrl,
|
|
3
|
+
const createEmbedContentClient = (endpointUrl, clientId) => new EmbedContentApiClient(endpointUrl, clientId ?? '');
|
|
4
4
|
|
|
5
5
|
export { createEmbedContentClient };
|