-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreadme.go
More file actions
152 lines (144 loc) · 3.1 KB
/
readme.go
File metadata and controls
152 lines (144 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
// This file was auto-generated by Fern from our API Definition.
package generatorexec
import (
json "encoding/json"
fmt "fmt"
strconv "strconv"
)
type BadgeType uint
const (
BadgeTypeNpm BadgeType = iota + 1
BadgeTypeMaven
BadgeTypePypi
BadgeTypeGo
BadgeTypeRubygems
BadgeTypeNuget
BadgeTypeCrates
)
func (b BadgeType) String() string {
switch b {
default:
return strconv.Itoa(int(b))
case BadgeTypeNpm:
return "NPM"
case BadgeTypeMaven:
return "MAVEN"
case BadgeTypePypi:
return "PYPI"
case BadgeTypeGo:
return "GO"
case BadgeTypeRubygems:
return "RUBYGEMS"
case BadgeTypeNuget:
return "NUGET"
case BadgeTypeCrates:
return "CRATES"
}
}
func (b BadgeType) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf("%q", b.String())), nil
}
func (b *BadgeType) UnmarshalJSON(data []byte) error {
var raw string
if err := json.Unmarshal(data, &raw); err != nil {
return err
}
switch raw {
case "NPM":
value := BadgeTypeNpm
*b = value
case "MAVEN":
value := BadgeTypeMaven
*b = value
case "PYPI":
value := BadgeTypePypi
*b = value
case "GO":
value := BadgeTypeGo
*b = value
case "RUBYGEMS":
value := BadgeTypeRubygems
*b = value
case "NUGET":
value := BadgeTypeNuget
*b = value
case "CRATES":
value := BadgeTypeCrates
*b = value
}
return nil
}
// The standard sections included in every generated README.md
//
// # {{title}}
// {{badge}} [Fern Badge]
//
// {{summary}}
//
// ## API Documentation
//
// API Reference Documentation is available {{here}}.
//
// ## Installation
//
// {{installation}}
//
// ## Usage
//
// {{usage}}
//
// ## Async Client
//
// {{asyncUsage}}
//
// ## Environments
//
// {{environments}}
//
// ## Custom URL
//
// {{customUrl}}
//
// ## Handling Errors
//
// {{errors}}
//
// ## Advanced: Setting Timeouts
//
// {{timeouts}}
//
// ## Advanced: Request Options
//
// {{requestOptions}}}
//
// ## Beta Status
//
// Some info about beta status.
//
// ## Contributing
//
// Some info about contributing.
type GenerateReadmeRequest struct {
// The title (e.g. Acme Python Library ...)
Title string `json:"title"`
// Badges rendered alongside the standard Fern badge
Badge *BadgeType `json:"badge,omitempty"`
// The summary included below the badges (e.g. The Acme Python library provides ...)
Summary string `json:"summary"`
// Each requirement is rendered as a bulleted list
Requirements []string `json:"requirements,omitempty"`
// The installation steps
Installation *string `json:"installation,omitempty"`
// Section describing how to instantiate the client (i.e. a code snippet)
Usage string `json:"usage"`
// Section describing how to instantiate an async client
AsyncUsage *string `json:"asyncUsage,omitempty"`
// Section describing how to set timeouts
Timeouts *string `json:"timeouts,omitempty"`
// If multiple environments, a section for how to specify multiple environments
Environments *string `json:"environments,omitempty"`
// Section describing how to set a custom url
CustomUrl *string `json:"customUrl,omitempty"`
// Section describing how to set request options
RequestOptions *string `json:"requestOptions,omitempty"`
}