@prezly/sdk 11.0.0 → 11.1.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.
@@ -1,3 +1,3 @@
1
- const VERSION = "10.4.0";
1
+ const VERSION = "11.0.0";
2
2
  const URL = 'https://github.com/prezly/javascript-sdk';
3
3
  export const DEFAULT_USER_AGENT = `prezly-javascript-sdk/${VERSION} (+${URL})`;
@@ -1,6 +1,6 @@
1
1
  import type { DeferredJobsApiClient } from '../../api';
2
2
  import type { ExtendedStory, Story } from '../../types';
3
- import type { AutosaveRequest, ChangeNewsroomSuccessResponse, ChangeNewsroomUnsafeResponse, CreateRequest, IncludeOptions, ListOptions, ListResponse, MoveRequest, PublishRequest, RevertRequest, ScheduleRequest, SearchOptions, UnpublishRequest, UnscheduleRequest, UpdateRequest } from './types';
3
+ import type { AutosaveRequest, ChangeNewsroomSuccessResponse, ChangeNewsroomUnsafeResponse, CreateRequest, IncludeOptions, ListOptions, ListResponse, MoveRequest, PublishRequest, RevertRequest, ScheduleRequest, SearchOptions, TranslateRequest, UnpublishRequest, UnscheduleRequest, UpdateRequest } from './types';
4
4
  /**
5
5
  * `uuid` is the preferred way of targeting a Story. Numeric `id` is considered deprecated.
6
6
  */
@@ -30,6 +30,7 @@ export declare class Client {
30
30
  get<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(ids: Story['id'][], options?: Options): Promise<StoryRecord[]>;
31
31
  create<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(payload: CreateRequest, options?: Options): Promise<StoryRecord>;
32
32
  duplicate<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, options?: Options): Promise<StoryRecord>;
33
+ translate<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include>, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload: TranslateRequest, options?: Options): Promise<StoryRecord>;
33
34
  move<Include extends readonly (keyof Story.ExtraFields)[], Options extends IncludeOptions<Include> & {
34
35
  force?: true;
35
36
  }, StoryRecord extends ExtendedStory = Options['include'] extends Include ? ExtendedStory & Pick<Story.ExtraFields, Options['include'][number]> : ExtendedStory>(id: StoryId, payload: MoveRequest, options?: Options): Promise<ChangeNewsroomSuccessResponse<StoryRecord> | ChangeNewsroomUnsafeResponse>;
@@ -115,6 +115,19 @@ export class Client {
115
115
  });
116
116
  return story;
117
117
  }
118
+ async translate(id, payload, options) {
119
+ const include = options?.include;
120
+ const url = `${routing.storiesUrl}/${id}/translate`;
121
+ const {
122
+ story
123
+ } = await this.apiClient.post(url, {
124
+ query: {
125
+ include: include
126
+ },
127
+ payload
128
+ });
129
+ return story;
130
+ }
118
131
  async move(id, payload, options) {
119
132
  const include = options?.include;
120
133
  const force = options?.force;
@@ -146,6 +146,9 @@ export interface ScheduleRequest {
146
146
  visibility?: Story.Visibility.PUBLIC | Story.Visibility.EMBARGO;
147
147
  }
148
148
  export declare type UnscheduleRequest = UnpublishRequest;
149
+ export interface TranslateRequest {
150
+ culture: CultureRef['code'];
151
+ }
149
152
  export interface MoveRequest {
150
153
  newsroom: Newsroom['uuid'] | Newsroom['id'];
151
154
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prezly/sdk",
3
- "version": "11.0.0",
3
+ "version": "11.1.0",
4
4
  "description": "Prezly API SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",