@fern-api/generator-cli 0.1.8 → 0.3.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.
package/dist/api.d.cts ADDED
@@ -0,0 +1,586 @@
1
+ import fs from 'fs';
2
+
3
+ /**
4
+ * This file was auto-generated by Fern from our API Definition.
5
+ */
6
+
7
+ /**
8
+ * A unique identifier for a feature (e.g. OPTIONALS). This is typed as a freeform string
9
+ * to allow for arbitrary features, but callers are expected to use the StructuredFeatureId
10
+ * string representation whenever possible.
11
+ */
12
+ type FeatureId = string | StructuredFeatureId;
13
+
14
+ /**
15
+ * This file was auto-generated by Fern from our API Definition.
16
+ */
17
+ /**
18
+ * Unique identifiers for features that can be demonstrated with snippets.
19
+ */
20
+ type StructuredFeatureId = "AUTHENTICATION" | "ERRORS" | "USAGE" | "PAGINATION" | "RETRIES" | "REQUEST_OPTIONS" | "STREAMING" | "TIMEOUTS" | "CUSTOM_CLIENT" | "CONTRIBUTING";
21
+ declare const StructuredFeatureId: {
22
+ readonly Authentication: "AUTHENTICATION";
23
+ readonly Errors: "ERRORS";
24
+ readonly Usage: "USAGE";
25
+ readonly Pagination: "PAGINATION";
26
+ readonly Retries: "RETRIES";
27
+ readonly RequestOptions: "REQUEST_OPTIONS";
28
+ readonly Streaming: "STREAMING";
29
+ readonly Timeouts: "TIMEOUTS";
30
+ readonly CustomClient: "CUSTOM_CLIENT";
31
+ readonly Contributing: "CONTRIBUTING";
32
+ readonly _visit: <R>(value: StructuredFeatureId, visitor: StructuredFeatureId.Visitor<R>) => R;
33
+ };
34
+ declare namespace StructuredFeatureId {
35
+ interface Visitor<R> {
36
+ authentication: () => R;
37
+ errors: () => R;
38
+ usage: () => R;
39
+ pagination: () => R;
40
+ retries: () => R;
41
+ requestOptions: () => R;
42
+ streaming: () => R;
43
+ timeouts: () => R;
44
+ customClient: () => R;
45
+ contributing: () => R;
46
+ _other: () => R;
47
+ }
48
+ }
49
+
50
+ /**
51
+ * This file was auto-generated by Fern from our API Definition.
52
+ */
53
+
54
+ /**
55
+ * A specification for a feature supported by a generator. This includes the
56
+ * feature's ID, a description, and any additional information that should be
57
+ * included in the README.md.
58
+ */
59
+ interface FeatureSpec {
60
+ id: FeatureId;
61
+ description?: string;
62
+ addendum?: string;
63
+ advanced?: boolean;
64
+ }
65
+
66
+ /**
67
+ * This file was auto-generated by Fern from our API Definition.
68
+ */
69
+ /**
70
+ * The configuration used to interact with a GitHub repository.
71
+ */
72
+ interface GitHubConfig {
73
+ /** The directory from which to read the contents of the GitHub repository. */
74
+ sourceDirectory: string;
75
+ /** The URI of the GitHub repository. */
76
+ uri: string;
77
+ /** The token used to access the GitHub repository. */
78
+ token: string;
79
+ /** The branch to use when interacting with the GitHub repository. */
80
+ branch?: string;
81
+ }
82
+
83
+ /**
84
+ * This file was auto-generated by Fern from our API Definition.
85
+ */
86
+
87
+ /**
88
+ * The configuration used to generate a README.md file.
89
+ * The information described here is a combination of user-defined information
90
+ * (i.e. specified in the generators.yml), and dynamically generated information
91
+ * that comes from each generator (i.e. features, requirements, and more).
92
+ */
93
+ interface ReadmeConfig {
94
+ /** If specified, the original README.md will be fetched from this remote (if it exists). */
95
+ remote?: Remote;
96
+ language: LanguageInfo;
97
+ organization: string;
98
+ apiName?: string;
99
+ bannerLink?: string;
100
+ introduction?: string;
101
+ apiReferenceLink?: string;
102
+ referenceMarkdownPath?: string;
103
+ requirements?: string[];
104
+ disabledFeatures?: FeatureId[];
105
+ whiteLabel?: boolean;
106
+ customSections?: CustomSection[];
107
+ /**
108
+ * Specifies the list of features supported by a specific generator.
109
+ * The features are rendered in the order they're specified.
110
+ */
111
+ features?: ReadmeFeature[];
112
+ /** Controls whether usage examples show only required parameters (minimal) or all parameters (comprehensive). Defaults to comprehensive. */
113
+ exampleStyle?: ExampleStyle;
114
+ }
115
+
116
+ /**
117
+ * This file was auto-generated by Fern from our API Definition.
118
+ */
119
+
120
+ interface CustomSection {
121
+ name: string;
122
+ language: Language;
123
+ content: string;
124
+ }
125
+
126
+ /**
127
+ * This file was auto-generated by Fern from our API Definition.
128
+ */
129
+
130
+ /**
131
+ * The remote where the README.md is hosted.
132
+ */
133
+ type Remote = Remote.Github;
134
+ declare namespace Remote {
135
+ interface Github extends GithubRemote, _Utils {
136
+ type: "github";
137
+ }
138
+ interface _Utils {
139
+ _visit: <_Result>(visitor: Remote._Visitor<_Result>) => _Result;
140
+ }
141
+ interface _Visitor<_Result> {
142
+ github: (value: GithubRemote) => _Result;
143
+ _other: (value: {
144
+ type: string;
145
+ }) => _Result;
146
+ }
147
+ }
148
+ declare const Remote: {
149
+ readonly github: (value: GithubRemote) => Remote.Github;
150
+ readonly _visit: <_Result>(value: Remote, visitor: Remote._Visitor<_Result>) => _Result;
151
+ };
152
+
153
+ /**
154
+ * This file was auto-generated by Fern from our API Definition.
155
+ */
156
+ interface GithubRemote {
157
+ /** A full repo url (i.e. https://github.com/fern-api/fern) */
158
+ repoUrl: string;
159
+ /** The token used to clone the GitHub repository. */
160
+ installationToken: string;
161
+ }
162
+
163
+ /**
164
+ * This file was auto-generated by Fern from our API Definition.
165
+ */
166
+
167
+ /**
168
+ * A single feature supported by a generator (e.g. PAGINATION).
169
+ */
170
+ interface ReadmeFeature extends FeatureSpec {
171
+ snippets?: string[];
172
+ /**
173
+ * If true, the feature block should be rendered even if we don't receive a snippet for it.
174
+ * This is useful for features that are always supported, but might not require a snippet
175
+ * to explain.
176
+ */
177
+ snippetsAreOptional: boolean;
178
+ }
179
+
180
+ /**
181
+ * This file was auto-generated by Fern from our API Definition.
182
+ */
183
+
184
+ /**
185
+ * The language and its associated publish information (if any).
186
+ * This is used to generate badges, the installation guide, and determine what language to
187
+ * use when surrounding the snippets in a code block.
188
+ */
189
+ type LanguageInfo = LanguageInfo.Typescript | LanguageInfo.Python | LanguageInfo.Go | LanguageInfo.Java | LanguageInfo.Ruby | LanguageInfo.Csharp | LanguageInfo.Php | LanguageInfo.Rust | LanguageInfo.Swift;
190
+ declare namespace LanguageInfo {
191
+ interface Typescript extends TypescriptInfo, _Utils {
192
+ type: "typescript";
193
+ }
194
+ interface Python extends PythonInfo, _Utils {
195
+ type: "python";
196
+ }
197
+ interface Go extends GoInfo, _Utils {
198
+ type: "go";
199
+ }
200
+ interface Java extends JavaInfo, _Utils {
201
+ type: "java";
202
+ }
203
+ interface Ruby extends RubyInfo, _Utils {
204
+ type: "ruby";
205
+ }
206
+ interface Csharp extends CsharpInfo, _Utils {
207
+ type: "csharp";
208
+ }
209
+ interface Php extends PhpInfo, _Utils {
210
+ type: "php";
211
+ }
212
+ interface Rust extends RustInfo, _Utils {
213
+ type: "rust";
214
+ }
215
+ interface Swift extends SwiftInfo, _Utils {
216
+ type: "swift";
217
+ }
218
+ interface _Utils {
219
+ _visit: <_Result>(visitor: LanguageInfo._Visitor<_Result>) => _Result;
220
+ }
221
+ interface _Visitor<_Result> {
222
+ typescript: (value: TypescriptInfo) => _Result;
223
+ python: (value: PythonInfo) => _Result;
224
+ go: (value: GoInfo) => _Result;
225
+ java: (value: JavaInfo) => _Result;
226
+ ruby: (value: RubyInfo) => _Result;
227
+ csharp: (value: CsharpInfo) => _Result;
228
+ php: (value: PhpInfo) => _Result;
229
+ rust: (value: RustInfo) => _Result;
230
+ swift: (value: SwiftInfo) => _Result;
231
+ _other: (value: {
232
+ type: string;
233
+ }) => _Result;
234
+ }
235
+ }
236
+ declare const LanguageInfo: {
237
+ readonly typescript: (value: TypescriptInfo) => LanguageInfo.Typescript;
238
+ readonly python: (value: PythonInfo) => LanguageInfo.Python;
239
+ readonly go: (value: GoInfo) => LanguageInfo.Go;
240
+ readonly java: (value: JavaInfo) => LanguageInfo.Java;
241
+ readonly ruby: (value: RubyInfo) => LanguageInfo.Ruby;
242
+ readonly csharp: (value: CsharpInfo) => LanguageInfo.Csharp;
243
+ readonly php: (value: PhpInfo) => LanguageInfo.Php;
244
+ readonly rust: (value: RustInfo) => LanguageInfo.Rust;
245
+ readonly swift: (value: SwiftInfo) => LanguageInfo.Swift;
246
+ readonly _visit: <_Result>(value: LanguageInfo, visitor: LanguageInfo._Visitor<_Result>) => _Result;
247
+ };
248
+
249
+ /**
250
+ * This file was auto-generated by Fern from our API Definition.
251
+ */
252
+
253
+ interface TypescriptInfo {
254
+ publishInfo?: NpmPublishInfo;
255
+ }
256
+
257
+ /**
258
+ * This file was auto-generated by Fern from our API Definition.
259
+ */
260
+
261
+ interface PythonInfo {
262
+ publishInfo?: PypiPublishInfo;
263
+ }
264
+
265
+ /**
266
+ * This file was auto-generated by Fern from our API Definition.
267
+ */
268
+
269
+ interface GoInfo {
270
+ publishInfo?: GoPublishInfo;
271
+ }
272
+
273
+ /**
274
+ * This file was auto-generated by Fern from our API Definition.
275
+ */
276
+
277
+ interface JavaInfo {
278
+ publishInfo?: MavenPublishInfo;
279
+ }
280
+
281
+ /**
282
+ * This file was auto-generated by Fern from our API Definition.
283
+ */
284
+
285
+ interface RubyInfo {
286
+ publishInfo?: RubyGemsPublishInfo;
287
+ }
288
+
289
+ /**
290
+ * This file was auto-generated by Fern from our API Definition.
291
+ */
292
+
293
+ interface CsharpInfo {
294
+ publishInfo?: NugetPublishInfo;
295
+ }
296
+
297
+ /**
298
+ * This file was auto-generated by Fern from our API Definition.
299
+ */
300
+
301
+ interface PhpInfo {
302
+ publishInfo?: ComposerPublishInfo;
303
+ }
304
+
305
+ /**
306
+ * This file was auto-generated by Fern from our API Definition.
307
+ */
308
+
309
+ interface RustInfo {
310
+ publishInfo?: CargoPublishInfo;
311
+ }
312
+
313
+ /**
314
+ * This file was auto-generated by Fern from our API Definition.
315
+ */
316
+
317
+ interface SwiftInfo {
318
+ publishInfo?: SwiftPackageManagerPublishInfo;
319
+ }
320
+
321
+ /**
322
+ * This file was auto-generated by Fern from our API Definition.
323
+ */
324
+ interface ComposerPublishInfo {
325
+ packageName: string;
326
+ }
327
+
328
+ /**
329
+ * This file was auto-generated by Fern from our API Definition.
330
+ */
331
+ interface NpmPublishInfo {
332
+ packageName: string;
333
+ }
334
+
335
+ /**
336
+ * This file was auto-generated by Fern from our API Definition.
337
+ */
338
+ interface PypiPublishInfo {
339
+ packageName: string;
340
+ }
341
+
342
+ /**
343
+ * This file was auto-generated by Fern from our API Definition.
344
+ */
345
+ interface GoPublishInfo {
346
+ owner: string;
347
+ repo: string;
348
+ version: string;
349
+ }
350
+
351
+ /**
352
+ * This file was auto-generated by Fern from our API Definition.
353
+ */
354
+ interface MavenPublishInfo {
355
+ artifact: string;
356
+ group: string;
357
+ version: string;
358
+ }
359
+
360
+ /**
361
+ * This file was auto-generated by Fern from our API Definition.
362
+ */
363
+ interface RubyGemsPublishInfo {
364
+ packageName: string;
365
+ }
366
+
367
+ /**
368
+ * This file was auto-generated by Fern from our API Definition.
369
+ */
370
+ interface NugetPublishInfo {
371
+ packageName: string;
372
+ }
373
+
374
+ /**
375
+ * This file was auto-generated by Fern from our API Definition.
376
+ */
377
+ interface CargoPublishInfo {
378
+ packageName: string;
379
+ version: string;
380
+ }
381
+
382
+ /**
383
+ * This file was auto-generated by Fern from our API Definition.
384
+ */
385
+ interface SwiftPackageManagerPublishInfo {
386
+ gitUrl: string;
387
+ minVersion: string;
388
+ }
389
+
390
+ /**
391
+ * This file was auto-generated by Fern from our API Definition.
392
+ */
393
+ /**
394
+ * Controls the verbosity of usage examples in README generation
395
+ */
396
+ type ExampleStyle = "minimal" | "comprehensive";
397
+ declare const ExampleStyle: {
398
+ readonly Minimal: "minimal";
399
+ readonly Comprehensive: "comprehensive";
400
+ readonly _visit: <R>(value: ExampleStyle, visitor: ExampleStyle.Visitor<R>) => R;
401
+ };
402
+ declare namespace ExampleStyle {
403
+ interface Visitor<R> {
404
+ minimal: () => R;
405
+ comprehensive: () => R;
406
+ _other: () => R;
407
+ }
408
+ }
409
+
410
+ /**
411
+ * This file was auto-generated by Fern from our API Definition.
412
+ */
413
+
414
+ /**
415
+ * The information to include within the `reference.md` file generated by the CLI.
416
+ * The information here should really be all defined by the generator, and not user provided.
417
+ * We intentionally keep this a bit flexible in the event SDKs structure their package/module
418
+ * references in a unique way for the same API.
419
+ */
420
+ interface ReferenceConfig {
421
+ rootSection?: RootPackageReferenceSection;
422
+ sections: ReferenceSection[];
423
+ /** Similar to in README generation, the language property is used to determine the language to use when generating code blocks in markdown. */
424
+ language: Language;
425
+ }
426
+
427
+ /**
428
+ * This file was auto-generated by Fern from our API Definition.
429
+ */
430
+
431
+ interface RootPackageReferenceSection {
432
+ description?: string;
433
+ endpoints: EndpointReference[];
434
+ }
435
+
436
+ /**
437
+ * This file was auto-generated by Fern from our API Definition.
438
+ */
439
+
440
+ interface ReferenceSection {
441
+ title: string;
442
+ description?: string;
443
+ endpoints: EndpointReference[];
444
+ }
445
+
446
+ /**
447
+ * This file was auto-generated by Fern from our API Definition.
448
+ */
449
+
450
+ interface EndpointReference {
451
+ /**
452
+ * The title is a code snippet that is shown when the endpoint's reference is collapsed.
453
+ * For example, `client.subpackage.method({ ...params }) -> ReturnValue`.
454
+ */
455
+ title: MethodInvocationSnippet;
456
+ description?: string;
457
+ /**
458
+ * A "full" snippet, showing all the parameters, with a full example.
459
+ * ```typescript
460
+ * await client.subpackage.method({
461
+ * expiresIn: 300,
462
+ * });
463
+ * ```
464
+ */
465
+ snippet: string;
466
+ parameters: ParameterReference[];
467
+ }
468
+
469
+ /**
470
+ * This file was auto-generated by Fern from our API Definition.
471
+ */
472
+
473
+ /**
474
+ * The method invocation snippet is one which appears when the endpoint's reference is collapsed.
475
+ * It is meant to give a high-level overview of the endpoint -- e.g. the method name and it's return value.
476
+ * The snippet itself should be a list of concatable content, which the CLI will handle hyperlinking. Note that this
477
+ * will essentially just be a "".join(snippetParts), so you must handle making sure the right `.`, etc. are in the parts.
478
+ * Note this is a separate object to make it easier to add additional properties down the road, for example if
479
+ * we wanted to be specific about what portion of the snippet we hyperlink, etc.
480
+ */
481
+ interface MethodInvocationSnippet {
482
+ snippetParts: LinkedText[];
483
+ returnValue?: LinkedText;
484
+ }
485
+
486
+ /**
487
+ * This file was auto-generated by Fern from our API Definition.
488
+ */
489
+
490
+ interface LinkedText {
491
+ text: string;
492
+ location?: RelativeLocation;
493
+ }
494
+
495
+ /**
496
+ * This file was auto-generated by Fern from our API Definition.
497
+ */
498
+
499
+ interface ParameterReference {
500
+ name: string;
501
+ description?: string;
502
+ location?: RelativeLocation;
503
+ type: string;
504
+ required: boolean;
505
+ }
506
+
507
+ /**
508
+ * This file was auto-generated by Fern from our API Definition.
509
+ */
510
+ interface RelativeLocation {
511
+ /**
512
+ * A relative location is a path to a file or directory relative to the root of the repository.
513
+ * This is used to specify a link for a type or a function that the `reference.md` can point users to.
514
+ */
515
+ path: string;
516
+ }
517
+
518
+ /**
519
+ * This file was auto-generated by Fern from our API Definition.
520
+ */
521
+ type Language = "JAVA" | "PYTHON" | "GO" | "RUBY" | "CSHARP" | "TYPESCRIPT" | "PHP" | "RUST" | "SWIFT";
522
+ declare const Language: {
523
+ readonly Java: "JAVA";
524
+ readonly Python: "PYTHON";
525
+ readonly Go: "GO";
526
+ readonly Ruby: "RUBY";
527
+ readonly Csharp: "CSHARP";
528
+ readonly Typescript: "TYPESCRIPT";
529
+ readonly Php: "PHP";
530
+ readonly Rust: "RUST";
531
+ readonly Swift: "SWIFT";
532
+ readonly _visit: <R>(value: Language, visitor: Language.Visitor<R>) => R;
533
+ };
534
+ declare namespace Language {
535
+ interface Visitor<R> {
536
+ java: () => R;
537
+ python: () => R;
538
+ go: () => R;
539
+ ruby: () => R;
540
+ csharp: () => R;
541
+ typescript: () => R;
542
+ php: () => R;
543
+ rust: () => R;
544
+ swift: () => R;
545
+ _other: () => R;
546
+ }
547
+ }
548
+
549
+ interface GenerateReadmeToStreamParams {
550
+ originalReadmeContent?: string;
551
+ readmeConfig: ReadmeConfig;
552
+ outputStream: fs.WriteStream | NodeJS.Process["stdout"];
553
+ }
554
+ declare function generateReadmeToStream(params: GenerateReadmeToStreamParams): Promise<void>;
555
+ interface GenerateReadmeParams {
556
+ originalReadmeContent?: string;
557
+ readmeConfig: ReadmeConfig;
558
+ }
559
+ declare function generateReadme(params: GenerateReadmeParams): Promise<string>;
560
+
561
+ interface GenerateReferenceToStreamParams {
562
+ referenceConfig: ReferenceConfig;
563
+ outputStream: fs.WriteStream | NodeJS.Process["stdout"];
564
+ }
565
+ declare function generateReferenceToStream(params: GenerateReferenceToStreamParams): Promise<void>;
566
+ interface GenerateReferenceParams {
567
+ referenceConfig: ReferenceConfig;
568
+ }
569
+ declare function generateReference(params: GenerateReferenceParams): Promise<string>;
570
+
571
+ interface GithubPrParams {
572
+ githubConfig: GitHubConfig;
573
+ }
574
+ declare function githubPr(params: GithubPrParams): Promise<void>;
575
+
576
+ interface GithubPushParams {
577
+ githubConfig: GitHubConfig;
578
+ }
579
+ declare function githubPush(params: GithubPushParams): Promise<void>;
580
+
581
+ interface GithubReleaseParams {
582
+ githubConfig: GitHubConfig;
583
+ }
584
+ declare function githubRelease(params: GithubReleaseParams): Promise<void>;
585
+
586
+ export { type GenerateReadmeParams, type GenerateReadmeToStreamParams, type GenerateReferenceParams, type GenerateReferenceToStreamParams, type GithubPrParams, type GithubPushParams, type GithubReleaseParams, generateReadme, generateReadmeToStream, generateReference, generateReferenceToStream, githubPr, githubPush, githubRelease };