@prezly/sdk 19.8.1 → 19.10.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.
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.DEFAULT_USER_AGENT = void 0;
7
- const VERSION = "19.7.1";
7
+ const VERSION = "19.9.0";
8
8
  const URL = 'https://github.com/prezly/javascript-sdk';
9
9
  const DEFAULT_USER_AGENT = exports.DEFAULT_USER_AGENT = `prezly-javascript-sdk/${VERSION} (+${URL})`;
@@ -1,3 +1,3 @@
1
- const VERSION = "19.7.1";
1
+ const VERSION = "19.9.0";
2
2
  const URL = 'https://github.com/prezly/javascript-sdk';
3
3
  export const DEFAULT_USER_AGENT = `prezly-javascript-sdk/${VERSION} (+${URL})`;
@@ -15,7 +15,7 @@ class Client {
15
15
  * @deprecated Use `subscribeToNewsroom` from `Subscriptions` instead
16
16
  */
17
17
  async subscribe(newsroomId, payload) {
18
- const url = _routing.routing.newsroomSubscriptionsUrl.replace(':newsroom_id', String(newsroomId));
18
+ const url = generateUrl(newsroomId);
19
19
  return this.apiClient.post(url, {
20
20
  payload
21
21
  });
@@ -26,7 +26,7 @@ class Client {
26
26
  search,
27
27
  sortOrder
28
28
  } = {}) {
29
- const url = _routing.routing.newsroomSubscriptionsUrl.replace(':newsroom_id', String(newsroomId));
29
+ const url = generateUrl(newsroomId);
30
30
  return this.apiClient.get(url, {
31
31
  query: {
32
32
  limit,
@@ -36,5 +36,16 @@ class Client {
36
36
  }
37
37
  });
38
38
  }
39
+ async export(newsroomId) {
40
+ const url = generateUrl(newsroomId, '/export');
41
+ const response = await this.apiClient.post(url);
42
+ return {
43
+ downloadUrl: response.download_url
44
+ };
45
+ }
39
46
  }
40
- exports.Client = Client;
47
+ exports.Client = Client;
48
+ function generateUrl(newsroomId, suffix = '') {
49
+ const url = _routing.routing.newsroomSubscriptionsUrl.replace(':newsroom_id', String(newsroomId));
50
+ return url + suffix;
51
+ }
@@ -10,5 +10,8 @@ export declare class Client {
10
10
  */
11
11
  subscribe(newsroomId: NewsroomId, payload: CreateRequest): Promise<void>;
12
12
  list(newsroomId: NewsroomId, { limit, offset, search, sortOrder }?: ListOptions): Promise<ListResponse>;
13
+ export(newsroomId: NewsroomId): Promise<{
14
+ downloadUrl: string;
15
+ }>;
13
16
  }
14
17
  export {};
@@ -9,7 +9,7 @@ export class Client {
9
9
  * @deprecated Use `subscribeToNewsroom` from `Subscriptions` instead
10
10
  */
11
11
  async subscribe(newsroomId, payload) {
12
- const url = routing.newsroomSubscriptionsUrl.replace(':newsroom_id', String(newsroomId));
12
+ const url = generateUrl(newsroomId);
13
13
  return this.apiClient.post(url, {
14
14
  payload
15
15
  });
@@ -20,7 +20,7 @@ export class Client {
20
20
  search,
21
21
  sortOrder
22
22
  } = {}) {
23
- const url = routing.newsroomSubscriptionsUrl.replace(':newsroom_id', String(newsroomId));
23
+ const url = generateUrl(newsroomId);
24
24
  return this.apiClient.get(url, {
25
25
  query: {
26
26
  limit,
@@ -30,4 +30,15 @@ export class Client {
30
30
  }
31
31
  });
32
32
  }
33
+ async export(newsroomId) {
34
+ const url = generateUrl(newsroomId, '/export');
35
+ const response = await this.apiClient.post(url);
36
+ return {
37
+ downloadUrl: response.download_url
38
+ };
39
+ }
40
+ }
41
+ function generateUrl(newsroomId, suffix = '') {
42
+ const url = routing.newsroomSubscriptionsUrl.replace(':newsroom_id', String(newsroomId));
43
+ return url + suffix;
33
44
  }
@@ -3,7 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Category = void 0;
6
+ exports.CategoryRef = exports.Category = void 0;
7
+ let CategoryRef = exports.CategoryRef = void 0;
7
8
  let Category = exports.Category = void 0;
8
9
  (function (_Category) {
9
10
  function isTranslated(category, locale) {
@@ -26,7 +27,8 @@ let Category = exports.Category = void 0;
26
27
  locale: translation.locale.code,
27
28
  slug: translation.slug,
28
29
  name: translation.name,
29
- description: translation.description
30
+ description: translation.description,
31
+ public_stories_number: translation.public_stories_number
30
32
  };
31
33
  });
32
34
  return [...result, ...translated];
@@ -4,21 +4,28 @@ export interface CategoryRef {
4
4
  display_name: string;
5
5
  display_description: string | null;
6
6
  i18n: {
7
- [localeCode: Culture.Code]: Category.Translation;
7
+ [localeCode: Culture.Code]: CategoryRef.Translation;
8
8
  };
9
- stories_number: number;
10
- }
11
- export interface Category extends CategoryRef {
12
- stories_number: number;
13
- public_stories_number: number;
14
9
  }
15
- export declare namespace Category {
10
+ export declare namespace CategoryRef {
16
11
  interface Translation {
17
12
  locale: CultureRef;
18
13
  slug: string | null;
19
14
  name: string;
20
15
  description: string | null;
21
16
  }
17
+ }
18
+ export interface Category extends Omit<CategoryRef, 'i18n'> {
19
+ stories_number: number;
20
+ public_stories_number: number;
21
+ i18n: {
22
+ [localeCode: Culture.Code]: Category.Translation;
23
+ };
24
+ }
25
+ export declare namespace Category {
26
+ interface Translation extends CategoryRef.Translation {
27
+ public_stories_number: number;
28
+ }
22
29
  function isTranslated<T extends Category, LocaleCode extends Culture['code']>(category: T, locale: LocaleIdentifier<LocaleCode>): category is WithNonEmptyTranslation<T, LocaleCode>;
23
30
  function translation<T extends Category, LocaleCode extends Culture['code']>(category: T, locale: LocaleIdentifier<LocaleCode>): T extends WithNonEmptyTranslation<Category, LocaleCode> ? TranslatedCategory : TranslatedCategory | undefined;
24
31
  function translations(category: Category, locale?: LocaleIdentifier): TranslatedCategory[];
@@ -30,6 +37,7 @@ export interface TranslatedCategory {
30
37
  slug: NonNullable<Category.Translation['slug']>;
31
38
  name: Category.Translation['name'];
32
39
  description: Category.Translation['description'];
40
+ public_stories_number: Category.Translation['public_stories_number'];
33
41
  }
34
42
  type LocaleIdentifier<Locale extends Culture['code'] = Culture['code']> = Locale | {
35
43
  code: Locale;
@@ -1,3 +1,4 @@
1
+ export let CategoryRef;
1
2
  export let Category;
2
3
  (function (_Category) {
3
4
  function isTranslated(category, locale) {
@@ -20,7 +21,8 @@ export let Category;
20
21
  locale: translation.locale.code,
21
22
  slug: translation.slug,
22
23
  name: translation.name,
23
- description: translation.description
24
+ description: translation.description,
25
+ public_stories_number: translation.public_stories_number
24
26
  };
25
27
  });
26
28
  return [...result, ...translated];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prezly/sdk",
3
- "version": "19.8.1",
3
+ "version": "19.10.0",
4
4
  "description": "Prezly API SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",