@c-rex/services 0.1.2 → 0.1.3

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/dist/index.d.mts CHANGED
@@ -44,30 +44,100 @@ declare class BaseService {
44
44
  }): Promise<T>;
45
45
  }
46
46
 
47
+ /**
48
+ * Service for interacting with renditions in the API.
49
+ * Provides methods to retrieve and process different types of renditions.
50
+ */
47
51
  declare class RenditionsService extends BaseService {
48
52
  constructor();
49
- getHTMLRendition(renditions: informationUnitsRenditions[]): Promise<string>;
50
- getFileRenditions: (renditions: informationUnitsRenditions[]) => {
53
+ /**
54
+ * Retrieves the HTML rendition from a list of renditions.
55
+ * Filters for renditions with format 'application/xhtml+xml' and rel 'view'.
56
+ *
57
+ * @param renditions - Array of rendition objects to process
58
+ * @returns A promise that resolves to the HTML content as a string, or empty string if no suitable rendition is found
59
+ * @throws Error if the API request fails
60
+ */
61
+ getHTMLRendition({ renditions }: {
62
+ renditions: informationUnitsRenditions[];
63
+ }): Promise<string>;
64
+ /**
65
+ * Processes a list of renditions and categorizes them into files to download and files to open.
66
+ * Excludes renditions with formats 'application/xhtml+xml', 'application/json', and 'application/llm+xml'.
67
+ *
68
+ * @param renditions - Array of rendition objects to process
69
+ * @returns An object containing arrays of file renditions categorized as 'filesToDownload' and 'filesToOpen'
70
+ */
71
+ getFileRenditions: ({ renditions }: {
72
+ renditions: informationUnitsRenditions[];
73
+ }) => {
51
74
  filesToDownload: FileRenditionType[];
52
75
  filesToOpen: FileRenditionType[];
53
76
  };
54
77
  }
55
78
 
79
+ /**
80
+ * Service for interacting with directory nodes in the API.
81
+ * Provides methods to retrieve directory node information.
82
+ */
56
83
  declare class DirectoryNodesService extends BaseService {
57
84
  constructor();
85
+ /**
86
+ * Retrieves a specific directory node by its ID.
87
+ *
88
+ * @param id - The unique identifier of the directory node
89
+ * @returns A promise that resolves to the directory node data
90
+ * @throws Error if the API request fails
91
+ */
58
92
  getItem(id: string): Promise<DirectoryNodes>;
93
+ /**
94
+ * Retrieves a list of directory nodes based on specified filters.
95
+ *
96
+ * @param options - Options for filtering the directory nodes list
97
+ * @param options.filters - Optional array of filter strings to apply
98
+ * @returns A promise that resolves to the directory nodes response
99
+ * @throws Error if the API request fails
100
+ */
59
101
  getList({ filters, }: {
60
102
  filters?: string[];
61
103
  }): Promise<DirectoryNodesResponse>;
62
104
  }
63
105
 
106
+ /**
107
+ * Service for interacting with document types in the API.
108
+ * Provides methods to retrieve document type information.
109
+ */
64
110
  declare class DocumentTypesService extends BaseService {
65
111
  constructor();
112
+ /**
113
+ * Retrieves document type labels for the specified fields.
114
+ * The labels are restricted to English language (EN-us).
115
+ *
116
+ * @param fields - Array of field names to retrieve labels for
117
+ * @returns A promise that resolves to an array of label strings
118
+ * @throws Error if the API request fails
119
+ */
66
120
  getLabels(fields: string[]): Promise<string[]>;
67
121
  }
68
122
 
123
+ /**
124
+ * Service for interacting with information units in the API.
125
+ * Provides methods to retrieve and search information units.
126
+ */
69
127
  declare class InformationUnitsService extends BaseService {
70
128
  constructor();
129
+ /**
130
+ * Retrieves a list of information units based on specified criteria.
131
+ *
132
+ * @param options - Options for filtering and paginating the information units list
133
+ * @param options.queries - Optional search query string
134
+ * @param options.page - Optional page number for pagination (defaults to 1)
135
+ * @param options.fields - Optional array of fields to include in the response
136
+ * @param options.filters - Optional array of filter strings to apply
137
+ * @param options.languages - Optional array of language codes to filter by
138
+ * @returns A promise that resolves to the information units response
139
+ * @throws Error if the API request fails
140
+ */
71
141
  getList({ queries, page, fields, filters, languages }: {
72
142
  queries?: string;
73
143
  page?: number;
@@ -75,16 +145,46 @@ declare class InformationUnitsService extends BaseService {
75
145
  fields?: string[];
76
146
  languages?: string[];
77
147
  }): Promise<informationUnitsResponse>;
148
+ /**
149
+ * Retrieves a specific information unit by its ID.
150
+ * Includes renditions, directory nodes, version information, titles, languages, and labels.
151
+ *
152
+ * @param options - Options for retrieving the information unit
153
+ * @param options.id - The unique identifier of the information unit
154
+ * @returns A promise that resolves to the information unit data
155
+ * @throws Error if the API request fails
156
+ */
78
157
  getItem({ id }: {
79
158
  id: string;
80
159
  }): Promise<informationUnitsItems>;
81
- getSuggestions({ query }: {
160
+ /**
161
+ * Retrieves autocomplete suggestions based on a query prefix.
162
+ *
163
+ * @param options - Options for retrieving suggestions
164
+ * @param options.query - The query prefix to get suggestions for
165
+ * @param options.language - The language of the suggestions
166
+ * @returns A promise that resolves to an array of suggestion strings
167
+ * @throws Error if the API request fails
168
+ */
169
+ getSuggestions({ query, language }: {
82
170
  query: string;
171
+ language: string;
83
172
  }): Promise<string[]>;
84
173
  }
85
174
 
175
+ /**
176
+ * Service for interacting with language-related functionality in the API.
177
+ * Provides methods to retrieve language and country information.
178
+ */
86
179
  declare class LanguageService extends BaseService {
87
- constructor(endpoint: string);
180
+ constructor();
181
+ /**
182
+ * Retrieves a list of available languages and their associated countries.
183
+ * Transforms the API response to include language code, country code, and original value.
184
+ *
185
+ * @returns A promise that resolves to an array of language and country objects
186
+ * @throws Error if the API request fails
187
+ */
88
188
  getLanguagesAndCountries(): Promise<LanguageAndCountries[]>;
89
189
  }
90
190
 
package/dist/index.d.ts CHANGED
@@ -44,30 +44,100 @@ declare class BaseService {
44
44
  }): Promise<T>;
45
45
  }
46
46
 
47
+ /**
48
+ * Service for interacting with renditions in the API.
49
+ * Provides methods to retrieve and process different types of renditions.
50
+ */
47
51
  declare class RenditionsService extends BaseService {
48
52
  constructor();
49
- getHTMLRendition(renditions: informationUnitsRenditions[]): Promise<string>;
50
- getFileRenditions: (renditions: informationUnitsRenditions[]) => {
53
+ /**
54
+ * Retrieves the HTML rendition from a list of renditions.
55
+ * Filters for renditions with format 'application/xhtml+xml' and rel 'view'.
56
+ *
57
+ * @param renditions - Array of rendition objects to process
58
+ * @returns A promise that resolves to the HTML content as a string, or empty string if no suitable rendition is found
59
+ * @throws Error if the API request fails
60
+ */
61
+ getHTMLRendition({ renditions }: {
62
+ renditions: informationUnitsRenditions[];
63
+ }): Promise<string>;
64
+ /**
65
+ * Processes a list of renditions and categorizes them into files to download and files to open.
66
+ * Excludes renditions with formats 'application/xhtml+xml', 'application/json', and 'application/llm+xml'.
67
+ *
68
+ * @param renditions - Array of rendition objects to process
69
+ * @returns An object containing arrays of file renditions categorized as 'filesToDownload' and 'filesToOpen'
70
+ */
71
+ getFileRenditions: ({ renditions }: {
72
+ renditions: informationUnitsRenditions[];
73
+ }) => {
51
74
  filesToDownload: FileRenditionType[];
52
75
  filesToOpen: FileRenditionType[];
53
76
  };
54
77
  }
55
78
 
79
+ /**
80
+ * Service for interacting with directory nodes in the API.
81
+ * Provides methods to retrieve directory node information.
82
+ */
56
83
  declare class DirectoryNodesService extends BaseService {
57
84
  constructor();
85
+ /**
86
+ * Retrieves a specific directory node by its ID.
87
+ *
88
+ * @param id - The unique identifier of the directory node
89
+ * @returns A promise that resolves to the directory node data
90
+ * @throws Error if the API request fails
91
+ */
58
92
  getItem(id: string): Promise<DirectoryNodes>;
93
+ /**
94
+ * Retrieves a list of directory nodes based on specified filters.
95
+ *
96
+ * @param options - Options for filtering the directory nodes list
97
+ * @param options.filters - Optional array of filter strings to apply
98
+ * @returns A promise that resolves to the directory nodes response
99
+ * @throws Error if the API request fails
100
+ */
59
101
  getList({ filters, }: {
60
102
  filters?: string[];
61
103
  }): Promise<DirectoryNodesResponse>;
62
104
  }
63
105
 
106
+ /**
107
+ * Service for interacting with document types in the API.
108
+ * Provides methods to retrieve document type information.
109
+ */
64
110
  declare class DocumentTypesService extends BaseService {
65
111
  constructor();
112
+ /**
113
+ * Retrieves document type labels for the specified fields.
114
+ * The labels are restricted to English language (EN-us).
115
+ *
116
+ * @param fields - Array of field names to retrieve labels for
117
+ * @returns A promise that resolves to an array of label strings
118
+ * @throws Error if the API request fails
119
+ */
66
120
  getLabels(fields: string[]): Promise<string[]>;
67
121
  }
68
122
 
123
+ /**
124
+ * Service for interacting with information units in the API.
125
+ * Provides methods to retrieve and search information units.
126
+ */
69
127
  declare class InformationUnitsService extends BaseService {
70
128
  constructor();
129
+ /**
130
+ * Retrieves a list of information units based on specified criteria.
131
+ *
132
+ * @param options - Options for filtering and paginating the information units list
133
+ * @param options.queries - Optional search query string
134
+ * @param options.page - Optional page number for pagination (defaults to 1)
135
+ * @param options.fields - Optional array of fields to include in the response
136
+ * @param options.filters - Optional array of filter strings to apply
137
+ * @param options.languages - Optional array of language codes to filter by
138
+ * @returns A promise that resolves to the information units response
139
+ * @throws Error if the API request fails
140
+ */
71
141
  getList({ queries, page, fields, filters, languages }: {
72
142
  queries?: string;
73
143
  page?: number;
@@ -75,16 +145,46 @@ declare class InformationUnitsService extends BaseService {
75
145
  fields?: string[];
76
146
  languages?: string[];
77
147
  }): Promise<informationUnitsResponse>;
148
+ /**
149
+ * Retrieves a specific information unit by its ID.
150
+ * Includes renditions, directory nodes, version information, titles, languages, and labels.
151
+ *
152
+ * @param options - Options for retrieving the information unit
153
+ * @param options.id - The unique identifier of the information unit
154
+ * @returns A promise that resolves to the information unit data
155
+ * @throws Error if the API request fails
156
+ */
78
157
  getItem({ id }: {
79
158
  id: string;
80
159
  }): Promise<informationUnitsItems>;
81
- getSuggestions({ query }: {
160
+ /**
161
+ * Retrieves autocomplete suggestions based on a query prefix.
162
+ *
163
+ * @param options - Options for retrieving suggestions
164
+ * @param options.query - The query prefix to get suggestions for
165
+ * @param options.language - The language of the suggestions
166
+ * @returns A promise that resolves to an array of suggestion strings
167
+ * @throws Error if the API request fails
168
+ */
169
+ getSuggestions({ query, language }: {
82
170
  query: string;
171
+ language: string;
83
172
  }): Promise<string[]>;
84
173
  }
85
174
 
175
+ /**
176
+ * Service for interacting with language-related functionality in the API.
177
+ * Provides methods to retrieve language and country information.
178
+ */
86
179
  declare class LanguageService extends BaseService {
87
- constructor(endpoint: string);
180
+ constructor();
181
+ /**
182
+ * Retrieves a list of available languages and their associated countries.
183
+ * Transforms the API response to include language code, country code, and original value.
184
+ *
185
+ * @returns A promise that resolves to an array of language and country objects
186
+ * @throws Error if the API request fails
187
+ */
88
188
  getLanguagesAndCountries(): Promise<LanguageAndCountries[]>;
89
189
  }
90
190