-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstory.go
More file actions
255 lines (223 loc) · 9.46 KB
/
story.go
File metadata and controls
255 lines (223 loc) · 9.46 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
// This file was auto-generated by Fern from our API Definition.
package cambai
import (
json "encoding/json"
fmt "fmt"
core "github.com/camb-ai/cambai-go-sdk/core"
time "time"
)
type BodyCreateStoryStoryPost struct {
RunID *int `json:"-" url:"run_id,omitempty"`
SourceLanguage Languages `json:"source_language" url:"source_language"`
Title *string `json:"title,omitempty" url:"title,omitempty"`
Description *string `json:"description,omitempty" url:"description,omitempty"`
NarratorVoiceID *int `json:"narrator_voice_id,omitempty" url:"narrator_voice_id,omitempty"`
FolderID *int `json:"folder_id,omitempty" url:"folder_id,omitempty"`
ChosenDictionaries []int `json:"chosen_dictionaries,omitempty" url:"chosen_dictionaries,omitempty"`
}
type GetStoriesRunsResultsStoriesResultsPostRequest struct {
Traceparent *string `json:"-" url:"-"`
RunID *int `json:"-" url:"run_id,omitempty"`
Body *RunIDsRequestPayload `json:"-" url:"-"`
}
func (g *GetStoriesRunsResultsStoriesResultsPostRequest) UnmarshalJSON(data []byte) error {
body := new(RunIDsRequestPayload)
if err := json.Unmarshal(data, &body); err != nil {
return err
}
g.Body = body
return nil
}
func (g *GetStoriesRunsResultsStoriesResultsPostRequest) MarshalJSON() ([]byte, error) {
return json.Marshal(g.Body)
}
type GetStoryRunInfoStoryResultRunIDGetRequest struct {
// Whether to include the transcription in the response for fetching the result of a Stories run.
IncludeTranscript *bool `json:"-" url:"include_transcript,omitempty"`
}
type GetStoryStatusStoryTaskIDGetRequest struct {
RunID *int `json:"-" url:"run_id,omitempty"`
}
type BodySetupStoryStorySetupPost struct {
RunID *int `json:"-" url:"run_id,omitempty"`
SourceLanguage Languages `json:"source_language" url:"source_language"`
Title *string `json:"title,omitempty" url:"title,omitempty"`
Description *string `json:"description,omitempty" url:"description,omitempty"`
NarratorVoiceID *int `json:"narrator_voice_id,omitempty" url:"narrator_voice_id,omitempty"`
FolderID *int `json:"folder_id,omitempty" url:"folder_id,omitempty"`
ChosenDictionaries []int `json:"chosen_dictionaries,omitempty" url:"chosen_dictionaries,omitempty"`
}
type GetSetupStoryResultResponse struct {
RunID int `json:"run_id" url:"run_id"`
StoryDetails *StoryDetails `json:"story_details,omitempty" url:"story_details,omitempty"`
_rawJSON json.RawMessage
}
func (g *GetSetupStoryResultResponse) UnmarshalJSON(data []byte) error {
type unmarshaler GetSetupStoryResultResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*g = GetSetupStoryResultResponse(value)
g._rawJSON = json.RawMessage(data)
return nil
}
func (g *GetSetupStoryResultResponse) String() string {
if len(g._rawJSON) > 0 {
if value, err := core.StringifyJSON(g._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(g); err == nil {
return value
}
return fmt.Sprintf("%#v", g)
}
type StoryDetails struct {
StoryTitle string `json:"story_title" url:"story_title"`
StoryDescription *string `json:"story_description,omitempty" url:"story_description,omitempty"`
CreatedAt time.Time `json:"created_at" url:"created_at"`
SourceLanguage Languages `json:"source_language" url:"source_language"`
TargetLanguages []Languages `json:"target_languages,omitempty" url:"target_languages,omitempty"`
FolderID *int `json:"folder_id,omitempty" url:"folder_id,omitempty"`
StudioURL string `json:"studio_url" url:"studio_url"`
_rawJSON json.RawMessage
}
func (s *StoryDetails) UnmarshalJSON(data []byte) error {
type embed StoryDetails
var unmarshaler = struct {
embed
CreatedAt *core.DateTime `json:"created_at"`
}{
embed: embed(*s),
}
if err := json.Unmarshal(data, &unmarshaler); err != nil {
return err
}
*s = StoryDetails(unmarshaler.embed)
s.CreatedAt = unmarshaler.CreatedAt.Time()
s._rawJSON = json.RawMessage(data)
return nil
}
func (s *StoryDetails) MarshalJSON() ([]byte, error) {
type embed StoryDetails
var marshaler = struct {
embed
CreatedAt *core.DateTime `json:"created_at"`
}{
embed: embed(*s),
CreatedAt: core.NewDateTime(s.CreatedAt),
}
return json.Marshal(marshaler)
}
func (s *StoryDetails) String() string {
if len(s._rawJSON) > 0 {
if value, err := core.StringifyJSON(s._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(s); err == nil {
return value
}
return fmt.Sprintf("%#v", s)
}
type CreateStoryStoryPostResponse struct {
typeName string
OrchestratorPipelineCallResult *OrchestratorPipelineCallResult
GetSetupStoryResultResponse *GetSetupStoryResultResponse
}
func NewCreateStoryStoryPostResponseFromOrchestratorPipelineCallResult(value *OrchestratorPipelineCallResult) *CreateStoryStoryPostResponse {
return &CreateStoryStoryPostResponse{typeName: "orchestratorPipelineCallResult", OrchestratorPipelineCallResult: value}
}
func NewCreateStoryStoryPostResponseFromGetSetupStoryResultResponse(value *GetSetupStoryResultResponse) *CreateStoryStoryPostResponse {
return &CreateStoryStoryPostResponse{typeName: "getSetupStoryResultResponse", GetSetupStoryResultResponse: value}
}
func (c *CreateStoryStoryPostResponse) UnmarshalJSON(data []byte) error {
valueOrchestratorPipelineCallResult := new(OrchestratorPipelineCallResult)
if err := json.Unmarshal(data, &valueOrchestratorPipelineCallResult); err == nil {
c.typeName = "orchestratorPipelineCallResult"
c.OrchestratorPipelineCallResult = valueOrchestratorPipelineCallResult
return nil
}
valueGetSetupStoryResultResponse := new(GetSetupStoryResultResponse)
if err := json.Unmarshal(data, &valueGetSetupStoryResultResponse); err == nil {
c.typeName = "getSetupStoryResultResponse"
c.GetSetupStoryResultResponse = valueGetSetupStoryResultResponse
return nil
}
return fmt.Errorf("%s cannot be deserialized as a %T", data, c)
}
func (c CreateStoryStoryPostResponse) MarshalJSON() ([]byte, error) {
switch c.typeName {
default:
return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c)
case "orchestratorPipelineCallResult":
return json.Marshal(c.OrchestratorPipelineCallResult)
case "getSetupStoryResultResponse":
return json.Marshal(c.GetSetupStoryResultResponse)
}
}
type CreateStoryStoryPostResponseVisitor interface {
VisitOrchestratorPipelineCallResult(*OrchestratorPipelineCallResult) error
VisitGetSetupStoryResultResponse(*GetSetupStoryResultResponse) error
}
func (c *CreateStoryStoryPostResponse) Accept(visitor CreateStoryStoryPostResponseVisitor) error {
switch c.typeName {
default:
return fmt.Errorf("invalid type %s in %T", c.typeName, c)
case "orchestratorPipelineCallResult":
return visitor.VisitOrchestratorPipelineCallResult(c.OrchestratorPipelineCallResult)
case "getSetupStoryResultResponse":
return visitor.VisitGetSetupStoryResultResponse(c.GetSetupStoryResultResponse)
}
}
type SetupStoryStorySetupPostResponse struct {
typeName string
OrchestratorPipelineCallResult *OrchestratorPipelineCallResult
GetSetupStoryResultResponse *GetSetupStoryResultResponse
}
func NewSetupStoryStorySetupPostResponseFromOrchestratorPipelineCallResult(value *OrchestratorPipelineCallResult) *SetupStoryStorySetupPostResponse {
return &SetupStoryStorySetupPostResponse{typeName: "orchestratorPipelineCallResult", OrchestratorPipelineCallResult: value}
}
func NewSetupStoryStorySetupPostResponseFromGetSetupStoryResultResponse(value *GetSetupStoryResultResponse) *SetupStoryStorySetupPostResponse {
return &SetupStoryStorySetupPostResponse{typeName: "getSetupStoryResultResponse", GetSetupStoryResultResponse: value}
}
func (s *SetupStoryStorySetupPostResponse) UnmarshalJSON(data []byte) error {
valueOrchestratorPipelineCallResult := new(OrchestratorPipelineCallResult)
if err := json.Unmarshal(data, &valueOrchestratorPipelineCallResult); err == nil {
s.typeName = "orchestratorPipelineCallResult"
s.OrchestratorPipelineCallResult = valueOrchestratorPipelineCallResult
return nil
}
valueGetSetupStoryResultResponse := new(GetSetupStoryResultResponse)
if err := json.Unmarshal(data, &valueGetSetupStoryResultResponse); err == nil {
s.typeName = "getSetupStoryResultResponse"
s.GetSetupStoryResultResponse = valueGetSetupStoryResultResponse
return nil
}
return fmt.Errorf("%s cannot be deserialized as a %T", data, s)
}
func (s SetupStoryStorySetupPostResponse) MarshalJSON() ([]byte, error) {
switch s.typeName {
default:
return nil, fmt.Errorf("invalid type %s in %T", s.typeName, s)
case "orchestratorPipelineCallResult":
return json.Marshal(s.OrchestratorPipelineCallResult)
case "getSetupStoryResultResponse":
return json.Marshal(s.GetSetupStoryResultResponse)
}
}
type SetupStoryStorySetupPostResponseVisitor interface {
VisitOrchestratorPipelineCallResult(*OrchestratorPipelineCallResult) error
VisitGetSetupStoryResultResponse(*GetSetupStoryResultResponse) error
}
func (s *SetupStoryStorySetupPostResponse) Accept(visitor SetupStoryStorySetupPostResponseVisitor) error {
switch s.typeName {
default:
return fmt.Errorf("invalid type %s in %T", s.typeName, s)
case "orchestratorPipelineCallResult":
return visitor.VisitOrchestratorPipelineCallResult(s.OrchestratorPipelineCallResult)
case "getSetupStoryResultResponse":
return visitor.VisitGetSetupStoryResultResponse(s.GetSetupStoryResultResponse)
}
}