@@ -70,26 +70,26 @@ type CreateWorkspaceProxyRequest struct {
70
70
Icon string `json:"icon"`
71
71
}
72
72
73
- type CreateWorkspaceProxyResponse struct {
73
+ type UpdateWorkspaceProxyResponse struct {
74
74
Proxy WorkspaceProxy `json:"proxy" table:"proxy,recursive"`
75
75
// The recursive table sort is not working very well.
76
76
ProxyToken string `json:"proxy_token" table:"proxy token,default_sort"`
77
77
}
78
78
79
- func (c * Client ) CreateWorkspaceProxy (ctx context.Context , req CreateWorkspaceProxyRequest ) (CreateWorkspaceProxyResponse , error ) {
79
+ func (c * Client ) CreateWorkspaceProxy (ctx context.Context , req CreateWorkspaceProxyRequest ) (UpdateWorkspaceProxyResponse , error ) {
80
80
res , err := c .Request (ctx , http .MethodPost ,
81
81
"/api/v2/workspaceproxies" ,
82
82
req ,
83
83
)
84
84
if err != nil {
85
- return CreateWorkspaceProxyResponse {}, xerrors .Errorf ("make request: %w" , err )
85
+ return UpdateWorkspaceProxyResponse {}, xerrors .Errorf ("make request: %w" , err )
86
86
}
87
87
defer res .Body .Close ()
88
88
89
89
if res .StatusCode != http .StatusCreated {
90
- return CreateWorkspaceProxyResponse {}, ReadBodyAsError (res )
90
+ return UpdateWorkspaceProxyResponse {}, ReadBodyAsError (res )
91
91
}
92
- var resp CreateWorkspaceProxyResponse
92
+ var resp UpdateWorkspaceProxyResponse
93
93
return resp , json .NewDecoder (res .Body ).Decode (& resp )
94
94
}
95
95
@@ -119,26 +119,20 @@ type PatchWorkspaceProxy struct {
119
119
RegenerateToken bool `json:"regenerate_token"`
120
120
}
121
121
122
- type PatchWorkspaceProxyResponse struct {
123
- Proxy WorkspaceProxy `json:"proxy" table:"proxy,recursive"`
124
- // ProxyToken is only returned if 'RegenerateToken' is set.
125
- ProxyToken string `json:"proxy_token" table:"proxy token,default_sort"`
126
- }
127
-
128
- func (c * Client ) PatchWorkspaceProxy (ctx context.Context , req PatchWorkspaceProxy ) (WorkspaceProxy , error ) {
122
+ func (c * Client ) PatchWorkspaceProxy (ctx context.Context , req PatchWorkspaceProxy ) (UpdateWorkspaceProxyResponse , error ) {
129
123
res , err := c .Request (ctx , http .MethodPatch ,
130
124
fmt .Sprintf ("/api/v2/workspaceproxies/%s" , req .ID .String ()),
131
125
req ,
132
126
)
133
127
if err != nil {
134
- return WorkspaceProxy {}, xerrors .Errorf ("make request: %w" , err )
128
+ return UpdateWorkspaceProxyResponse {}, xerrors .Errorf ("make request: %w" , err )
135
129
}
136
130
defer res .Body .Close ()
137
131
138
132
if res .StatusCode != http .StatusOK {
139
- return WorkspaceProxy {}, ReadBodyAsError (res )
133
+ return UpdateWorkspaceProxyResponse {}, ReadBodyAsError (res )
140
134
}
141
- var resp WorkspaceProxy
135
+ var resp UpdateWorkspaceProxyResponse
142
136
return resp , json .NewDecoder (res .Body ).Decode (& resp )
143
137
}
144
138
0 commit comments