Skip to content

Commit da89580

Browse files
Release v0.0.1353
1 parent d3d8533 commit da89580

File tree

4 files changed

+444
-472
lines changed

4 files changed

+444
-472
lines changed

core/client_option.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ func (c *ClientOptions) cloneHeader() http.Header {
3636
headers := c.HTTPHeader.Clone()
3737
headers.Set("X-Fern-Language", "Go")
3838
headers.Set("X-Fern-SDK-Name", "github.com/fern-api/generator-exec-go")
39-
headers.Set("X-Fern-SDK-Version", "v0.0.1349")
39+
headers.Set("X-Fern-SDK-Version", "v0.0.1353")
4040
return headers
4141
}

logging.go

Lines changed: 0 additions & 333 deletions
Original file line numberDiff line numberDiff line change
@@ -5,98 +5,8 @@ package generatorexec
55
import (
66
json "encoding/json"
77
fmt "fmt"
8-
strconv "strconv"
98
)
109

11-
type CratesCoordinate struct {
12-
Name string `json:"name"`
13-
Version string `json:"version"`
14-
}
15-
16-
type ErrorExitStatusUpdate struct {
17-
Message string `json:"message"`
18-
}
19-
20-
type ExitStatusUpdate struct {
21-
Type string
22-
Successful *SuccessfulStatusUpdate
23-
Error *ErrorExitStatusUpdate
24-
}
25-
26-
func NewExitStatusUpdateFromSuccessful(value *SuccessfulStatusUpdate) *ExitStatusUpdate {
27-
return &ExitStatusUpdate{Type: "successful", Successful: value}
28-
}
29-
30-
func NewExitStatusUpdateFromError(value *ErrorExitStatusUpdate) *ExitStatusUpdate {
31-
return &ExitStatusUpdate{Type: "error", Error: value}
32-
}
33-
34-
func (e *ExitStatusUpdate) UnmarshalJSON(data []byte) error {
35-
var unmarshaler struct {
36-
Type string `json:"_type"`
37-
}
38-
if err := json.Unmarshal(data, &unmarshaler); err != nil {
39-
return err
40-
}
41-
e.Type = unmarshaler.Type
42-
switch unmarshaler.Type {
43-
case "successful":
44-
value := new(SuccessfulStatusUpdate)
45-
if err := json.Unmarshal(data, &value); err != nil {
46-
return err
47-
}
48-
e.Successful = value
49-
case "error":
50-
value := new(ErrorExitStatusUpdate)
51-
if err := json.Unmarshal(data, &value); err != nil {
52-
return err
53-
}
54-
e.Error = value
55-
}
56-
return nil
57-
}
58-
59-
func (e ExitStatusUpdate) MarshalJSON() ([]byte, error) {
60-
switch e.Type {
61-
default:
62-
return nil, fmt.Errorf("invalid type %s in %T", e.Type, e)
63-
case "successful":
64-
var marshaler = struct {
65-
Type string `json:"_type"`
66-
*SuccessfulStatusUpdate
67-
}{
68-
Type: e.Type,
69-
SuccessfulStatusUpdate: e.Successful,
70-
}
71-
return json.Marshal(marshaler)
72-
case "error":
73-
var marshaler = struct {
74-
Type string `json:"_type"`
75-
*ErrorExitStatusUpdate
76-
}{
77-
Type: e.Type,
78-
ErrorExitStatusUpdate: e.Error,
79-
}
80-
return json.Marshal(marshaler)
81-
}
82-
}
83-
84-
type ExitStatusUpdateVisitor interface {
85-
VisitSuccessful(*SuccessfulStatusUpdate) error
86-
VisitError(*ErrorExitStatusUpdate) error
87-
}
88-
89-
func (e *ExitStatusUpdate) Accept(visitor ExitStatusUpdateVisitor) error {
90-
switch e.Type {
91-
default:
92-
return fmt.Errorf("invalid type %s in %T", e.Type, e)
93-
case "successful":
94-
return visitor.VisitSuccessful(e.Successful)
95-
case "error":
96-
return visitor.VisitError(e.Error)
97-
}
98-
}
99-
10010
type GeneratorUpdate struct {
10111
Type string
10212
Init *InitUpdate
@@ -274,246 +184,3 @@ func (g *GeneratorUpdate) Accept(visitor GeneratorUpdateVisitor) error {
274184
return visitor.VisitExitStatusUpdate(g.ExitStatusUpdate)
275185
}
276186
}
277-
278-
type InitUpdate struct {
279-
PackagesToPublish []*PackageCoordinate `json:"packagesToPublish,omitempty"`
280-
}
281-
282-
type InitUpdateV2 struct {
283-
PublishingToRegistry *RegistryType `json:"publishingToRegistry,omitempty"`
284-
}
285-
286-
type LogLevel uint
287-
288-
const (
289-
LogLevelDebug LogLevel = iota + 1
290-
LogLevelInfo
291-
LogLevelWarn
292-
LogLevelError
293-
)
294-
295-
func (l LogLevel) String() string {
296-
switch l {
297-
default:
298-
return strconv.Itoa(int(l))
299-
case LogLevelDebug:
300-
return "DEBUG"
301-
case LogLevelInfo:
302-
return "INFO"
303-
case LogLevelWarn:
304-
return "WARN"
305-
case LogLevelError:
306-
return "ERROR"
307-
}
308-
}
309-
310-
func (l LogLevel) MarshalJSON() ([]byte, error) {
311-
return []byte(fmt.Sprintf("%q", l.String())), nil
312-
}
313-
314-
func (l *LogLevel) UnmarshalJSON(data []byte) error {
315-
var raw string
316-
if err := json.Unmarshal(data, &raw); err != nil {
317-
return err
318-
}
319-
switch raw {
320-
case "DEBUG":
321-
value := LogLevelDebug
322-
*l = value
323-
case "INFO":
324-
value := LogLevelInfo
325-
*l = value
326-
case "WARN":
327-
value := LogLevelWarn
328-
*l = value
329-
case "ERROR":
330-
value := LogLevelError
331-
*l = value
332-
}
333-
return nil
334-
}
335-
336-
type LogUpdate struct {
337-
Level LogLevel `json:"level,omitempty"`
338-
Message string `json:"message"`
339-
}
340-
341-
type MavenCoordinate struct {
342-
Group string `json:"group"`
343-
Artifact string `json:"artifact"`
344-
Version string `json:"version"`
345-
}
346-
347-
type NpmCoordinate struct {
348-
Name string `json:"name"`
349-
Version string `json:"version"`
350-
}
351-
352-
type PackageCoordinate struct {
353-
Type string
354-
Npm *NpmCoordinate
355-
Maven *MavenCoordinate
356-
Crates *CratesCoordinate
357-
}
358-
359-
func NewPackageCoordinateFromNpm(value *NpmCoordinate) *PackageCoordinate {
360-
return &PackageCoordinate{Type: "npm", Npm: value}
361-
}
362-
363-
func NewPackageCoordinateFromMaven(value *MavenCoordinate) *PackageCoordinate {
364-
return &PackageCoordinate{Type: "maven", Maven: value}
365-
}
366-
367-
func NewPackageCoordinateFromCrates(value *CratesCoordinate) *PackageCoordinate {
368-
return &PackageCoordinate{Type: "crates", Crates: value}
369-
}
370-
371-
func (p *PackageCoordinate) UnmarshalJSON(data []byte) error {
372-
var unmarshaler struct {
373-
Type string `json:"_type"`
374-
}
375-
if err := json.Unmarshal(data, &unmarshaler); err != nil {
376-
return err
377-
}
378-
p.Type = unmarshaler.Type
379-
switch unmarshaler.Type {
380-
case "npm":
381-
value := new(NpmCoordinate)
382-
if err := json.Unmarshal(data, &value); err != nil {
383-
return err
384-
}
385-
p.Npm = value
386-
case "maven":
387-
value := new(MavenCoordinate)
388-
if err := json.Unmarshal(data, &value); err != nil {
389-
return err
390-
}
391-
p.Maven = value
392-
case "crates":
393-
value := new(CratesCoordinate)
394-
if err := json.Unmarshal(data, &value); err != nil {
395-
return err
396-
}
397-
p.Crates = value
398-
}
399-
return nil
400-
}
401-
402-
func (p PackageCoordinate) MarshalJSON() ([]byte, error) {
403-
switch p.Type {
404-
default:
405-
return nil, fmt.Errorf("invalid type %s in %T", p.Type, p)
406-
case "npm":
407-
var marshaler = struct {
408-
Type string `json:"_type"`
409-
*NpmCoordinate
410-
}{
411-
Type: p.Type,
412-
NpmCoordinate: p.Npm,
413-
}
414-
return json.Marshal(marshaler)
415-
case "maven":
416-
var marshaler = struct {
417-
Type string `json:"_type"`
418-
*MavenCoordinate
419-
}{
420-
Type: p.Type,
421-
MavenCoordinate: p.Maven,
422-
}
423-
return json.Marshal(marshaler)
424-
case "crates":
425-
var marshaler = struct {
426-
Type string `json:"_type"`
427-
*CratesCoordinate
428-
}{
429-
Type: p.Type,
430-
CratesCoordinate: p.Crates,
431-
}
432-
return json.Marshal(marshaler)
433-
}
434-
}
435-
436-
type PackageCoordinateVisitor interface {
437-
VisitNpm(*NpmCoordinate) error
438-
VisitMaven(*MavenCoordinate) error
439-
VisitCrates(*CratesCoordinate) error
440-
}
441-
442-
func (p *PackageCoordinate) Accept(visitor PackageCoordinateVisitor) error {
443-
switch p.Type {
444-
default:
445-
return fmt.Errorf("invalid type %s in %T", p.Type, p)
446-
case "npm":
447-
return visitor.VisitNpm(p.Npm)
448-
case "maven":
449-
return visitor.VisitMaven(p.Maven)
450-
case "crates":
451-
return visitor.VisitCrates(p.Crates)
452-
}
453-
}
454-
455-
type RegistryType uint
456-
457-
const (
458-
RegistryTypeNpm RegistryType = iota + 1
459-
RegistryTypeMaven
460-
RegistryTypePypi
461-
RegistryTypeRubygems
462-
RegistryTypeNuget
463-
RegistryTypeCrates
464-
)
465-
466-
func (r RegistryType) String() string {
467-
switch r {
468-
default:
469-
return strconv.Itoa(int(r))
470-
case RegistryTypeNpm:
471-
return "NPM"
472-
case RegistryTypeMaven:
473-
return "MAVEN"
474-
case RegistryTypePypi:
475-
return "PYPI"
476-
case RegistryTypeRubygems:
477-
return "RUBYGEMS"
478-
case RegistryTypeNuget:
479-
return "NUGET"
480-
case RegistryTypeCrates:
481-
return "CRATES"
482-
}
483-
}
484-
485-
func (r RegistryType) MarshalJSON() ([]byte, error) {
486-
return []byte(fmt.Sprintf("%q", r.String())), nil
487-
}
488-
489-
func (r *RegistryType) UnmarshalJSON(data []byte) error {
490-
var raw string
491-
if err := json.Unmarshal(data, &raw); err != nil {
492-
return err
493-
}
494-
switch raw {
495-
case "NPM":
496-
value := RegistryTypeNpm
497-
*r = value
498-
case "MAVEN":
499-
value := RegistryTypeMaven
500-
*r = value
501-
case "PYPI":
502-
value := RegistryTypePypi
503-
*r = value
504-
case "RUBYGEMS":
505-
value := RegistryTypeRubygems
506-
*r = value
507-
case "NUGET":
508-
value := RegistryTypeNuget
509-
*r = value
510-
case "CRATES":
511-
value := RegistryTypeCrates
512-
*r = value
513-
}
514-
return nil
515-
}
516-
517-
type SuccessfulStatusUpdate struct {
518-
ZipFilename *string `json:"zipFilename,omitempty"`
519-
}

0 commit comments

Comments
 (0)