refactor: use io.ReadCloser instead of **os.File for binary request params (#119)
This commit is contained in:
@ -12,7 +12,6 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_context "context"
|
_context "context"
|
||||||
_io "io"
|
|
||||||
_ioutil "io/ioutil"
|
_ioutil "io/ioutil"
|
||||||
_nethttp "net/http"
|
_nethttp "net/http"
|
||||||
_neturl "net/url"
|
_neturl "net/url"
|
||||||
@ -55,22 +54,6 @@ type BackupApi interface {
|
|||||||
GetBackupShardIdExecute(r ApiGetBackupShardIdRequest) (*_nethttp.Response, error)
|
GetBackupShardIdExecute(r ApiGetBackupShardIdRequest) (*_nethttp.Response, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// backupApiGzipReadCloser supports streaming gzip response-bodies directly from the server.
|
|
||||||
type backupApiGzipReadCloser struct {
|
|
||||||
underlying _io.ReadCloser
|
|
||||||
gzip _io.ReadCloser
|
|
||||||
}
|
|
||||||
|
|
||||||
func (gzrc *backupApiGzipReadCloser) Read(p []byte) (int, error) {
|
|
||||||
return gzrc.gzip.Read(p)
|
|
||||||
}
|
|
||||||
func (gzrc *backupApiGzipReadCloser) Close() error {
|
|
||||||
if err := gzrc.gzip.Close(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return gzrc.underlying.Close()
|
|
||||||
}
|
|
||||||
|
|
||||||
// BackupApiService BackupApi service
|
// BackupApiService BackupApi service
|
||||||
type BackupApiService service
|
type BackupApiService service
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_context "context"
|
_context "context"
|
||||||
_io "io"
|
|
||||||
_ioutil "io/ioutil"
|
_ioutil "io/ioutil"
|
||||||
_nethttp "net/http"
|
_nethttp "net/http"
|
||||||
_neturl "net/url"
|
_neturl "net/url"
|
||||||
@ -85,22 +84,6 @@ type BucketSchemasApi interface {
|
|||||||
UpdateMeasurementSchemaExecute(r ApiUpdateMeasurementSchemaRequest) (MeasurementSchema, error)
|
UpdateMeasurementSchemaExecute(r ApiUpdateMeasurementSchemaRequest) (MeasurementSchema, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// bucketSchemasApiGzipReadCloser supports streaming gzip response-bodies directly from the server.
|
|
||||||
type bucketSchemasApiGzipReadCloser struct {
|
|
||||||
underlying _io.ReadCloser
|
|
||||||
gzip _io.ReadCloser
|
|
||||||
}
|
|
||||||
|
|
||||||
func (gzrc *bucketSchemasApiGzipReadCloser) Read(p []byte) (int, error) {
|
|
||||||
return gzrc.gzip.Read(p)
|
|
||||||
}
|
|
||||||
func (gzrc *bucketSchemasApiGzipReadCloser) Close() error {
|
|
||||||
if err := gzrc.gzip.Close(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return gzrc.underlying.Close()
|
|
||||||
}
|
|
||||||
|
|
||||||
// BucketSchemasApiService BucketSchemasApi service
|
// BucketSchemasApiService BucketSchemasApi service
|
||||||
type BucketSchemasApiService service
|
type BucketSchemasApiService service
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_context "context"
|
_context "context"
|
||||||
_io "io"
|
|
||||||
_ioutil "io/ioutil"
|
_ioutil "io/ioutil"
|
||||||
_nethttp "net/http"
|
_nethttp "net/http"
|
||||||
_neturl "net/url"
|
_neturl "net/url"
|
||||||
@ -94,22 +93,6 @@ type BucketsApi interface {
|
|||||||
PostBucketsExecute(r ApiPostBucketsRequest) (Bucket, error)
|
PostBucketsExecute(r ApiPostBucketsRequest) (Bucket, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// bucketsApiGzipReadCloser supports streaming gzip response-bodies directly from the server.
|
|
||||||
type bucketsApiGzipReadCloser struct {
|
|
||||||
underlying _io.ReadCloser
|
|
||||||
gzip _io.ReadCloser
|
|
||||||
}
|
|
||||||
|
|
||||||
func (gzrc *bucketsApiGzipReadCloser) Read(p []byte) (int, error) {
|
|
||||||
return gzrc.gzip.Read(p)
|
|
||||||
}
|
|
||||||
func (gzrc *bucketsApiGzipReadCloser) Close() error {
|
|
||||||
if err := gzrc.gzip.Close(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return gzrc.underlying.Close()
|
|
||||||
}
|
|
||||||
|
|
||||||
// BucketsApiService BucketsApi service
|
// BucketsApiService BucketsApi service
|
||||||
type BucketsApiService service
|
type BucketsApiService service
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_context "context"
|
_context "context"
|
||||||
_io "io"
|
|
||||||
_ioutil "io/ioutil"
|
_ioutil "io/ioutil"
|
||||||
_nethttp "net/http"
|
_nethttp "net/http"
|
||||||
_neturl "net/url"
|
_neturl "net/url"
|
||||||
@ -38,22 +37,6 @@ type DeleteApi interface {
|
|||||||
PostDeleteExecute(r ApiPostDeleteRequest) error
|
PostDeleteExecute(r ApiPostDeleteRequest) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// deleteApiGzipReadCloser supports streaming gzip response-bodies directly from the server.
|
|
||||||
type deleteApiGzipReadCloser struct {
|
|
||||||
underlying _io.ReadCloser
|
|
||||||
gzip _io.ReadCloser
|
|
||||||
}
|
|
||||||
|
|
||||||
func (gzrc *deleteApiGzipReadCloser) Read(p []byte) (int, error) {
|
|
||||||
return gzrc.gzip.Read(p)
|
|
||||||
}
|
|
||||||
func (gzrc *deleteApiGzipReadCloser) Close() error {
|
|
||||||
if err := gzrc.gzip.Close(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return gzrc.underlying.Close()
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteApiService DeleteApi service
|
// DeleteApiService DeleteApi service
|
||||||
type DeleteApiService service
|
type DeleteApiService service
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_context "context"
|
_context "context"
|
||||||
_io "io"
|
|
||||||
_ioutil "io/ioutil"
|
_ioutil "io/ioutil"
|
||||||
_nethttp "net/http"
|
_nethttp "net/http"
|
||||||
_neturl "net/url"
|
_neturl "net/url"
|
||||||
@ -39,22 +38,6 @@ type HealthApi interface {
|
|||||||
GetHealthExecute(r ApiGetHealthRequest) (HealthCheck, error)
|
GetHealthExecute(r ApiGetHealthRequest) (HealthCheck, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// healthApiGzipReadCloser supports streaming gzip response-bodies directly from the server.
|
|
||||||
type healthApiGzipReadCloser struct {
|
|
||||||
underlying _io.ReadCloser
|
|
||||||
gzip _io.ReadCloser
|
|
||||||
}
|
|
||||||
|
|
||||||
func (gzrc *healthApiGzipReadCloser) Read(p []byte) (int, error) {
|
|
||||||
return gzrc.gzip.Read(p)
|
|
||||||
}
|
|
||||||
func (gzrc *healthApiGzipReadCloser) Close() error {
|
|
||||||
if err := gzrc.gzip.Close(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return gzrc.underlying.Close()
|
|
||||||
}
|
|
||||||
|
|
||||||
// HealthApiService HealthApi service
|
// HealthApiService HealthApi service
|
||||||
type HealthApiService service
|
type HealthApiService service
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_context "context"
|
_context "context"
|
||||||
_io "io"
|
|
||||||
_ioutil "io/ioutil"
|
_ioutil "io/ioutil"
|
||||||
_nethttp "net/http"
|
_nethttp "net/http"
|
||||||
_neturl "net/url"
|
_neturl "net/url"
|
||||||
@ -136,22 +135,6 @@ type OrganizationsApi interface {
|
|||||||
PostOrgsIDMembersExecute(r ApiPostOrgsIDMembersRequest) (ResourceMember, error)
|
PostOrgsIDMembersExecute(r ApiPostOrgsIDMembersRequest) (ResourceMember, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// organizationsApiGzipReadCloser supports streaming gzip response-bodies directly from the server.
|
|
||||||
type organizationsApiGzipReadCloser struct {
|
|
||||||
underlying _io.ReadCloser
|
|
||||||
gzip _io.ReadCloser
|
|
||||||
}
|
|
||||||
|
|
||||||
func (gzrc *organizationsApiGzipReadCloser) Read(p []byte) (int, error) {
|
|
||||||
return gzrc.gzip.Read(p)
|
|
||||||
}
|
|
||||||
func (gzrc *organizationsApiGzipReadCloser) Close() error {
|
|
||||||
if err := gzrc.gzip.Close(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return gzrc.underlying.Close()
|
|
||||||
}
|
|
||||||
|
|
||||||
// OrganizationsApiService OrganizationsApi service
|
// OrganizationsApiService OrganizationsApi service
|
||||||
type OrganizationsApiService service
|
type OrganizationsApiService service
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_context "context"
|
_context "context"
|
||||||
_io "io"
|
|
||||||
_ioutil "io/ioutil"
|
_ioutil "io/ioutil"
|
||||||
_nethttp "net/http"
|
_nethttp "net/http"
|
||||||
_neturl "net/url"
|
_neturl "net/url"
|
||||||
@ -39,22 +38,6 @@ type QueryApi interface {
|
|||||||
PostQueryExecute(r ApiPostQueryRequest) (*_nethttp.Response, error)
|
PostQueryExecute(r ApiPostQueryRequest) (*_nethttp.Response, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// queryApiGzipReadCloser supports streaming gzip response-bodies directly from the server.
|
|
||||||
type queryApiGzipReadCloser struct {
|
|
||||||
underlying _io.ReadCloser
|
|
||||||
gzip _io.ReadCloser
|
|
||||||
}
|
|
||||||
|
|
||||||
func (gzrc *queryApiGzipReadCloser) Read(p []byte) (int, error) {
|
|
||||||
return gzrc.gzip.Read(p)
|
|
||||||
}
|
|
||||||
func (gzrc *queryApiGzipReadCloser) Close() error {
|
|
||||||
if err := gzrc.gzip.Close(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return gzrc.underlying.Close()
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryApiService QueryApi service
|
// QueryApiService QueryApi service
|
||||||
type QueryApiService service
|
type QueryApiService service
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ import (
|
|||||||
_ioutil "io/ioutil"
|
_ioutil "io/ioutil"
|
||||||
_nethttp "net/http"
|
_nethttp "net/http"
|
||||||
_neturl "net/url"
|
_neturl "net/url"
|
||||||
"os"
|
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -79,22 +78,6 @@ type RestoreApi interface {
|
|||||||
PostRestoreShardIdExecute(r ApiPostRestoreShardIdRequest) error
|
PostRestoreShardIdExecute(r ApiPostRestoreShardIdRequest) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// restoreApiGzipReadCloser supports streaming gzip response-bodies directly from the server.
|
|
||||||
type restoreApiGzipReadCloser struct {
|
|
||||||
underlying _io.ReadCloser
|
|
||||||
gzip _io.ReadCloser
|
|
||||||
}
|
|
||||||
|
|
||||||
func (gzrc *restoreApiGzipReadCloser) Read(p []byte) (int, error) {
|
|
||||||
return gzrc.gzip.Read(p)
|
|
||||||
}
|
|
||||||
func (gzrc *restoreApiGzipReadCloser) Close() error {
|
|
||||||
if err := gzrc.gzip.Close(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return gzrc.underlying.Close()
|
|
||||||
}
|
|
||||||
|
|
||||||
// RestoreApiService RestoreApi service
|
// RestoreApiService RestoreApi service
|
||||||
type RestoreApiService service
|
type RestoreApiService service
|
||||||
|
|
||||||
@ -259,16 +242,16 @@ func (a *RestoreApiService) PostRestoreBucketMetadataIdExecute(r ApiPostRestoreB
|
|||||||
type ApiPostRestoreKVRequest struct {
|
type ApiPostRestoreKVRequest struct {
|
||||||
ctx _context.Context
|
ctx _context.Context
|
||||||
ApiService RestoreApi
|
ApiService RestoreApi
|
||||||
body **os.File
|
body _io.ReadCloser
|
||||||
zapTraceSpan *string
|
zapTraceSpan *string
|
||||||
contentEncoding *string
|
contentEncoding *string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r ApiPostRestoreKVRequest) Body(body *os.File) ApiPostRestoreKVRequest {
|
func (r ApiPostRestoreKVRequest) Body(body _io.ReadCloser) ApiPostRestoreKVRequest {
|
||||||
r.body = &body
|
r.body = body
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
func (r ApiPostRestoreKVRequest) GetBody() **os.File {
|
func (r ApiPostRestoreKVRequest) GetBody() _io.ReadCloser {
|
||||||
return r.body
|
return r.body
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,16 +379,16 @@ func (a *RestoreApiService) PostRestoreKVExecute(r ApiPostRestoreKVRequest) erro
|
|||||||
type ApiPostRestoreSQLRequest struct {
|
type ApiPostRestoreSQLRequest struct {
|
||||||
ctx _context.Context
|
ctx _context.Context
|
||||||
ApiService RestoreApi
|
ApiService RestoreApi
|
||||||
body **os.File
|
body _io.ReadCloser
|
||||||
zapTraceSpan *string
|
zapTraceSpan *string
|
||||||
contentEncoding *string
|
contentEncoding *string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r ApiPostRestoreSQLRequest) Body(body *os.File) ApiPostRestoreSQLRequest {
|
func (r ApiPostRestoreSQLRequest) Body(body _io.ReadCloser) ApiPostRestoreSQLRequest {
|
||||||
r.body = &body
|
r.body = body
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
func (r ApiPostRestoreSQLRequest) GetBody() **os.File {
|
func (r ApiPostRestoreSQLRequest) GetBody() _io.ReadCloser {
|
||||||
return r.body
|
return r.body
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -534,7 +517,7 @@ type ApiPostRestoreShardIdRequest struct {
|
|||||||
ctx _context.Context
|
ctx _context.Context
|
||||||
ApiService RestoreApi
|
ApiService RestoreApi
|
||||||
shardID string
|
shardID string
|
||||||
body **os.File
|
body _io.ReadCloser
|
||||||
zapTraceSpan *string
|
zapTraceSpan *string
|
||||||
contentEncoding *string
|
contentEncoding *string
|
||||||
}
|
}
|
||||||
@ -547,11 +530,11 @@ func (r ApiPostRestoreShardIdRequest) GetShardID() string {
|
|||||||
return r.shardID
|
return r.shardID
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r ApiPostRestoreShardIdRequest) Body(body *os.File) ApiPostRestoreShardIdRequest {
|
func (r ApiPostRestoreShardIdRequest) Body(body _io.ReadCloser) ApiPostRestoreShardIdRequest {
|
||||||
r.body = &body
|
r.body = body
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
func (r ApiPostRestoreShardIdRequest) GetBody() **os.File {
|
func (r ApiPostRestoreShardIdRequest) GetBody() _io.ReadCloser {
|
||||||
return r.body
|
return r.body
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_context "context"
|
_context "context"
|
||||||
_io "io"
|
|
||||||
_ioutil "io/ioutil"
|
_ioutil "io/ioutil"
|
||||||
_nethttp "net/http"
|
_nethttp "net/http"
|
||||||
_neturl "net/url"
|
_neturl "net/url"
|
||||||
@ -54,22 +53,6 @@ type SetupApi interface {
|
|||||||
PostSetupExecute(r ApiPostSetupRequest) (OnboardingResponse, error)
|
PostSetupExecute(r ApiPostSetupRequest) (OnboardingResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// setupApiGzipReadCloser supports streaming gzip response-bodies directly from the server.
|
|
||||||
type setupApiGzipReadCloser struct {
|
|
||||||
underlying _io.ReadCloser
|
|
||||||
gzip _io.ReadCloser
|
|
||||||
}
|
|
||||||
|
|
||||||
func (gzrc *setupApiGzipReadCloser) Read(p []byte) (int, error) {
|
|
||||||
return gzrc.gzip.Read(p)
|
|
||||||
}
|
|
||||||
func (gzrc *setupApiGzipReadCloser) Close() error {
|
|
||||||
if err := gzrc.gzip.Close(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return gzrc.underlying.Close()
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetupApiService SetupApi service
|
// SetupApiService SetupApi service
|
||||||
type SetupApiService service
|
type SetupApiService service
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_context "context"
|
_context "context"
|
||||||
_io "io"
|
|
||||||
_ioutil "io/ioutil"
|
_ioutil "io/ioutil"
|
||||||
_nethttp "net/http"
|
_nethttp "net/http"
|
||||||
_neturl "net/url"
|
_neturl "net/url"
|
||||||
@ -198,22 +197,6 @@ type TasksApi interface {
|
|||||||
PostTasksIDRunsIDRetryExecute(r ApiPostTasksIDRunsIDRetryRequest) (Run, error)
|
PostTasksIDRunsIDRetryExecute(r ApiPostTasksIDRunsIDRetryRequest) (Run, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// tasksApiGzipReadCloser supports streaming gzip response-bodies directly from the server.
|
|
||||||
type tasksApiGzipReadCloser struct {
|
|
||||||
underlying _io.ReadCloser
|
|
||||||
gzip _io.ReadCloser
|
|
||||||
}
|
|
||||||
|
|
||||||
func (gzrc *tasksApiGzipReadCloser) Read(p []byte) (int, error) {
|
|
||||||
return gzrc.gzip.Read(p)
|
|
||||||
}
|
|
||||||
func (gzrc *tasksApiGzipReadCloser) Close() error {
|
|
||||||
if err := gzrc.gzip.Close(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return gzrc.underlying.Close()
|
|
||||||
}
|
|
||||||
|
|
||||||
// TasksApiService TasksApi service
|
// TasksApiService TasksApi service
|
||||||
type TasksApiService service
|
type TasksApiService service
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_context "context"
|
_context "context"
|
||||||
_io "io"
|
|
||||||
_ioutil "io/ioutil"
|
_ioutil "io/ioutil"
|
||||||
_nethttp "net/http"
|
_nethttp "net/http"
|
||||||
_neturl "net/url"
|
_neturl "net/url"
|
||||||
@ -107,22 +106,6 @@ type UsersApi interface {
|
|||||||
PostUsersIDPasswordExecute(r ApiPostUsersIDPasswordRequest) error
|
PostUsersIDPasswordExecute(r ApiPostUsersIDPasswordRequest) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// usersApiGzipReadCloser supports streaming gzip response-bodies directly from the server.
|
|
||||||
type usersApiGzipReadCloser struct {
|
|
||||||
underlying _io.ReadCloser
|
|
||||||
gzip _io.ReadCloser
|
|
||||||
}
|
|
||||||
|
|
||||||
func (gzrc *usersApiGzipReadCloser) Read(p []byte) (int, error) {
|
|
||||||
return gzrc.gzip.Read(p)
|
|
||||||
}
|
|
||||||
func (gzrc *usersApiGzipReadCloser) Close() error {
|
|
||||||
if err := gzrc.gzip.Close(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return gzrc.underlying.Close()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UsersApiService UsersApi service
|
// UsersApiService UsersApi service
|
||||||
type UsersApiService service
|
type UsersApiService service
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
_context "context"
|
_context "context"
|
||||||
_io "io"
|
|
||||||
_ioutil "io/ioutil"
|
_ioutil "io/ioutil"
|
||||||
_nethttp "net/http"
|
_nethttp "net/http"
|
||||||
_neturl "net/url"
|
_neturl "net/url"
|
||||||
@ -38,22 +37,6 @@ type WriteApi interface {
|
|||||||
PostWriteExecute(r ApiPostWriteRequest) error
|
PostWriteExecute(r ApiPostWriteRequest) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// writeApiGzipReadCloser supports streaming gzip response-bodies directly from the server.
|
|
||||||
type writeApiGzipReadCloser struct {
|
|
||||||
underlying _io.ReadCloser
|
|
||||||
gzip _io.ReadCloser
|
|
||||||
}
|
|
||||||
|
|
||||||
func (gzrc *writeApiGzipReadCloser) Read(p []byte) (int, error) {
|
|
||||||
return gzrc.gzip.Read(p)
|
|
||||||
}
|
|
||||||
func (gzrc *writeApiGzipReadCloser) Close() error {
|
|
||||||
if err := gzrc.gzip.Close(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return gzrc.underlying.Close()
|
|
||||||
}
|
|
||||||
|
|
||||||
// WriteApiService WriteApi service
|
// WriteApiService WriteApi service
|
||||||
type WriteApiService service
|
type WriteApiService service
|
||||||
|
|
||||||
|
@ -14,10 +14,11 @@ multiple locations.
|
|||||||
`api.mustache`
|
`api.mustache`
|
||||||
* Add `GetX()` methods for each request parameter `X`, for use in unit tests
|
* Add `GetX()` methods for each request parameter `X`, for use in unit tests
|
||||||
* Add checks for `isByteArray` to generate `[]byte` request fields instead of `*string`
|
* Add checks for `isByteArray` to generate `[]byte` request fields instead of `*string`
|
||||||
|
* Add checks for `isBinary` to generate `io.ReadCloser` request fields instead of `**os.File`
|
||||||
* Update creation of `GenericOpenAPIError` to track sub-error models by reference
|
* Update creation of `GenericOpenAPIError` to track sub-error models by reference
|
||||||
* Add checks for `isResponseBinary` to directly return the raw `*http.Response`, instead of
|
* Add checks for `isResponseBinary` to directly return the raw `*http.Response`, instead of
|
||||||
pulling the entire body into memory and transforming it into an `*os.File`
|
pulling the entire body into memory and transforming it into an `*os.File`
|
||||||
* GUnzip response bodies before unmarshalling when `Content-Encoding: gzip` is set
|
* GUnzip non-binary response bodies before unmarshalling when `Content-Encoding: gzip` is set
|
||||||
* Remove `*http.Response`s from the return values of generated operations
|
* Remove `*http.Response`s from the return values of generated operations
|
||||||
|
|
||||||
`client.mustache`
|
`client.mustache`
|
||||||
|
@ -42,21 +42,6 @@ type {{classname}} interface {
|
|||||||
}
|
}
|
||||||
{{/generateInterfaces}}
|
{{/generateInterfaces}}
|
||||||
|
|
||||||
// {{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}GzipReadCloser supports streaming gzip response-bodies directly from the server.
|
|
||||||
type {{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}GzipReadCloser struct {
|
|
||||||
underlying _io.ReadCloser
|
|
||||||
gzip _io.ReadCloser
|
|
||||||
}
|
|
||||||
func (gzrc *{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}GzipReadCloser) Read(p []byte) (int, error) {
|
|
||||||
return gzrc.gzip.Read(p)
|
|
||||||
}
|
|
||||||
func (gzrc *{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}GzipReadCloser) Close() error {
|
|
||||||
if err := gzrc.gzip.Close(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return gzrc.underlying.Close()
|
|
||||||
}
|
|
||||||
|
|
||||||
// {{classname}}Service {{classname}} service
|
// {{classname}}Service {{classname}} service
|
||||||
type {{classname}}Service service
|
type {{classname}}Service service
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
@ -68,15 +53,15 @@ type {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request s
|
|||||||
ApiService *{{classname}}Service
|
ApiService *{{classname}}Service
|
||||||
{{/generateInterfaces}}
|
{{/generateInterfaces}}
|
||||||
{{#allParams}}
|
{{#allParams}}
|
||||||
{{paramName}} {{#isByteArray}}[]byte{{/isByteArray}}{{^isByteArray}}{{^isPathParam}}*{{/isPathParam}}{{{dataType}}}{{/isByteArray}}
|
{{paramName}} {{#isByteArray}}[]byte{{/isByteArray}}{{#isBinary}}_io.ReadCloser{{/isBinary}}{{^isByteArray}}{{^isBinary}}{{^isPathParam}}*{{/isPathParam}}{{{dataType}}}{{/isBinary}}{{/isByteArray}}
|
||||||
{{/allParams}}
|
{{/allParams}}
|
||||||
}
|
}
|
||||||
{{#allParams}}
|
{{#allParams}}
|
||||||
func (r {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request) {{vendorExtensions.x-export-param-name}}({{paramName}} {{#isByteArray}}[]byte{{/isByteArray}}{{^isByteArray}}{{{dataType}}}{{/isByteArray}}) {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request {
|
func (r {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request) {{vendorExtensions.x-export-param-name}}({{paramName}} {{#isByteArray}}[]byte{{/isByteArray}}{{#isBinary}}_io.ReadCloser{{/isBinary}}{{^isByteArray}}{{^isBinary}}{{{dataType}}}{{/isBinary}}{{/isByteArray}}) {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request {
|
||||||
r.{{paramName}} = {{^isByteArray}}{{^isPathParam}}&{{/isPathParam}}{{/isByteArray}}{{paramName}}
|
r.{{paramName}} = {{^isByteArray}}{{^isBinary}}{{^isPathParam}}&{{/isPathParam}}{{/isBinary}}{{/isByteArray}}{{paramName}}
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
func (r {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request) Get{{vendorExtensions.x-export-param-name}}() {{#isByteArray}}[]byte{{/isByteArray}}{{^isByteArray}}{{^isPathParam}}*{{/isPathParam}}{{{dataType}}}{{/isByteArray}} {
|
func (r {{#structPrefix}}{{&classname}}{{/structPrefix}}Api{{operationId}}Request) Get{{vendorExtensions.x-export-param-name}}() {{#isByteArray}}[]byte{{/isByteArray}}{{#isBinary}}_io.ReadCloser{{/isBinary}}{{^isByteArray}}{{^isBinary}}{{^isPathParam}}*{{/isPathParam}}{{{dataType}}}{{/isBinary}}{{/isByteArray}} {
|
||||||
return r.{{paramName}}
|
return r.{{paramName}}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -350,11 +335,11 @@ func (a *{{{classname}}}Service) {{nickname}}Execute(r {{#structPrefix}}{{&class
|
|||||||
}
|
}
|
||||||
|
|
||||||
if localVarHTTPResponse.StatusCode >= 300 {
|
if localVarHTTPResponse.StatusCode >= 300 {
|
||||||
body, err := GunzipIfNeeded(localVarHTTPResponse)
|
body, err := GunzipIfNeeded(localVarHTTPResponse)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
body.Close()
|
body.Close()
|
||||||
return {{#returnType}}localVarReturnValue, {{/returnType}}err
|
return {{#returnType}}localVarReturnValue, {{/returnType}}err
|
||||||
}
|
}
|
||||||
localVarBody, err := _ioutil.ReadAll(body)
|
localVarBody, err := _ioutil.ReadAll(body)
|
||||||
body.Close()
|
body.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -396,11 +381,11 @@ func (a *{{{classname}}}Service) {{nickname}}Execute(r {{#structPrefix}}{{&class
|
|||||||
localVarReturnValue = localVarHTTPResponse
|
localVarReturnValue = localVarHTTPResponse
|
||||||
{{/isResponseBinary}}
|
{{/isResponseBinary}}
|
||||||
{{^isResponseBinary}}
|
{{^isResponseBinary}}
|
||||||
body, err := GunzipIfNeeded(localVarHTTPResponse)
|
body, err := GunzipIfNeeded(localVarHTTPResponse)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
body.Close()
|
body.Close()
|
||||||
return {{#returnType}}localVarReturnValue, {{/returnType}}err
|
return {{#returnType}}localVarReturnValue, {{/returnType}}err
|
||||||
}
|
}
|
||||||
localVarBody, err := _ioutil.ReadAll(body)
|
localVarBody, err := _ioutil.ReadAll(body)
|
||||||
body.Close()
|
body.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user