@code.store/arcxp-sdk-ts 5.4.0 → 5.5.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,7 +1,11 @@
1
1
  import { ArcAbstractAPI, type ArcAPIOptions } from '../abstract-api.js';
2
- import type { ListAuthorsParams, ListAuthorsResponse } from './types.js';
2
+ import type { AuthorANS, AuthorConfigurationResponse, CreateAuthorPayload, GetAuthorParams, ListAuthorsParams, ListAuthorsResponse, UpdateAuthorPayload } from './types.js';
3
3
  export declare class ArcAuthor extends ArcAbstractAPI {
4
4
  constructor(options: ArcAPIOptions);
5
+ getAuthor(params: GetAuthorParams): Promise<AuthorANS>;
5
6
  listAuthors(params?: ListAuthorsParams): Promise<ListAuthorsResponse>;
6
- delete(userId: string): Promise<void>;
7
+ createAuthor(payload: CreateAuthorPayload): Promise<AuthorANS>;
8
+ updateAuthor(id: string, payload: UpdateAuthorPayload): Promise<AuthorANS>;
9
+ deleteAuthor(id: string): Promise<void>;
10
+ getConfiguration(): Promise<AuthorConfigurationResponse>;
7
11
  }
@@ -1,4 +1,12 @@
1
1
  export type ListAuthorsParams = Partial<{
2
+ sort_by: 'lastName' | 'last_updated_date';
3
+ order: 'asc' | 'desc';
4
+ byline: string;
5
+ email: string;
6
+ firstName: string;
7
+ lastName: string;
8
+ slug: string;
9
+ include_inactive: boolean;
2
10
  limit: number;
3
11
  last: string;
4
12
  }>;
@@ -7,6 +15,34 @@ export type ListAuthorsResponse = {
7
15
  more?: boolean;
8
16
  last?: string;
9
17
  };
18
+ export type CreateAuthorPayload = Omit<AuthorANS, 'last_updated_date'>;
19
+ export type UpdateAuthorPayload = Partial<Omit<AuthorANS, '_id' | 'last_updated_date'>>;
20
+ export type GetAuthorParams = {
21
+ _id: string;
22
+ };
23
+ export type AuthorConfigurationResponse = {
24
+ q_results: AuthorFieldConfig[];
25
+ count: number;
26
+ limit: number;
27
+ offset: number;
28
+ total_count: number;
29
+ };
30
+ export type AuthorFieldConfig = {
31
+ _id: string;
32
+ key: string;
33
+ label?: string;
34
+ type?: string;
35
+ required?: boolean;
36
+ hidden?: boolean;
37
+ placeholder?: string;
38
+ default?: string;
39
+ max?: number;
40
+ versionAdded?: number;
41
+ picklist_options?: {
42
+ value: string;
43
+ label: string;
44
+ }[];
45
+ };
10
46
  export type AuthorANS = {
11
47
  type: 'author';
12
48
  _id: string;
@@ -16,6 +52,9 @@ export type AuthorANS = {
16
52
  slug: string;
17
53
  email: string;
18
54
  image?: string;
55
+ url?: string;
56
+ middleName?: string;
57
+ suffix?: string;
19
58
  affiliations?: string;
20
59
  author_type?: string;
21
60
  education?: {
@@ -24,6 +63,16 @@ export type AuthorANS = {
24
63
  awards?: {
25
64
  name: string;
26
65
  }[];
66
+ books?: {
67
+ title: string;
68
+ url?: string;
69
+ publisher?: string;
70
+ }[];
71
+ podcasts?: {
72
+ name?: string;
73
+ url?: string;
74
+ download_url?: string;
75
+ }[];
27
76
  bio_page?: string;
28
77
  bio?: string;
29
78
  longBio?: string;
@@ -33,9 +82,22 @@ export type AuthorANS = {
33
82
  location?: string;
34
83
  role?: string;
35
84
  expertise?: string;
85
+ languages?: string;
86
+ beat?: string;
36
87
  personal_website?: string;
37
88
  twitter?: string;
38
89
  facebook?: string;
39
90
  linkedin?: string;
91
+ youtube?: string;
92
+ tumblr?: string;
93
+ pinterest?: string;
94
+ soundcloud?: string;
95
+ instagram?: string;
96
+ rss?: string;
97
+ snapchat?: string;
98
+ whatsapp?: string;
99
+ medium?: string;
100
+ reddit?: string;
101
+ last_updated_date?: string;
40
102
  status?: boolean;
41
103
  };
package/dist/index.cjs CHANGED
@@ -129,12 +129,27 @@ class ArcAuthor extends ArcAbstractAPI {
129
129
  constructor(options) {
130
130
  super({ ...options, apiPath: 'author' });
131
131
  }
132
+ async getAuthor(params) {
133
+ const { data } = await this.client.get('/v1/author-service', { params });
134
+ return data;
135
+ }
132
136
  async listAuthors(params) {
133
137
  const { data } = await this.client.get('/v2/author-service', { params });
134
138
  return data;
135
139
  }
136
- async delete(userId) {
137
- const { data } = await this.client.delete(`/v2/author-service/${userId}`);
140
+ async createAuthor(payload) {
141
+ const { data } = await this.client.post('/v2/author-service', payload);
142
+ return data;
143
+ }
144
+ async updateAuthor(id, payload) {
145
+ const { data } = await this.client.post(`/v2/author-service/${id}`, payload);
146
+ return data;
147
+ }
148
+ async deleteAuthor(id) {
149
+ await this.client.delete(`/v2/author-service/${id}`);
150
+ }
151
+ async getConfiguration() {
152
+ const { data } = await this.client.get('/v1/configuration');
138
153
  return data;
139
154
  }
140
155
  }