1
+ /*
2
+ * --------------------------------------------------------------------------------
3
+ * <copyright company="Aspose" file="get_all_revisions_online_request.go">
4
+ * Copyright (c) 2024 Aspose.Words for Cloud
5
+ * </copyright>
6
+ * <summary>
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ * </summary>
25
+ * --------------------------------------------------------------------------------
26
+ */
27
+
28
+ package models
29
+
30
+ import (
31
+ "errors"
32
+ "io/ioutil"
33
+ "net/url"
34
+ "strings"
35
+ "io"
36
+ "encoding/json"
37
+ )
38
+
39
+ // GetAllRevisionsOnlineRequest contains request data for WordsApiService.GetAllRevisionsOnline method.
40
+ type GetAllRevisionsOnlineRequest struct {
41
+ // The document.
42
+ Document io.ReadCloser
43
+ /* optional (nil or map[string]interface{}) with one or more of key / value pairs:
44
+ key: "loadEncoding" value: (*string) Encoding that will be used to load an HTML (or TXT) document if the encoding is not specified in HTML.
45
+ key: "password" value: (*string) Password of protected Word document. Use the parameter to pass a password via SDK. SDK encrypts it automatically. We don't recommend to use the parameter to pass a plain password for direct call of API.
46
+ key: "encryptedPassword" value: (*string) Password of protected Word document. Use the parameter to pass an encrypted password for direct calls of API. See SDK code for encyption details.
47
+ key: "openTypeSupport" value: (*bool) The value indicates whether OpenType support is on. */
48
+ Optionals map [string ]interface {}
49
+ }
50
+
51
+
52
+ func (data * GetAllRevisionsOnlineRequest ) CreateRequestData () (RequestData , error ) {
53
+ var result RequestData
54
+ var filesContentData = make ([]FileReference , 0 )
55
+ if data == nil {
56
+ return result , errors .New ("Invalid object." )
57
+ }
58
+
59
+ result .Method = strings .ToUpper ("put" )
60
+
61
+ // create path and map variables
62
+ result .Path = "/words/online/get/revisions/getAll"
63
+
64
+ result .Path = strings .Replace (result .Path , "/<nil>" , "" , - 1 )
65
+ result .Path = strings .Replace (result .Path , "//" , "/" , - 1 )
66
+
67
+ result .HeaderParams = make (map [string ]string )
68
+ result .QueryParams = url.Values {}
69
+ result .FormParams = make ([]FormParamContainer , 0 )
70
+
71
+ if (data .Document == nil ) {
72
+ return result , errors .New ("Parameter Document is required." )
73
+ }
74
+
75
+
76
+ if err := typeCheckParameter (data .Optionals ["loadEncoding" ], "string" , "data.Optionals[loadEncoding]" ); err != nil {
77
+ return result , err
78
+ }
79
+ if err := typeCheckParameter (data .Optionals ["password" ], "string" , "data.Optionals[password]" ); err != nil {
80
+ return result , err
81
+ }
82
+ if err := typeCheckParameter (data .Optionals ["encryptedPassword" ], "string" , "data.Optionals[encryptedPassword]" ); err != nil {
83
+ return result , err
84
+ }
85
+ if err := typeCheckParameter (data .Optionals ["openTypeSupport" ], "bool" , "data.Optionals[openTypeSupport]" ); err != nil {
86
+ return result , err
87
+ }
88
+
89
+
90
+
91
+ if localVarTempParam , localVarOk := data .Optionals ["loadEncoding" ].(string ); localVarOk {
92
+ result .QueryParams .Add ("LoadEncoding" , parameterToString (localVarTempParam , "" ))
93
+ }
94
+
95
+
96
+ if localVarTempParam , localVarOk := data .Optionals ["password" ].(string ); localVarOk {
97
+ result .QueryParams .Add ("Password" , parameterToString (localVarTempParam , "" ))
98
+ }
99
+
100
+
101
+ if localVarTempParam , localVarOk := data .Optionals ["encryptedPassword" ].(string ); localVarOk {
102
+ result .QueryParams .Add ("EncryptedPassword" , parameterToString (localVarTempParam , "" ))
103
+ }
104
+
105
+
106
+ if localVarTempParam , localVarOk := data .Optionals ["openTypeSupport" ].(bool ); localVarOk {
107
+ result .QueryParams .Add ("OpenTypeSupport" , parameterToString (localVarTempParam , "" ))
108
+ }
109
+
110
+
111
+
112
+ _document := data .Document
113
+ if _document != nil {
114
+ fbs , _ := ioutil .ReadAll (_document )
115
+ _document .Close ()
116
+ result .FormParams = append (result .FormParams , NewFileFormParamContainer ("document" , fbs ))
117
+ }
118
+
119
+
120
+ result .FileReferences = filesContentData
121
+ for _ , fileContentData := range filesContentData {
122
+ if fileContentData .Source == "Request" {
123
+ fbs , _ := ioutil .ReadAll (fileContentData .Content )
124
+ result .FormParams = append (result .FormParams , NewFileFormParamContainer (fileContentData .Reference , fbs ))
125
+ }
126
+ }
127
+
128
+ return result , nil
129
+ }
130
+
131
+ func (data * GetAllRevisionsOnlineRequest ) CreateResponse (reader io.Reader , boundary string ) (response interface {}, err error ) {
132
+ var successPayload IRevisionsResponse = new (RevisionsResponse )
133
+ var jsonMap map [string ]interface {}
134
+ if err = json .NewDecoder (reader ).Decode (& jsonMap ); err != nil {
135
+ return nil , err
136
+ }
137
+
138
+ successPayload .Deserialize (jsonMap )
139
+ return successPayload , err
140
+ }
0 commit comments