diff --git a/etc/generate-openapi.sh b/etc/generate-openapi.sh index 32cda5e..571abc6 100755 --- a/etc/generate-openapi.sh +++ b/etc/generate-openapi.sh @@ -6,7 +6,7 @@ declare -r API_DIR="${ROOT_DIR}/internal/api" declare -r GENERATED_PATTERN='^// Code generated .* DO NOT EDIT\.$' declare -r GENERATOR_DOCKER_IMG=openapitools/openapi-generator-cli:v5.1.0 -declare -r OPENAPI_COMMIT=af4e3efa496c8adcd2838145652fdd8d63a90702 +declare -r OPENAPI_COMMIT=4f62aa6175c6f8e9a425ea8e3e143c8c93f2c652 # Clean up all the generated files in the target directory. rm $(grep -Elr "${GENERATED_PATTERN}" "${API_DIR}") diff --git a/internal/api/api_query.gen.go b/internal/api/api_query.gen.go new file mode 100644 index 0000000..b324745 --- /dev/null +++ b/internal/api/api_query.gen.go @@ -0,0 +1,239 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + _gzip "compress/gzip" + _context "context" + _io "io" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" +) + +// Linger please +var ( + _ _context.Context +) + +type QueryApi interface { + + /* + * PostQuery Query InfluxDB + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiPostQueryRequest + */ + PostQuery(ctx _context.Context) ApiPostQueryRequest + + /* + * PostQueryExecute executes the request + * @return *os.File + */ + PostQueryExecute(r ApiPostQueryRequest) (_io.ReadCloser, 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 +type QueryApiService service + +type ApiPostQueryRequest struct { + ctx _context.Context + ApiService QueryApi + zapTraceSpan *string + acceptEncoding *string + contentType *string + org *string + orgID *string + query *Query +} + +func (r ApiPostQueryRequest) ZapTraceSpan(zapTraceSpan string) ApiPostQueryRequest { + r.zapTraceSpan = &zapTraceSpan + return r +} +func (r ApiPostQueryRequest) GetZapTraceSpan() *string { + return r.zapTraceSpan +} + +func (r ApiPostQueryRequest) AcceptEncoding(acceptEncoding string) ApiPostQueryRequest { + r.acceptEncoding = &acceptEncoding + return r +} +func (r ApiPostQueryRequest) GetAcceptEncoding() *string { + return r.acceptEncoding +} + +func (r ApiPostQueryRequest) ContentType(contentType string) ApiPostQueryRequest { + r.contentType = &contentType + return r +} +func (r ApiPostQueryRequest) GetContentType() *string { + return r.contentType +} + +func (r ApiPostQueryRequest) Org(org string) ApiPostQueryRequest { + r.org = &org + return r +} +func (r ApiPostQueryRequest) GetOrg() *string { + return r.org +} + +func (r ApiPostQueryRequest) OrgID(orgID string) ApiPostQueryRequest { + r.orgID = &orgID + return r +} +func (r ApiPostQueryRequest) GetOrgID() *string { + return r.orgID +} + +func (r ApiPostQueryRequest) Query(query Query) ApiPostQueryRequest { + r.query = &query + return r +} +func (r ApiPostQueryRequest) GetQuery() *Query { + return r.query +} + +func (r ApiPostQueryRequest) Execute() (_io.ReadCloser, error) { + return r.ApiService.PostQueryExecute(r) +} + +/* + * PostQuery Query InfluxDB + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @return ApiPostQueryRequest + */ +func (a *QueryApiService) PostQuery(ctx _context.Context) ApiPostQueryRequest { + return ApiPostQueryRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return *os.File + */ +func (a *QueryApiService) PostQueryExecute(r ApiPostQueryRequest) (_io.ReadCloser, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue _io.ReadCloser + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "QueryApiService.PostQuery") + if err != nil { + return localVarReturnValue, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/query" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.org != nil { + localVarQueryParams.Add("org", parameterToString(*r.org, "")) + } + if r.orgID != nil { + localVarQueryParams.Add("orgID", parameterToString(*r.orgID, "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/csv", "application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.zapTraceSpan != nil { + localVarHeaderParams["Zap-Trace-Span"] = parameterToString(*r.zapTraceSpan, "") + } + if r.acceptEncoding != nil { + localVarHeaderParams["Accept-Encoding"] = parameterToString(*r.acceptEncoding, "") + } + if r.contentType != nil { + localVarHeaderParams["Content-Type"] = parameterToString(*r.contentType, "") + } + // body params + localVarPostBody = r.query + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + var body _io.ReadCloser = localVarHTTPResponse.Body + if localVarHTTPResponse.Header.Get("Content-Encoding") == "gzip" { + gzr, err := _gzip.NewReader(body) + if err != nil { + body.Close() + return localVarReturnValue, err + } + body = &queryApiGzipReadCloser{underlying: body, gzip: gzr} + } + + if localVarHTTPResponse.StatusCode >= 300 { + localVarBody, err := _ioutil.ReadAll(body) + body.Close() + if err != nil { + return localVarReturnValue, err + } + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, newErr + } + newErr.model = &v + return localVarReturnValue, newErr + } + + localVarReturnValue = body + + return localVarReturnValue, nil +} diff --git a/internal/api/api_query_test.go b/internal/api/api_query_test.go new file mode 100644 index 0000000..a25add4 --- /dev/null +++ b/internal/api/api_query_test.go @@ -0,0 +1,93 @@ +package api_test + +import ( + "bytes" + "compress/gzip" + "context" + "io" + "net/http" + "net/http/httptest" + "testing" + + "github.com/influxdata/influx-cli/v2/internal/api" + "github.com/stretchr/testify/require" +) + +var exampleResponse = `result,table,_start,_stop,_time,region,host,_value +mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:00Z,east,A,15.43 +mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:20Z,east,B,59.25 +mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:40Z,east,C,52.62` + +func setupServer(t *testing.T) (*httptest.Server, api.QueryApi) { + t.Helper() + + server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { + isGzip := req.Header.Get("Accept-Encoding") == "gzip" + if isGzip { + rw.Header().Set("Content-Encoding", "gzip") + } + rw.WriteHeader(200) + + if isGzip { + buf := bytes.Buffer{} + gzw := gzip.NewWriter(&buf) + if _, err := gzw.Write([]byte(exampleResponse)); err != nil { + _ = gzw.Close() + t.Fatalf("unexpected error: %v", err) + } + require.NoError(t, gzw.Close()) + _, err := io.Copy(rw, &buf) + require.NoError(t, err) + } else { + _, err := rw.Write([]byte(exampleResponse)) + require.NoError(t, err) + } + })) + + config := api.NewConfiguration() + config.Scheme = "http" + config.Host = server.Listener.Addr().String() + client := api.NewAPIClient(config) + + return server, client.QueryApi +} + +func TestQuery_NoGzip(t *testing.T) { + t.Parallel() + + server, client := setupServer(t) + defer server.Close() + + resp, err := client.PostQuery(context.Background()). + AcceptEncoding("identity"). + Query(api.Query{}). + Execute() + require.NoError(t, err) + defer resp.Close() + + out := bytes.Buffer{} + _, err = io.Copy(&out, resp) + require.NoError(t, err) + + require.Equal(t, exampleResponse, out.String()) +} + +func TestQuery_Gzip(t *testing.T) { + t.Parallel() + + server, client := setupServer(t) + defer server.Close() + + resp, err := client.PostQuery(context.Background()). + AcceptEncoding("gzip"). + Query(api.Query{}). + Execute() + require.NoError(t, err) + defer resp.Close() + + out := bytes.Buffer{} + _, err = io.Copy(&out, resp) + require.NoError(t, err) + + require.Equal(t, exampleResponse, out.String()) +} diff --git a/internal/api/client.gen.go b/internal/api/client.gen.go index 0b5280b..e3e1d0c 100644 --- a/internal/api/client.gen.go +++ b/internal/api/client.gen.go @@ -55,6 +55,8 @@ type APIClient struct { OrganizationsApi OrganizationsApi + QueryApi QueryApi + SetupApi SetupApi WriteApi WriteApi @@ -80,6 +82,7 @@ func NewAPIClient(cfg *Configuration) *APIClient { c.BucketsApi = (*BucketsApiService)(&c.common) c.HealthApi = (*HealthApiService)(&c.common) c.OrganizationsApi = (*OrganizationsApiService)(&c.common) + c.QueryApi = (*QueryApiService)(&c.common) c.SetupApi = (*SetupApiService)(&c.common) c.WriteApi = (*WriteApiService)(&c.common) diff --git a/internal/api/model_array_expression.gen.go b/internal/api/model_array_expression.gen.go new file mode 100644 index 0000000..25a6e41 --- /dev/null +++ b/internal/api/model_array_expression.gen.go @@ -0,0 +1,151 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// ArrayExpression Used to create and directly specify the elements of an array object +type ArrayExpression struct { + // Type of AST node + Type *string `json:"type,omitempty"` + // Elements of the array + Elements *[]Expression `json:"elements,omitempty"` +} + +// NewArrayExpression instantiates a new ArrayExpression object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewArrayExpression() *ArrayExpression { + this := ArrayExpression{} + return &this +} + +// NewArrayExpressionWithDefaults instantiates a new ArrayExpression object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewArrayExpressionWithDefaults() *ArrayExpression { + this := ArrayExpression{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *ArrayExpression) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ArrayExpression) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *ArrayExpression) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *ArrayExpression) SetType(v string) { + o.Type = &v +} + +// GetElements returns the Elements field value if set, zero value otherwise. +func (o *ArrayExpression) GetElements() []Expression { + if o == nil || o.Elements == nil { + var ret []Expression + return ret + } + return *o.Elements +} + +// GetElementsOk returns a tuple with the Elements field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ArrayExpression) GetElementsOk() (*[]Expression, bool) { + if o == nil || o.Elements == nil { + return nil, false + } + return o.Elements, true +} + +// HasElements returns a boolean if a field has been set. +func (o *ArrayExpression) HasElements() bool { + if o != nil && o.Elements != nil { + return true + } + + return false +} + +// SetElements gets a reference to the given []Expression and assigns it to the Elements field. +func (o *ArrayExpression) SetElements(v []Expression) { + o.Elements = &v +} + +func (o ArrayExpression) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Elements != nil { + toSerialize["elements"] = o.Elements + } + return json.Marshal(toSerialize) +} + +type NullableArrayExpression struct { + value *ArrayExpression + isSet bool +} + +func (v NullableArrayExpression) Get() *ArrayExpression { + return v.value +} + +func (v *NullableArrayExpression) Set(val *ArrayExpression) { + v.value = val + v.isSet = true +} + +func (v NullableArrayExpression) IsSet() bool { + return v.isSet +} + +func (v *NullableArrayExpression) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableArrayExpression(val *ArrayExpression) *NullableArrayExpression { + return &NullableArrayExpression{value: val, isSet: true} +} + +func (v NullableArrayExpression) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableArrayExpression) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_bad_statement.gen.go b/internal/api/model_bad_statement.gen.go new file mode 100644 index 0000000..9a0fa07 --- /dev/null +++ b/internal/api/model_bad_statement.gen.go @@ -0,0 +1,151 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// BadStatement A placeholder for statements for which no correct statement nodes can be created +type BadStatement struct { + // Type of AST node + Type *string `json:"type,omitempty"` + // Raw source text + Text *string `json:"text,omitempty"` +} + +// NewBadStatement instantiates a new BadStatement object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBadStatement() *BadStatement { + this := BadStatement{} + return &this +} + +// NewBadStatementWithDefaults instantiates a new BadStatement object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBadStatementWithDefaults() *BadStatement { + this := BadStatement{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *BadStatement) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BadStatement) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *BadStatement) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *BadStatement) SetType(v string) { + o.Type = &v +} + +// GetText returns the Text field value if set, zero value otherwise. +func (o *BadStatement) GetText() string { + if o == nil || o.Text == nil { + var ret string + return ret + } + return *o.Text +} + +// GetTextOk returns a tuple with the Text field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BadStatement) GetTextOk() (*string, bool) { + if o == nil || o.Text == nil { + return nil, false + } + return o.Text, true +} + +// HasText returns a boolean if a field has been set. +func (o *BadStatement) HasText() bool { + if o != nil && o.Text != nil { + return true + } + + return false +} + +// SetText gets a reference to the given string and assigns it to the Text field. +func (o *BadStatement) SetText(v string) { + o.Text = &v +} + +func (o BadStatement) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Text != nil { + toSerialize["text"] = o.Text + } + return json.Marshal(toSerialize) +} + +type NullableBadStatement struct { + value *BadStatement + isSet bool +} + +func (v NullableBadStatement) Get() *BadStatement { + return v.value +} + +func (v *NullableBadStatement) Set(val *BadStatement) { + v.value = val + v.isSet = true +} + +func (v NullableBadStatement) IsSet() bool { + return v.isSet +} + +func (v *NullableBadStatement) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBadStatement(val *BadStatement) *NullableBadStatement { + return &NullableBadStatement{value: val, isSet: true} +} + +func (v NullableBadStatement) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBadStatement) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_binary_expression.gen.go b/internal/api/model_binary_expression.gen.go new file mode 100644 index 0000000..ad84c49 --- /dev/null +++ b/internal/api/model_binary_expression.gen.go @@ -0,0 +1,222 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// BinaryExpression uses binary operators to act on two operands in an expression +type BinaryExpression struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Operator *string `json:"operator,omitempty"` + Left *Expression `json:"left,omitempty"` + Right *Expression `json:"right,omitempty"` +} + +// NewBinaryExpression instantiates a new BinaryExpression object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBinaryExpression() *BinaryExpression { + this := BinaryExpression{} + return &this +} + +// NewBinaryExpressionWithDefaults instantiates a new BinaryExpression object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBinaryExpressionWithDefaults() *BinaryExpression { + this := BinaryExpression{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *BinaryExpression) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BinaryExpression) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *BinaryExpression) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *BinaryExpression) SetType(v string) { + o.Type = &v +} + +// GetOperator returns the Operator field value if set, zero value otherwise. +func (o *BinaryExpression) GetOperator() string { + if o == nil || o.Operator == nil { + var ret string + return ret + } + return *o.Operator +} + +// GetOperatorOk returns a tuple with the Operator field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BinaryExpression) GetOperatorOk() (*string, bool) { + if o == nil || o.Operator == nil { + return nil, false + } + return o.Operator, true +} + +// HasOperator returns a boolean if a field has been set. +func (o *BinaryExpression) HasOperator() bool { + if o != nil && o.Operator != nil { + return true + } + + return false +} + +// SetOperator gets a reference to the given string and assigns it to the Operator field. +func (o *BinaryExpression) SetOperator(v string) { + o.Operator = &v +} + +// GetLeft returns the Left field value if set, zero value otherwise. +func (o *BinaryExpression) GetLeft() Expression { + if o == nil || o.Left == nil { + var ret Expression + return ret + } + return *o.Left +} + +// GetLeftOk returns a tuple with the Left field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BinaryExpression) GetLeftOk() (*Expression, bool) { + if o == nil || o.Left == nil { + return nil, false + } + return o.Left, true +} + +// HasLeft returns a boolean if a field has been set. +func (o *BinaryExpression) HasLeft() bool { + if o != nil && o.Left != nil { + return true + } + + return false +} + +// SetLeft gets a reference to the given Expression and assigns it to the Left field. +func (o *BinaryExpression) SetLeft(v Expression) { + o.Left = &v +} + +// GetRight returns the Right field value if set, zero value otherwise. +func (o *BinaryExpression) GetRight() Expression { + if o == nil || o.Right == nil { + var ret Expression + return ret + } + return *o.Right +} + +// GetRightOk returns a tuple with the Right field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BinaryExpression) GetRightOk() (*Expression, bool) { + if o == nil || o.Right == nil { + return nil, false + } + return o.Right, true +} + +// HasRight returns a boolean if a field has been set. +func (o *BinaryExpression) HasRight() bool { + if o != nil && o.Right != nil { + return true + } + + return false +} + +// SetRight gets a reference to the given Expression and assigns it to the Right field. +func (o *BinaryExpression) SetRight(v Expression) { + o.Right = &v +} + +func (o BinaryExpression) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Operator != nil { + toSerialize["operator"] = o.Operator + } + if o.Left != nil { + toSerialize["left"] = o.Left + } + if o.Right != nil { + toSerialize["right"] = o.Right + } + return json.Marshal(toSerialize) +} + +type NullableBinaryExpression struct { + value *BinaryExpression + isSet bool +} + +func (v NullableBinaryExpression) Get() *BinaryExpression { + return v.value +} + +func (v *NullableBinaryExpression) Set(val *BinaryExpression) { + v.value = val + v.isSet = true +} + +func (v NullableBinaryExpression) IsSet() bool { + return v.isSet +} + +func (v *NullableBinaryExpression) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBinaryExpression(val *BinaryExpression) *NullableBinaryExpression { + return &NullableBinaryExpression{value: val, isSet: true} +} + +func (v NullableBinaryExpression) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBinaryExpression) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_block.gen.go b/internal/api/model_block.gen.go new file mode 100644 index 0000000..a158f2f --- /dev/null +++ b/internal/api/model_block.gen.go @@ -0,0 +1,151 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// Block A set of statements +type Block struct { + // Type of AST node + Type *string `json:"type,omitempty"` + // Block body + Body *[]Statement `json:"body,omitempty"` +} + +// NewBlock instantiates a new Block object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBlock() *Block { + this := Block{} + return &this +} + +// NewBlockWithDefaults instantiates a new Block object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBlockWithDefaults() *Block { + this := Block{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Block) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Block) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *Block) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *Block) SetType(v string) { + o.Type = &v +} + +// GetBody returns the Body field value if set, zero value otherwise. +func (o *Block) GetBody() []Statement { + if o == nil || o.Body == nil { + var ret []Statement + return ret + } + return *o.Body +} + +// GetBodyOk returns a tuple with the Body field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Block) GetBodyOk() (*[]Statement, bool) { + if o == nil || o.Body == nil { + return nil, false + } + return o.Body, true +} + +// HasBody returns a boolean if a field has been set. +func (o *Block) HasBody() bool { + if o != nil && o.Body != nil { + return true + } + + return false +} + +// SetBody gets a reference to the given []Statement and assigns it to the Body field. +func (o *Block) SetBody(v []Statement) { + o.Body = &v +} + +func (o Block) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Body != nil { + toSerialize["body"] = o.Body + } + return json.Marshal(toSerialize) +} + +type NullableBlock struct { + value *Block + isSet bool +} + +func (v NullableBlock) Get() *Block { + return v.value +} + +func (v *NullableBlock) Set(val *Block) { + v.value = val + v.isSet = true +} + +func (v NullableBlock) IsSet() bool { + return v.isSet +} + +func (v *NullableBlock) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBlock(val *Block) *NullableBlock { + return &NullableBlock{value: val, isSet: true} +} + +func (v NullableBlock) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBlock) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_boolean_literal.gen.go b/internal/api/model_boolean_literal.gen.go new file mode 100644 index 0000000..c92c300 --- /dev/null +++ b/internal/api/model_boolean_literal.gen.go @@ -0,0 +1,150 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// BooleanLiteral Represents boolean values +type BooleanLiteral struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Value *bool `json:"value,omitempty"` +} + +// NewBooleanLiteral instantiates a new BooleanLiteral object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBooleanLiteral() *BooleanLiteral { + this := BooleanLiteral{} + return &this +} + +// NewBooleanLiteralWithDefaults instantiates a new BooleanLiteral object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBooleanLiteralWithDefaults() *BooleanLiteral { + this := BooleanLiteral{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *BooleanLiteral) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BooleanLiteral) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *BooleanLiteral) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *BooleanLiteral) SetType(v string) { + o.Type = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *BooleanLiteral) GetValue() bool { + if o == nil || o.Value == nil { + var ret bool + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BooleanLiteral) GetValueOk() (*bool, bool) { + if o == nil || o.Value == nil { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *BooleanLiteral) HasValue() bool { + if o != nil && o.Value != nil { + return true + } + + return false +} + +// SetValue gets a reference to the given bool and assigns it to the Value field. +func (o *BooleanLiteral) SetValue(v bool) { + o.Value = &v +} + +func (o BooleanLiteral) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + return json.Marshal(toSerialize) +} + +type NullableBooleanLiteral struct { + value *BooleanLiteral + isSet bool +} + +func (v NullableBooleanLiteral) Get() *BooleanLiteral { + return v.value +} + +func (v *NullableBooleanLiteral) Set(val *BooleanLiteral) { + v.value = val + v.isSet = true +} + +func (v NullableBooleanLiteral) IsSet() bool { + return v.isSet +} + +func (v *NullableBooleanLiteral) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBooleanLiteral(val *BooleanLiteral) *NullableBooleanLiteral { + return &NullableBooleanLiteral{value: val, isSet: true} +} + +func (v NullableBooleanLiteral) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBooleanLiteral) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_builtin_statement.gen.go b/internal/api/model_builtin_statement.gen.go new file mode 100644 index 0000000..8946e6c --- /dev/null +++ b/internal/api/model_builtin_statement.gen.go @@ -0,0 +1,150 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// BuiltinStatement Declares a builtin identifier and its type +type BuiltinStatement struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Id *Identifier `json:"id,omitempty"` +} + +// NewBuiltinStatement instantiates a new BuiltinStatement object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBuiltinStatement() *BuiltinStatement { + this := BuiltinStatement{} + return &this +} + +// NewBuiltinStatementWithDefaults instantiates a new BuiltinStatement object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBuiltinStatementWithDefaults() *BuiltinStatement { + this := BuiltinStatement{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *BuiltinStatement) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BuiltinStatement) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *BuiltinStatement) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *BuiltinStatement) SetType(v string) { + o.Type = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *BuiltinStatement) GetId() Identifier { + if o == nil || o.Id == nil { + var ret Identifier + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BuiltinStatement) GetIdOk() (*Identifier, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *BuiltinStatement) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given Identifier and assigns it to the Id field. +func (o *BuiltinStatement) SetId(v Identifier) { + o.Id = &v +} + +func (o BuiltinStatement) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + return json.Marshal(toSerialize) +} + +type NullableBuiltinStatement struct { + value *BuiltinStatement + isSet bool +} + +func (v NullableBuiltinStatement) Get() *BuiltinStatement { + return v.value +} + +func (v *NullableBuiltinStatement) Set(val *BuiltinStatement) { + v.value = val + v.isSet = true +} + +func (v NullableBuiltinStatement) IsSet() bool { + return v.isSet +} + +func (v *NullableBuiltinStatement) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBuiltinStatement(val *BuiltinStatement) *NullableBuiltinStatement { + return &NullableBuiltinStatement{value: val, isSet: true} +} + +func (v NullableBuiltinStatement) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBuiltinStatement) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_call_expression.gen.go b/internal/api/model_call_expression.gen.go new file mode 100644 index 0000000..510ff8f --- /dev/null +++ b/internal/api/model_call_expression.gen.go @@ -0,0 +1,187 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// CallExpression Represents a function call +type CallExpression struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Callee *Expression `json:"callee,omitempty"` + // Function arguments + Arguments *[]Expression `json:"arguments,omitempty"` +} + +// NewCallExpression instantiates a new CallExpression object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCallExpression() *CallExpression { + this := CallExpression{} + return &this +} + +// NewCallExpressionWithDefaults instantiates a new CallExpression object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCallExpressionWithDefaults() *CallExpression { + this := CallExpression{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *CallExpression) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CallExpression) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *CallExpression) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *CallExpression) SetType(v string) { + o.Type = &v +} + +// GetCallee returns the Callee field value if set, zero value otherwise. +func (o *CallExpression) GetCallee() Expression { + if o == nil || o.Callee == nil { + var ret Expression + return ret + } + return *o.Callee +} + +// GetCalleeOk returns a tuple with the Callee field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CallExpression) GetCalleeOk() (*Expression, bool) { + if o == nil || o.Callee == nil { + return nil, false + } + return o.Callee, true +} + +// HasCallee returns a boolean if a field has been set. +func (o *CallExpression) HasCallee() bool { + if o != nil && o.Callee != nil { + return true + } + + return false +} + +// SetCallee gets a reference to the given Expression and assigns it to the Callee field. +func (o *CallExpression) SetCallee(v Expression) { + o.Callee = &v +} + +// GetArguments returns the Arguments field value if set, zero value otherwise. +func (o *CallExpression) GetArguments() []Expression { + if o == nil || o.Arguments == nil { + var ret []Expression + return ret + } + return *o.Arguments +} + +// GetArgumentsOk returns a tuple with the Arguments field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CallExpression) GetArgumentsOk() (*[]Expression, bool) { + if o == nil || o.Arguments == nil { + return nil, false + } + return o.Arguments, true +} + +// HasArguments returns a boolean if a field has been set. +func (o *CallExpression) HasArguments() bool { + if o != nil && o.Arguments != nil { + return true + } + + return false +} + +// SetArguments gets a reference to the given []Expression and assigns it to the Arguments field. +func (o *CallExpression) SetArguments(v []Expression) { + o.Arguments = &v +} + +func (o CallExpression) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Callee != nil { + toSerialize["callee"] = o.Callee + } + if o.Arguments != nil { + toSerialize["arguments"] = o.Arguments + } + return json.Marshal(toSerialize) +} + +type NullableCallExpression struct { + value *CallExpression + isSet bool +} + +func (v NullableCallExpression) Get() *CallExpression { + return v.value +} + +func (v *NullableCallExpression) Set(val *CallExpression) { + v.value = val + v.isSet = true +} + +func (v NullableCallExpression) IsSet() bool { + return v.isSet +} + +func (v *NullableCallExpression) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCallExpression(val *CallExpression) *NullableCallExpression { + return &NullableCallExpression{value: val, isSet: true} +} + +func (v NullableCallExpression) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCallExpression) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_conditional_expression.gen.go b/internal/api/model_conditional_expression.gen.go new file mode 100644 index 0000000..4b4c1e7 --- /dev/null +++ b/internal/api/model_conditional_expression.gen.go @@ -0,0 +1,222 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// ConditionalExpression Selects one of two expressions, `Alternate` or `Consequent`, depending on a third boolean expression, `Test` +type ConditionalExpression struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Test *Expression `json:"test,omitempty"` + Alternate *Expression `json:"alternate,omitempty"` + Consequent *Expression `json:"consequent,omitempty"` +} + +// NewConditionalExpression instantiates a new ConditionalExpression object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewConditionalExpression() *ConditionalExpression { + this := ConditionalExpression{} + return &this +} + +// NewConditionalExpressionWithDefaults instantiates a new ConditionalExpression object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewConditionalExpressionWithDefaults() *ConditionalExpression { + this := ConditionalExpression{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *ConditionalExpression) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConditionalExpression) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *ConditionalExpression) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *ConditionalExpression) SetType(v string) { + o.Type = &v +} + +// GetTest returns the Test field value if set, zero value otherwise. +func (o *ConditionalExpression) GetTest() Expression { + if o == nil || o.Test == nil { + var ret Expression + return ret + } + return *o.Test +} + +// GetTestOk returns a tuple with the Test field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConditionalExpression) GetTestOk() (*Expression, bool) { + if o == nil || o.Test == nil { + return nil, false + } + return o.Test, true +} + +// HasTest returns a boolean if a field has been set. +func (o *ConditionalExpression) HasTest() bool { + if o != nil && o.Test != nil { + return true + } + + return false +} + +// SetTest gets a reference to the given Expression and assigns it to the Test field. +func (o *ConditionalExpression) SetTest(v Expression) { + o.Test = &v +} + +// GetAlternate returns the Alternate field value if set, zero value otherwise. +func (o *ConditionalExpression) GetAlternate() Expression { + if o == nil || o.Alternate == nil { + var ret Expression + return ret + } + return *o.Alternate +} + +// GetAlternateOk returns a tuple with the Alternate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConditionalExpression) GetAlternateOk() (*Expression, bool) { + if o == nil || o.Alternate == nil { + return nil, false + } + return o.Alternate, true +} + +// HasAlternate returns a boolean if a field has been set. +func (o *ConditionalExpression) HasAlternate() bool { + if o != nil && o.Alternate != nil { + return true + } + + return false +} + +// SetAlternate gets a reference to the given Expression and assigns it to the Alternate field. +func (o *ConditionalExpression) SetAlternate(v Expression) { + o.Alternate = &v +} + +// GetConsequent returns the Consequent field value if set, zero value otherwise. +func (o *ConditionalExpression) GetConsequent() Expression { + if o == nil || o.Consequent == nil { + var ret Expression + return ret + } + return *o.Consequent +} + +// GetConsequentOk returns a tuple with the Consequent field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConditionalExpression) GetConsequentOk() (*Expression, bool) { + if o == nil || o.Consequent == nil { + return nil, false + } + return o.Consequent, true +} + +// HasConsequent returns a boolean if a field has been set. +func (o *ConditionalExpression) HasConsequent() bool { + if o != nil && o.Consequent != nil { + return true + } + + return false +} + +// SetConsequent gets a reference to the given Expression and assigns it to the Consequent field. +func (o *ConditionalExpression) SetConsequent(v Expression) { + o.Consequent = &v +} + +func (o ConditionalExpression) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Test != nil { + toSerialize["test"] = o.Test + } + if o.Alternate != nil { + toSerialize["alternate"] = o.Alternate + } + if o.Consequent != nil { + toSerialize["consequent"] = o.Consequent + } + return json.Marshal(toSerialize) +} + +type NullableConditionalExpression struct { + value *ConditionalExpression + isSet bool +} + +func (v NullableConditionalExpression) Get() *ConditionalExpression { + return v.value +} + +func (v *NullableConditionalExpression) Set(val *ConditionalExpression) { + v.value = val + v.isSet = true +} + +func (v NullableConditionalExpression) IsSet() bool { + return v.isSet +} + +func (v *NullableConditionalExpression) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConditionalExpression(val *ConditionalExpression) *NullableConditionalExpression { + return &NullableConditionalExpression{value: val, isSet: true} +} + +func (v NullableConditionalExpression) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConditionalExpression) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_date_time_literal.gen.go b/internal/api/model_date_time_literal.gen.go new file mode 100644 index 0000000..cf88421 --- /dev/null +++ b/internal/api/model_date_time_literal.gen.go @@ -0,0 +1,150 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// DateTimeLiteral Represents an instant in time with nanosecond precision using the syntax of golang's RFC3339 Nanosecond variant +type DateTimeLiteral struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Value *string `json:"value,omitempty"` +} + +// NewDateTimeLiteral instantiates a new DateTimeLiteral object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDateTimeLiteral() *DateTimeLiteral { + this := DateTimeLiteral{} + return &this +} + +// NewDateTimeLiteralWithDefaults instantiates a new DateTimeLiteral object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDateTimeLiteralWithDefaults() *DateTimeLiteral { + this := DateTimeLiteral{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *DateTimeLiteral) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DateTimeLiteral) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *DateTimeLiteral) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *DateTimeLiteral) SetType(v string) { + o.Type = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *DateTimeLiteral) GetValue() string { + if o == nil || o.Value == nil { + var ret string + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DateTimeLiteral) GetValueOk() (*string, bool) { + if o == nil || o.Value == nil { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *DateTimeLiteral) HasValue() bool { + if o != nil && o.Value != nil { + return true + } + + return false +} + +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *DateTimeLiteral) SetValue(v string) { + o.Value = &v +} + +func (o DateTimeLiteral) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + return json.Marshal(toSerialize) +} + +type NullableDateTimeLiteral struct { + value *DateTimeLiteral + isSet bool +} + +func (v NullableDateTimeLiteral) Get() *DateTimeLiteral { + return v.value +} + +func (v *NullableDateTimeLiteral) Set(val *DateTimeLiteral) { + v.value = val + v.isSet = true +} + +func (v NullableDateTimeLiteral) IsSet() bool { + return v.isSet +} + +func (v *NullableDateTimeLiteral) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDateTimeLiteral(val *DateTimeLiteral) *NullableDateTimeLiteral { + return &NullableDateTimeLiteral{value: val, isSet: true} +} + +func (v NullableDateTimeLiteral) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDateTimeLiteral) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_dialect.gen.go b/internal/api/model_dialect.gen.go new file mode 100644 index 0000000..4487808 --- /dev/null +++ b/internal/api/model_dialect.gen.go @@ -0,0 +1,278 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// Dialect Dialect are options to change the default CSV output format; https://www.w3.org/TR/2015/REC-tabular-metadata-20151217/#dialect-descriptions +type Dialect struct { + // If true, the results will contain a header row + Header *bool `json:"header,omitempty"` + // Separator between cells; the default is , + Delimiter *string `json:"delimiter,omitempty"` + // https://www.w3.org/TR/2015/REC-tabular-data-model-20151217/#columns + Annotations *[]string `json:"annotations,omitempty"` + // Character prefixed to comment strings + CommentPrefix *string `json:"commentPrefix,omitempty"` + // Format of timestamps + DateTimeFormat *string `json:"dateTimeFormat,omitempty"` +} + +// NewDialect instantiates a new Dialect object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDialect() *Dialect { + this := Dialect{} + var header bool = true + this.Header = &header + var delimiter string = "," + this.Delimiter = &delimiter + var commentPrefix string = "#" + this.CommentPrefix = &commentPrefix + var dateTimeFormat string = "RFC3339" + this.DateTimeFormat = &dateTimeFormat + return &this +} + +// NewDialectWithDefaults instantiates a new Dialect object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDialectWithDefaults() *Dialect { + this := Dialect{} + var header bool = true + this.Header = &header + var delimiter string = "," + this.Delimiter = &delimiter + var commentPrefix string = "#" + this.CommentPrefix = &commentPrefix + var dateTimeFormat string = "RFC3339" + this.DateTimeFormat = &dateTimeFormat + return &this +} + +// GetHeader returns the Header field value if set, zero value otherwise. +func (o *Dialect) GetHeader() bool { + if o == nil || o.Header == nil { + var ret bool + return ret + } + return *o.Header +} + +// GetHeaderOk returns a tuple with the Header field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dialect) GetHeaderOk() (*bool, bool) { + if o == nil || o.Header == nil { + return nil, false + } + return o.Header, true +} + +// HasHeader returns a boolean if a field has been set. +func (o *Dialect) HasHeader() bool { + if o != nil && o.Header != nil { + return true + } + + return false +} + +// SetHeader gets a reference to the given bool and assigns it to the Header field. +func (o *Dialect) SetHeader(v bool) { + o.Header = &v +} + +// GetDelimiter returns the Delimiter field value if set, zero value otherwise. +func (o *Dialect) GetDelimiter() string { + if o == nil || o.Delimiter == nil { + var ret string + return ret + } + return *o.Delimiter +} + +// GetDelimiterOk returns a tuple with the Delimiter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dialect) GetDelimiterOk() (*string, bool) { + if o == nil || o.Delimiter == nil { + return nil, false + } + return o.Delimiter, true +} + +// HasDelimiter returns a boolean if a field has been set. +func (o *Dialect) HasDelimiter() bool { + if o != nil && o.Delimiter != nil { + return true + } + + return false +} + +// SetDelimiter gets a reference to the given string and assigns it to the Delimiter field. +func (o *Dialect) SetDelimiter(v string) { + o.Delimiter = &v +} + +// GetAnnotations returns the Annotations field value if set, zero value otherwise. +func (o *Dialect) GetAnnotations() []string { + if o == nil || o.Annotations == nil { + var ret []string + return ret + } + return *o.Annotations +} + +// GetAnnotationsOk returns a tuple with the Annotations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dialect) GetAnnotationsOk() (*[]string, bool) { + if o == nil || o.Annotations == nil { + return nil, false + } + return o.Annotations, true +} + +// HasAnnotations returns a boolean if a field has been set. +func (o *Dialect) HasAnnotations() bool { + if o != nil && o.Annotations != nil { + return true + } + + return false +} + +// SetAnnotations gets a reference to the given []string and assigns it to the Annotations field. +func (o *Dialect) SetAnnotations(v []string) { + o.Annotations = &v +} + +// GetCommentPrefix returns the CommentPrefix field value if set, zero value otherwise. +func (o *Dialect) GetCommentPrefix() string { + if o == nil || o.CommentPrefix == nil { + var ret string + return ret + } + return *o.CommentPrefix +} + +// GetCommentPrefixOk returns a tuple with the CommentPrefix field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dialect) GetCommentPrefixOk() (*string, bool) { + if o == nil || o.CommentPrefix == nil { + return nil, false + } + return o.CommentPrefix, true +} + +// HasCommentPrefix returns a boolean if a field has been set. +func (o *Dialect) HasCommentPrefix() bool { + if o != nil && o.CommentPrefix != nil { + return true + } + + return false +} + +// SetCommentPrefix gets a reference to the given string and assigns it to the CommentPrefix field. +func (o *Dialect) SetCommentPrefix(v string) { + o.CommentPrefix = &v +} + +// GetDateTimeFormat returns the DateTimeFormat field value if set, zero value otherwise. +func (o *Dialect) GetDateTimeFormat() string { + if o == nil || o.DateTimeFormat == nil { + var ret string + return ret + } + return *o.DateTimeFormat +} + +// GetDateTimeFormatOk returns a tuple with the DateTimeFormat field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dialect) GetDateTimeFormatOk() (*string, bool) { + if o == nil || o.DateTimeFormat == nil { + return nil, false + } + return o.DateTimeFormat, true +} + +// HasDateTimeFormat returns a boolean if a field has been set. +func (o *Dialect) HasDateTimeFormat() bool { + if o != nil && o.DateTimeFormat != nil { + return true + } + + return false +} + +// SetDateTimeFormat gets a reference to the given string and assigns it to the DateTimeFormat field. +func (o *Dialect) SetDateTimeFormat(v string) { + o.DateTimeFormat = &v +} + +func (o Dialect) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Header != nil { + toSerialize["header"] = o.Header + } + if o.Delimiter != nil { + toSerialize["delimiter"] = o.Delimiter + } + if o.Annotations != nil { + toSerialize["annotations"] = o.Annotations + } + if o.CommentPrefix != nil { + toSerialize["commentPrefix"] = o.CommentPrefix + } + if o.DateTimeFormat != nil { + toSerialize["dateTimeFormat"] = o.DateTimeFormat + } + return json.Marshal(toSerialize) +} + +type NullableDialect struct { + value *Dialect + isSet bool +} + +func (v NullableDialect) Get() *Dialect { + return v.value +} + +func (v *NullableDialect) Set(val *Dialect) { + v.value = val + v.isSet = true +} + +func (v NullableDialect) IsSet() bool { + return v.isSet +} + +func (v *NullableDialect) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDialect(val *Dialect) *NullableDialect { + return &NullableDialect{value: val, isSet: true} +} + +func (v NullableDialect) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDialect) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_dict_expression.gen.go b/internal/api/model_dict_expression.gen.go new file mode 100644 index 0000000..dd72bdb --- /dev/null +++ b/internal/api/model_dict_expression.gen.go @@ -0,0 +1,151 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// DictExpression Used to create and directly specify the elements of a dictionary +type DictExpression struct { + // Type of AST node + Type *string `json:"type,omitempty"` + // Elements of the dictionary + Elements *[]DictItem `json:"elements,omitempty"` +} + +// NewDictExpression instantiates a new DictExpression object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDictExpression() *DictExpression { + this := DictExpression{} + return &this +} + +// NewDictExpressionWithDefaults instantiates a new DictExpression object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDictExpressionWithDefaults() *DictExpression { + this := DictExpression{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *DictExpression) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DictExpression) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *DictExpression) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *DictExpression) SetType(v string) { + o.Type = &v +} + +// GetElements returns the Elements field value if set, zero value otherwise. +func (o *DictExpression) GetElements() []DictItem { + if o == nil || o.Elements == nil { + var ret []DictItem + return ret + } + return *o.Elements +} + +// GetElementsOk returns a tuple with the Elements field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DictExpression) GetElementsOk() (*[]DictItem, bool) { + if o == nil || o.Elements == nil { + return nil, false + } + return o.Elements, true +} + +// HasElements returns a boolean if a field has been set. +func (o *DictExpression) HasElements() bool { + if o != nil && o.Elements != nil { + return true + } + + return false +} + +// SetElements gets a reference to the given []DictItem and assigns it to the Elements field. +func (o *DictExpression) SetElements(v []DictItem) { + o.Elements = &v +} + +func (o DictExpression) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Elements != nil { + toSerialize["elements"] = o.Elements + } + return json.Marshal(toSerialize) +} + +type NullableDictExpression struct { + value *DictExpression + isSet bool +} + +func (v NullableDictExpression) Get() *DictExpression { + return v.value +} + +func (v *NullableDictExpression) Set(val *DictExpression) { + v.value = val + v.isSet = true +} + +func (v NullableDictExpression) IsSet() bool { + return v.isSet +} + +func (v *NullableDictExpression) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDictExpression(val *DictExpression) *NullableDictExpression { + return &NullableDictExpression{value: val, isSet: true} +} + +func (v NullableDictExpression) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDictExpression) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_dict_item.gen.go b/internal/api/model_dict_item.gen.go new file mode 100644 index 0000000..4d24bbd --- /dev/null +++ b/internal/api/model_dict_item.gen.go @@ -0,0 +1,186 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// DictItem A key/value pair in a dictionary +type DictItem struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Key *Expression `json:"key,omitempty"` + Val *Expression `json:"val,omitempty"` +} + +// NewDictItem instantiates a new DictItem object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDictItem() *DictItem { + this := DictItem{} + return &this +} + +// NewDictItemWithDefaults instantiates a new DictItem object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDictItemWithDefaults() *DictItem { + this := DictItem{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *DictItem) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DictItem) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *DictItem) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *DictItem) SetType(v string) { + o.Type = &v +} + +// GetKey returns the Key field value if set, zero value otherwise. +func (o *DictItem) GetKey() Expression { + if o == nil || o.Key == nil { + var ret Expression + return ret + } + return *o.Key +} + +// GetKeyOk returns a tuple with the Key field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DictItem) GetKeyOk() (*Expression, bool) { + if o == nil || o.Key == nil { + return nil, false + } + return o.Key, true +} + +// HasKey returns a boolean if a field has been set. +func (o *DictItem) HasKey() bool { + if o != nil && o.Key != nil { + return true + } + + return false +} + +// SetKey gets a reference to the given Expression and assigns it to the Key field. +func (o *DictItem) SetKey(v Expression) { + o.Key = &v +} + +// GetVal returns the Val field value if set, zero value otherwise. +func (o *DictItem) GetVal() Expression { + if o == nil || o.Val == nil { + var ret Expression + return ret + } + return *o.Val +} + +// GetValOk returns a tuple with the Val field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DictItem) GetValOk() (*Expression, bool) { + if o == nil || o.Val == nil { + return nil, false + } + return o.Val, true +} + +// HasVal returns a boolean if a field has been set. +func (o *DictItem) HasVal() bool { + if o != nil && o.Val != nil { + return true + } + + return false +} + +// SetVal gets a reference to the given Expression and assigns it to the Val field. +func (o *DictItem) SetVal(v Expression) { + o.Val = &v +} + +func (o DictItem) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Key != nil { + toSerialize["key"] = o.Key + } + if o.Val != nil { + toSerialize["val"] = o.Val + } + return json.Marshal(toSerialize) +} + +type NullableDictItem struct { + value *DictItem + isSet bool +} + +func (v NullableDictItem) Get() *DictItem { + return v.value +} + +func (v *NullableDictItem) Set(val *DictItem) { + v.value = val + v.isSet = true +} + +func (v NullableDictItem) IsSet() bool { + return v.isSet +} + +func (v *NullableDictItem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDictItem(val *DictItem) *NullableDictItem { + return &NullableDictItem{value: val, isSet: true} +} + +func (v NullableDictItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDictItem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_duration_literal.gen.go b/internal/api/model_duration_literal.gen.go new file mode 100644 index 0000000..5325378 --- /dev/null +++ b/internal/api/model_duration_literal.gen.go @@ -0,0 +1,151 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// DurationLiteral Represents the elapsed time between two instants as an int64 nanosecond count with syntax of golang's time.Duration +type DurationLiteral struct { + // Type of AST node + Type *string `json:"type,omitempty"` + // Duration values + Values *[]DurationLiteralValues `json:"values,omitempty"` +} + +// NewDurationLiteral instantiates a new DurationLiteral object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDurationLiteral() *DurationLiteral { + this := DurationLiteral{} + return &this +} + +// NewDurationLiteralWithDefaults instantiates a new DurationLiteral object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDurationLiteralWithDefaults() *DurationLiteral { + this := DurationLiteral{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *DurationLiteral) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DurationLiteral) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *DurationLiteral) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *DurationLiteral) SetType(v string) { + o.Type = &v +} + +// GetValues returns the Values field value if set, zero value otherwise. +func (o *DurationLiteral) GetValues() []DurationLiteralValues { + if o == nil || o.Values == nil { + var ret []DurationLiteralValues + return ret + } + return *o.Values +} + +// GetValuesOk returns a tuple with the Values field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DurationLiteral) GetValuesOk() (*[]DurationLiteralValues, bool) { + if o == nil || o.Values == nil { + return nil, false + } + return o.Values, true +} + +// HasValues returns a boolean if a field has been set. +func (o *DurationLiteral) HasValues() bool { + if o != nil && o.Values != nil { + return true + } + + return false +} + +// SetValues gets a reference to the given []DurationLiteralValues and assigns it to the Values field. +func (o *DurationLiteral) SetValues(v []DurationLiteralValues) { + o.Values = &v +} + +func (o DurationLiteral) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Values != nil { + toSerialize["values"] = o.Values + } + return json.Marshal(toSerialize) +} + +type NullableDurationLiteral struct { + value *DurationLiteral + isSet bool +} + +func (v NullableDurationLiteral) Get() *DurationLiteral { + return v.value +} + +func (v *NullableDurationLiteral) Set(val *DurationLiteral) { + v.value = val + v.isSet = true +} + +func (v NullableDurationLiteral) IsSet() bool { + return v.isSet +} + +func (v *NullableDurationLiteral) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDurationLiteral(val *DurationLiteral) *NullableDurationLiteral { + return &NullableDurationLiteral{value: val, isSet: true} +} + +func (v NullableDurationLiteral) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDurationLiteral) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_duration_literal_values.gen.go b/internal/api/model_duration_literal_values.gen.go new file mode 100644 index 0000000..36a976a --- /dev/null +++ b/internal/api/model_duration_literal_values.gen.go @@ -0,0 +1,186 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// DurationLiteralValues A pair consisting of length of time and the unit of time measured. It is the atomic unit from which all duration literals are composed. +type DurationLiteralValues struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Magnitude *int32 `json:"magnitude,omitempty"` + Unit *string `json:"unit,omitempty"` +} + +// NewDurationLiteralValues instantiates a new DurationLiteralValues object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDurationLiteralValues() *DurationLiteralValues { + this := DurationLiteralValues{} + return &this +} + +// NewDurationLiteralValuesWithDefaults instantiates a new DurationLiteralValues object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDurationLiteralValuesWithDefaults() *DurationLiteralValues { + this := DurationLiteralValues{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *DurationLiteralValues) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DurationLiteralValues) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *DurationLiteralValues) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *DurationLiteralValues) SetType(v string) { + o.Type = &v +} + +// GetMagnitude returns the Magnitude field value if set, zero value otherwise. +func (o *DurationLiteralValues) GetMagnitude() int32 { + if o == nil || o.Magnitude == nil { + var ret int32 + return ret + } + return *o.Magnitude +} + +// GetMagnitudeOk returns a tuple with the Magnitude field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DurationLiteralValues) GetMagnitudeOk() (*int32, bool) { + if o == nil || o.Magnitude == nil { + return nil, false + } + return o.Magnitude, true +} + +// HasMagnitude returns a boolean if a field has been set. +func (o *DurationLiteralValues) HasMagnitude() bool { + if o != nil && o.Magnitude != nil { + return true + } + + return false +} + +// SetMagnitude gets a reference to the given int32 and assigns it to the Magnitude field. +func (o *DurationLiteralValues) SetMagnitude(v int32) { + o.Magnitude = &v +} + +// GetUnit returns the Unit field value if set, zero value otherwise. +func (o *DurationLiteralValues) GetUnit() string { + if o == nil || o.Unit == nil { + var ret string + return ret + } + return *o.Unit +} + +// GetUnitOk returns a tuple with the Unit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DurationLiteralValues) GetUnitOk() (*string, bool) { + if o == nil || o.Unit == nil { + return nil, false + } + return o.Unit, true +} + +// HasUnit returns a boolean if a field has been set. +func (o *DurationLiteralValues) HasUnit() bool { + if o != nil && o.Unit != nil { + return true + } + + return false +} + +// SetUnit gets a reference to the given string and assigns it to the Unit field. +func (o *DurationLiteralValues) SetUnit(v string) { + o.Unit = &v +} + +func (o DurationLiteralValues) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Magnitude != nil { + toSerialize["magnitude"] = o.Magnitude + } + if o.Unit != nil { + toSerialize["unit"] = o.Unit + } + return json.Marshal(toSerialize) +} + +type NullableDurationLiteralValues struct { + value *DurationLiteralValues + isSet bool +} + +func (v NullableDurationLiteralValues) Get() *DurationLiteralValues { + return v.value +} + +func (v *NullableDurationLiteralValues) Set(val *DurationLiteralValues) { + v.value = val + v.isSet = true +} + +func (v NullableDurationLiteralValues) IsSet() bool { + return v.isSet +} + +func (v *NullableDurationLiteralValues) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDurationLiteralValues(val *DurationLiteralValues) *NullableDurationLiteralValues { + return &NullableDurationLiteralValues{value: val, isSet: true} +} + +func (v NullableDurationLiteralValues) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDurationLiteralValues) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_expression.gen.go b/internal/api/model_expression.gen.go new file mode 100644 index 0000000..f838abe --- /dev/null +++ b/internal/api/model_expression.gen.go @@ -0,0 +1,726 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" + "errors" +) + +// Expression - struct for Expression +type Expression struct { + ArrayExpression *ArrayExpression + BinaryExpression *BinaryExpression + BooleanLiteral *BooleanLiteral + CallExpression *CallExpression + ConditionalExpression *ConditionalExpression + DateTimeLiteral *DateTimeLiteral + DictExpression *DictExpression + DurationLiteral *DurationLiteral + FloatLiteral *FloatLiteral + FunctionExpression *FunctionExpression + Identifier *Identifier + IndexExpression *IndexExpression + IntegerLiteral *IntegerLiteral + LogicalExpression *LogicalExpression + MemberExpression *MemberExpression + ObjectExpression *ObjectExpression + ParenExpression *ParenExpression + PipeExpression *PipeExpression + PipeLiteral *PipeLiteral + RegexpLiteral *RegexpLiteral + StringLiteral *StringLiteral + UnaryExpression *UnaryExpression + UnsignedIntegerLiteral *UnsignedIntegerLiteral +} + +// ArrayExpressionAsExpression is a convenience function that returns ArrayExpression wrapped in Expression +func ArrayExpressionAsExpression(v *ArrayExpression) Expression { + return Expression{ArrayExpression: v} +} + +// BinaryExpressionAsExpression is a convenience function that returns BinaryExpression wrapped in Expression +func BinaryExpressionAsExpression(v *BinaryExpression) Expression { + return Expression{BinaryExpression: v} +} + +// BooleanLiteralAsExpression is a convenience function that returns BooleanLiteral wrapped in Expression +func BooleanLiteralAsExpression(v *BooleanLiteral) Expression { + return Expression{BooleanLiteral: v} +} + +// CallExpressionAsExpression is a convenience function that returns CallExpression wrapped in Expression +func CallExpressionAsExpression(v *CallExpression) Expression { + return Expression{CallExpression: v} +} + +// ConditionalExpressionAsExpression is a convenience function that returns ConditionalExpression wrapped in Expression +func ConditionalExpressionAsExpression(v *ConditionalExpression) Expression { + return Expression{ConditionalExpression: v} +} + +// DateTimeLiteralAsExpression is a convenience function that returns DateTimeLiteral wrapped in Expression +func DateTimeLiteralAsExpression(v *DateTimeLiteral) Expression { + return Expression{DateTimeLiteral: v} +} + +// DictExpressionAsExpression is a convenience function that returns DictExpression wrapped in Expression +func DictExpressionAsExpression(v *DictExpression) Expression { + return Expression{DictExpression: v} +} + +// DurationLiteralAsExpression is a convenience function that returns DurationLiteral wrapped in Expression +func DurationLiteralAsExpression(v *DurationLiteral) Expression { + return Expression{DurationLiteral: v} +} + +// FloatLiteralAsExpression is a convenience function that returns FloatLiteral wrapped in Expression +func FloatLiteralAsExpression(v *FloatLiteral) Expression { + return Expression{FloatLiteral: v} +} + +// FunctionExpressionAsExpression is a convenience function that returns FunctionExpression wrapped in Expression +func FunctionExpressionAsExpression(v *FunctionExpression) Expression { + return Expression{FunctionExpression: v} +} + +// IdentifierAsExpression is a convenience function that returns Identifier wrapped in Expression +func IdentifierAsExpression(v *Identifier) Expression { + return Expression{Identifier: v} +} + +// IndexExpressionAsExpression is a convenience function that returns IndexExpression wrapped in Expression +func IndexExpressionAsExpression(v *IndexExpression) Expression { + return Expression{IndexExpression: v} +} + +// IntegerLiteralAsExpression is a convenience function that returns IntegerLiteral wrapped in Expression +func IntegerLiteralAsExpression(v *IntegerLiteral) Expression { + return Expression{IntegerLiteral: v} +} + +// LogicalExpressionAsExpression is a convenience function that returns LogicalExpression wrapped in Expression +func LogicalExpressionAsExpression(v *LogicalExpression) Expression { + return Expression{LogicalExpression: v} +} + +// MemberExpressionAsExpression is a convenience function that returns MemberExpression wrapped in Expression +func MemberExpressionAsExpression(v *MemberExpression) Expression { + return Expression{MemberExpression: v} +} + +// ObjectExpressionAsExpression is a convenience function that returns ObjectExpression wrapped in Expression +func ObjectExpressionAsExpression(v *ObjectExpression) Expression { + return Expression{ObjectExpression: v} +} + +// ParenExpressionAsExpression is a convenience function that returns ParenExpression wrapped in Expression +func ParenExpressionAsExpression(v *ParenExpression) Expression { + return Expression{ParenExpression: v} +} + +// PipeExpressionAsExpression is a convenience function that returns PipeExpression wrapped in Expression +func PipeExpressionAsExpression(v *PipeExpression) Expression { + return Expression{PipeExpression: v} +} + +// PipeLiteralAsExpression is a convenience function that returns PipeLiteral wrapped in Expression +func PipeLiteralAsExpression(v *PipeLiteral) Expression { + return Expression{PipeLiteral: v} +} + +// RegexpLiteralAsExpression is a convenience function that returns RegexpLiteral wrapped in Expression +func RegexpLiteralAsExpression(v *RegexpLiteral) Expression { + return Expression{RegexpLiteral: v} +} + +// StringLiteralAsExpression is a convenience function that returns StringLiteral wrapped in Expression +func StringLiteralAsExpression(v *StringLiteral) Expression { + return Expression{StringLiteral: v} +} + +// UnaryExpressionAsExpression is a convenience function that returns UnaryExpression wrapped in Expression +func UnaryExpressionAsExpression(v *UnaryExpression) Expression { + return Expression{UnaryExpression: v} +} + +// UnsignedIntegerLiteralAsExpression is a convenience function that returns UnsignedIntegerLiteral wrapped in Expression +func UnsignedIntegerLiteralAsExpression(v *UnsignedIntegerLiteral) Expression { + return Expression{UnsignedIntegerLiteral: v} +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *Expression) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into ArrayExpression + err = json.Unmarshal(data, &dst.ArrayExpression) + if err == nil { + jsonArrayExpression, _ := json.Marshal(dst.ArrayExpression) + if string(jsonArrayExpression) == "{}" { // empty struct + dst.ArrayExpression = nil + } else { + match++ + } + } else { + dst.ArrayExpression = nil + } + + // try to unmarshal data into BinaryExpression + err = json.Unmarshal(data, &dst.BinaryExpression) + if err == nil { + jsonBinaryExpression, _ := json.Marshal(dst.BinaryExpression) + if string(jsonBinaryExpression) == "{}" { // empty struct + dst.BinaryExpression = nil + } else { + match++ + } + } else { + dst.BinaryExpression = nil + } + + // try to unmarshal data into BooleanLiteral + err = json.Unmarshal(data, &dst.BooleanLiteral) + if err == nil { + jsonBooleanLiteral, _ := json.Marshal(dst.BooleanLiteral) + if string(jsonBooleanLiteral) == "{}" { // empty struct + dst.BooleanLiteral = nil + } else { + match++ + } + } else { + dst.BooleanLiteral = nil + } + + // try to unmarshal data into CallExpression + err = json.Unmarshal(data, &dst.CallExpression) + if err == nil { + jsonCallExpression, _ := json.Marshal(dst.CallExpression) + if string(jsonCallExpression) == "{}" { // empty struct + dst.CallExpression = nil + } else { + match++ + } + } else { + dst.CallExpression = nil + } + + // try to unmarshal data into ConditionalExpression + err = json.Unmarshal(data, &dst.ConditionalExpression) + if err == nil { + jsonConditionalExpression, _ := json.Marshal(dst.ConditionalExpression) + if string(jsonConditionalExpression) == "{}" { // empty struct + dst.ConditionalExpression = nil + } else { + match++ + } + } else { + dst.ConditionalExpression = nil + } + + // try to unmarshal data into DateTimeLiteral + err = json.Unmarshal(data, &dst.DateTimeLiteral) + if err == nil { + jsonDateTimeLiteral, _ := json.Marshal(dst.DateTimeLiteral) + if string(jsonDateTimeLiteral) == "{}" { // empty struct + dst.DateTimeLiteral = nil + } else { + match++ + } + } else { + dst.DateTimeLiteral = nil + } + + // try to unmarshal data into DictExpression + err = json.Unmarshal(data, &dst.DictExpression) + if err == nil { + jsonDictExpression, _ := json.Marshal(dst.DictExpression) + if string(jsonDictExpression) == "{}" { // empty struct + dst.DictExpression = nil + } else { + match++ + } + } else { + dst.DictExpression = nil + } + + // try to unmarshal data into DurationLiteral + err = json.Unmarshal(data, &dst.DurationLiteral) + if err == nil { + jsonDurationLiteral, _ := json.Marshal(dst.DurationLiteral) + if string(jsonDurationLiteral) == "{}" { // empty struct + dst.DurationLiteral = nil + } else { + match++ + } + } else { + dst.DurationLiteral = nil + } + + // try to unmarshal data into FloatLiteral + err = json.Unmarshal(data, &dst.FloatLiteral) + if err == nil { + jsonFloatLiteral, _ := json.Marshal(dst.FloatLiteral) + if string(jsonFloatLiteral) == "{}" { // empty struct + dst.FloatLiteral = nil + } else { + match++ + } + } else { + dst.FloatLiteral = nil + } + + // try to unmarshal data into FunctionExpression + err = json.Unmarshal(data, &dst.FunctionExpression) + if err == nil { + jsonFunctionExpression, _ := json.Marshal(dst.FunctionExpression) + if string(jsonFunctionExpression) == "{}" { // empty struct + dst.FunctionExpression = nil + } else { + match++ + } + } else { + dst.FunctionExpression = nil + } + + // try to unmarshal data into Identifier + err = json.Unmarshal(data, &dst.Identifier) + if err == nil { + jsonIdentifier, _ := json.Marshal(dst.Identifier) + if string(jsonIdentifier) == "{}" { // empty struct + dst.Identifier = nil + } else { + match++ + } + } else { + dst.Identifier = nil + } + + // try to unmarshal data into IndexExpression + err = json.Unmarshal(data, &dst.IndexExpression) + if err == nil { + jsonIndexExpression, _ := json.Marshal(dst.IndexExpression) + if string(jsonIndexExpression) == "{}" { // empty struct + dst.IndexExpression = nil + } else { + match++ + } + } else { + dst.IndexExpression = nil + } + + // try to unmarshal data into IntegerLiteral + err = json.Unmarshal(data, &dst.IntegerLiteral) + if err == nil { + jsonIntegerLiteral, _ := json.Marshal(dst.IntegerLiteral) + if string(jsonIntegerLiteral) == "{}" { // empty struct + dst.IntegerLiteral = nil + } else { + match++ + } + } else { + dst.IntegerLiteral = nil + } + + // try to unmarshal data into LogicalExpression + err = json.Unmarshal(data, &dst.LogicalExpression) + if err == nil { + jsonLogicalExpression, _ := json.Marshal(dst.LogicalExpression) + if string(jsonLogicalExpression) == "{}" { // empty struct + dst.LogicalExpression = nil + } else { + match++ + } + } else { + dst.LogicalExpression = nil + } + + // try to unmarshal data into MemberExpression + err = json.Unmarshal(data, &dst.MemberExpression) + if err == nil { + jsonMemberExpression, _ := json.Marshal(dst.MemberExpression) + if string(jsonMemberExpression) == "{}" { // empty struct + dst.MemberExpression = nil + } else { + match++ + } + } else { + dst.MemberExpression = nil + } + + // try to unmarshal data into ObjectExpression + err = json.Unmarshal(data, &dst.ObjectExpression) + if err == nil { + jsonObjectExpression, _ := json.Marshal(dst.ObjectExpression) + if string(jsonObjectExpression) == "{}" { // empty struct + dst.ObjectExpression = nil + } else { + match++ + } + } else { + dst.ObjectExpression = nil + } + + // try to unmarshal data into ParenExpression + err = json.Unmarshal(data, &dst.ParenExpression) + if err == nil { + jsonParenExpression, _ := json.Marshal(dst.ParenExpression) + if string(jsonParenExpression) == "{}" { // empty struct + dst.ParenExpression = nil + } else { + match++ + } + } else { + dst.ParenExpression = nil + } + + // try to unmarshal data into PipeExpression + err = json.Unmarshal(data, &dst.PipeExpression) + if err == nil { + jsonPipeExpression, _ := json.Marshal(dst.PipeExpression) + if string(jsonPipeExpression) == "{}" { // empty struct + dst.PipeExpression = nil + } else { + match++ + } + } else { + dst.PipeExpression = nil + } + + // try to unmarshal data into PipeLiteral + err = json.Unmarshal(data, &dst.PipeLiteral) + if err == nil { + jsonPipeLiteral, _ := json.Marshal(dst.PipeLiteral) + if string(jsonPipeLiteral) == "{}" { // empty struct + dst.PipeLiteral = nil + } else { + match++ + } + } else { + dst.PipeLiteral = nil + } + + // try to unmarshal data into RegexpLiteral + err = json.Unmarshal(data, &dst.RegexpLiteral) + if err == nil { + jsonRegexpLiteral, _ := json.Marshal(dst.RegexpLiteral) + if string(jsonRegexpLiteral) == "{}" { // empty struct + dst.RegexpLiteral = nil + } else { + match++ + } + } else { + dst.RegexpLiteral = nil + } + + // try to unmarshal data into StringLiteral + err = json.Unmarshal(data, &dst.StringLiteral) + if err == nil { + jsonStringLiteral, _ := json.Marshal(dst.StringLiteral) + if string(jsonStringLiteral) == "{}" { // empty struct + dst.StringLiteral = nil + } else { + match++ + } + } else { + dst.StringLiteral = nil + } + + // try to unmarshal data into UnaryExpression + err = json.Unmarshal(data, &dst.UnaryExpression) + if err == nil { + jsonUnaryExpression, _ := json.Marshal(dst.UnaryExpression) + if string(jsonUnaryExpression) == "{}" { // empty struct + dst.UnaryExpression = nil + } else { + match++ + } + } else { + dst.UnaryExpression = nil + } + + // try to unmarshal data into UnsignedIntegerLiteral + err = json.Unmarshal(data, &dst.UnsignedIntegerLiteral) + if err == nil { + jsonUnsignedIntegerLiteral, _ := json.Marshal(dst.UnsignedIntegerLiteral) + if string(jsonUnsignedIntegerLiteral) == "{}" { // empty struct + dst.UnsignedIntegerLiteral = nil + } else { + match++ + } + } else { + dst.UnsignedIntegerLiteral = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.ArrayExpression = nil + dst.BinaryExpression = nil + dst.BooleanLiteral = nil + dst.CallExpression = nil + dst.ConditionalExpression = nil + dst.DateTimeLiteral = nil + dst.DictExpression = nil + dst.DurationLiteral = nil + dst.FloatLiteral = nil + dst.FunctionExpression = nil + dst.Identifier = nil + dst.IndexExpression = nil + dst.IntegerLiteral = nil + dst.LogicalExpression = nil + dst.MemberExpression = nil + dst.ObjectExpression = nil + dst.ParenExpression = nil + dst.PipeExpression = nil + dst.PipeLiteral = nil + dst.RegexpLiteral = nil + dst.StringLiteral = nil + dst.UnaryExpression = nil + dst.UnsignedIntegerLiteral = nil + + return errors.New("data matches more than one schema in oneOf(Expression)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return errors.New("data failed to match schemas in oneOf(Expression)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src Expression) MarshalJSON() ([]byte, error) { + if src.ArrayExpression != nil { + return json.Marshal(&src.ArrayExpression) + } + + if src.BinaryExpression != nil { + return json.Marshal(&src.BinaryExpression) + } + + if src.BooleanLiteral != nil { + return json.Marshal(&src.BooleanLiteral) + } + + if src.CallExpression != nil { + return json.Marshal(&src.CallExpression) + } + + if src.ConditionalExpression != nil { + return json.Marshal(&src.ConditionalExpression) + } + + if src.DateTimeLiteral != nil { + return json.Marshal(&src.DateTimeLiteral) + } + + if src.DictExpression != nil { + return json.Marshal(&src.DictExpression) + } + + if src.DurationLiteral != nil { + return json.Marshal(&src.DurationLiteral) + } + + if src.FloatLiteral != nil { + return json.Marshal(&src.FloatLiteral) + } + + if src.FunctionExpression != nil { + return json.Marshal(&src.FunctionExpression) + } + + if src.Identifier != nil { + return json.Marshal(&src.Identifier) + } + + if src.IndexExpression != nil { + return json.Marshal(&src.IndexExpression) + } + + if src.IntegerLiteral != nil { + return json.Marshal(&src.IntegerLiteral) + } + + if src.LogicalExpression != nil { + return json.Marshal(&src.LogicalExpression) + } + + if src.MemberExpression != nil { + return json.Marshal(&src.MemberExpression) + } + + if src.ObjectExpression != nil { + return json.Marshal(&src.ObjectExpression) + } + + if src.ParenExpression != nil { + return json.Marshal(&src.ParenExpression) + } + + if src.PipeExpression != nil { + return json.Marshal(&src.PipeExpression) + } + + if src.PipeLiteral != nil { + return json.Marshal(&src.PipeLiteral) + } + + if src.RegexpLiteral != nil { + return json.Marshal(&src.RegexpLiteral) + } + + if src.StringLiteral != nil { + return json.Marshal(&src.StringLiteral) + } + + if src.UnaryExpression != nil { + return json.Marshal(&src.UnaryExpression) + } + + if src.UnsignedIntegerLiteral != nil { + return json.Marshal(&src.UnsignedIntegerLiteral) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *Expression) GetActualInstance() interface{} { + if obj.ArrayExpression != nil { + return obj.ArrayExpression + } + + if obj.BinaryExpression != nil { + return obj.BinaryExpression + } + + if obj.BooleanLiteral != nil { + return obj.BooleanLiteral + } + + if obj.CallExpression != nil { + return obj.CallExpression + } + + if obj.ConditionalExpression != nil { + return obj.ConditionalExpression + } + + if obj.DateTimeLiteral != nil { + return obj.DateTimeLiteral + } + + if obj.DictExpression != nil { + return obj.DictExpression + } + + if obj.DurationLiteral != nil { + return obj.DurationLiteral + } + + if obj.FloatLiteral != nil { + return obj.FloatLiteral + } + + if obj.FunctionExpression != nil { + return obj.FunctionExpression + } + + if obj.Identifier != nil { + return obj.Identifier + } + + if obj.IndexExpression != nil { + return obj.IndexExpression + } + + if obj.IntegerLiteral != nil { + return obj.IntegerLiteral + } + + if obj.LogicalExpression != nil { + return obj.LogicalExpression + } + + if obj.MemberExpression != nil { + return obj.MemberExpression + } + + if obj.ObjectExpression != nil { + return obj.ObjectExpression + } + + if obj.ParenExpression != nil { + return obj.ParenExpression + } + + if obj.PipeExpression != nil { + return obj.PipeExpression + } + + if obj.PipeLiteral != nil { + return obj.PipeLiteral + } + + if obj.RegexpLiteral != nil { + return obj.RegexpLiteral + } + + if obj.StringLiteral != nil { + return obj.StringLiteral + } + + if obj.UnaryExpression != nil { + return obj.UnaryExpression + } + + if obj.UnsignedIntegerLiteral != nil { + return obj.UnsignedIntegerLiteral + } + + // all schemas are nil + return nil +} + +type NullableExpression struct { + value *Expression + isSet bool +} + +func (v NullableExpression) Get() *Expression { + return v.value +} + +func (v *NullableExpression) Set(val *Expression) { + v.value = val + v.isSet = true +} + +func (v NullableExpression) IsSet() bool { + return v.isSet +} + +func (v *NullableExpression) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableExpression(val *Expression) *NullableExpression { + return &NullableExpression{value: val, isSet: true} +} + +func (v NullableExpression) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableExpression) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_expression_statement.gen.go b/internal/api/model_expression_statement.gen.go new file mode 100644 index 0000000..ccfe077 --- /dev/null +++ b/internal/api/model_expression_statement.gen.go @@ -0,0 +1,150 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// ExpressionStatement May consist of an expression that does not return a value and is executed solely for its side-effects +type ExpressionStatement struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Expression *Expression `json:"expression,omitempty"` +} + +// NewExpressionStatement instantiates a new ExpressionStatement object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewExpressionStatement() *ExpressionStatement { + this := ExpressionStatement{} + return &this +} + +// NewExpressionStatementWithDefaults instantiates a new ExpressionStatement object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewExpressionStatementWithDefaults() *ExpressionStatement { + this := ExpressionStatement{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *ExpressionStatement) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ExpressionStatement) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *ExpressionStatement) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *ExpressionStatement) SetType(v string) { + o.Type = &v +} + +// GetExpression returns the Expression field value if set, zero value otherwise. +func (o *ExpressionStatement) GetExpression() Expression { + if o == nil || o.Expression == nil { + var ret Expression + return ret + } + return *o.Expression +} + +// GetExpressionOk returns a tuple with the Expression field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ExpressionStatement) GetExpressionOk() (*Expression, bool) { + if o == nil || o.Expression == nil { + return nil, false + } + return o.Expression, true +} + +// HasExpression returns a boolean if a field has been set. +func (o *ExpressionStatement) HasExpression() bool { + if o != nil && o.Expression != nil { + return true + } + + return false +} + +// SetExpression gets a reference to the given Expression and assigns it to the Expression field. +func (o *ExpressionStatement) SetExpression(v Expression) { + o.Expression = &v +} + +func (o ExpressionStatement) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Expression != nil { + toSerialize["expression"] = o.Expression + } + return json.Marshal(toSerialize) +} + +type NullableExpressionStatement struct { + value *ExpressionStatement + isSet bool +} + +func (v NullableExpressionStatement) Get() *ExpressionStatement { + return v.value +} + +func (v *NullableExpressionStatement) Set(val *ExpressionStatement) { + v.value = val + v.isSet = true +} + +func (v NullableExpressionStatement) IsSet() bool { + return v.isSet +} + +func (v *NullableExpressionStatement) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableExpressionStatement(val *ExpressionStatement) *NullableExpressionStatement { + return &NullableExpressionStatement{value: val, isSet: true} +} + +func (v NullableExpressionStatement) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableExpressionStatement) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_file.gen.go b/internal/api/model_file.gen.go new file mode 100644 index 0000000..0c02b50 --- /dev/null +++ b/internal/api/model_file.gen.go @@ -0,0 +1,261 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// File Represents a source from a single file +type File struct { + // Type of AST node + Type *string `json:"type,omitempty"` + // The name of the file. + Name *string `json:"name,omitempty"` + Package *PackageClause `json:"package,omitempty"` + // A list of package imports + Imports *[]ImportDeclaration `json:"imports,omitempty"` + // List of Flux statements + Body *[]Statement `json:"body,omitempty"` +} + +// NewFile instantiates a new File object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFile() *File { + this := File{} + return &this +} + +// NewFileWithDefaults instantiates a new File object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFileWithDefaults() *File { + this := File{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *File) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *File) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *File) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *File) SetType(v string) { + o.Type = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *File) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *File) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *File) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *File) SetName(v string) { + o.Name = &v +} + +// GetPackage returns the Package field value if set, zero value otherwise. +func (o *File) GetPackage() PackageClause { + if o == nil || o.Package == nil { + var ret PackageClause + return ret + } + return *o.Package +} + +// GetPackageOk returns a tuple with the Package field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *File) GetPackageOk() (*PackageClause, bool) { + if o == nil || o.Package == nil { + return nil, false + } + return o.Package, true +} + +// HasPackage returns a boolean if a field has been set. +func (o *File) HasPackage() bool { + if o != nil && o.Package != nil { + return true + } + + return false +} + +// SetPackage gets a reference to the given PackageClause and assigns it to the Package field. +func (o *File) SetPackage(v PackageClause) { + o.Package = &v +} + +// GetImports returns the Imports field value if set, zero value otherwise. +func (o *File) GetImports() []ImportDeclaration { + if o == nil || o.Imports == nil { + var ret []ImportDeclaration + return ret + } + return *o.Imports +} + +// GetImportsOk returns a tuple with the Imports field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *File) GetImportsOk() (*[]ImportDeclaration, bool) { + if o == nil || o.Imports == nil { + return nil, false + } + return o.Imports, true +} + +// HasImports returns a boolean if a field has been set. +func (o *File) HasImports() bool { + if o != nil && o.Imports != nil { + return true + } + + return false +} + +// SetImports gets a reference to the given []ImportDeclaration and assigns it to the Imports field. +func (o *File) SetImports(v []ImportDeclaration) { + o.Imports = &v +} + +// GetBody returns the Body field value if set, zero value otherwise. +func (o *File) GetBody() []Statement { + if o == nil || o.Body == nil { + var ret []Statement + return ret + } + return *o.Body +} + +// GetBodyOk returns a tuple with the Body field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *File) GetBodyOk() (*[]Statement, bool) { + if o == nil || o.Body == nil { + return nil, false + } + return o.Body, true +} + +// HasBody returns a boolean if a field has been set. +func (o *File) HasBody() bool { + if o != nil && o.Body != nil { + return true + } + + return false +} + +// SetBody gets a reference to the given []Statement and assigns it to the Body field. +func (o *File) SetBody(v []Statement) { + o.Body = &v +} + +func (o File) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Package != nil { + toSerialize["package"] = o.Package + } + if o.Imports != nil { + toSerialize["imports"] = o.Imports + } + if o.Body != nil { + toSerialize["body"] = o.Body + } + return json.Marshal(toSerialize) +} + +type NullableFile struct { + value *File + isSet bool +} + +func (v NullableFile) Get() *File { + return v.value +} + +func (v *NullableFile) Set(val *File) { + v.value = val + v.isSet = true +} + +func (v NullableFile) IsSet() bool { + return v.isSet +} + +func (v *NullableFile) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFile(val *File) *NullableFile { + return &NullableFile{value: val, isSet: true} +} + +func (v NullableFile) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFile) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_float_literal.gen.go b/internal/api/model_float_literal.gen.go new file mode 100644 index 0000000..8a5e719 --- /dev/null +++ b/internal/api/model_float_literal.gen.go @@ -0,0 +1,150 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// FloatLiteral Represents floating point numbers according to the double representations defined by the IEEE-754-1985 +type FloatLiteral struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Value *float32 `json:"value,omitempty"` +} + +// NewFloatLiteral instantiates a new FloatLiteral object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFloatLiteral() *FloatLiteral { + this := FloatLiteral{} + return &this +} + +// NewFloatLiteralWithDefaults instantiates a new FloatLiteral object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFloatLiteralWithDefaults() *FloatLiteral { + this := FloatLiteral{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *FloatLiteral) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FloatLiteral) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *FloatLiteral) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *FloatLiteral) SetType(v string) { + o.Type = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *FloatLiteral) GetValue() float32 { + if o == nil || o.Value == nil { + var ret float32 + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FloatLiteral) GetValueOk() (*float32, bool) { + if o == nil || o.Value == nil { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *FloatLiteral) HasValue() bool { + if o != nil && o.Value != nil { + return true + } + + return false +} + +// SetValue gets a reference to the given float32 and assigns it to the Value field. +func (o *FloatLiteral) SetValue(v float32) { + o.Value = &v +} + +func (o FloatLiteral) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + return json.Marshal(toSerialize) +} + +type NullableFloatLiteral struct { + value *FloatLiteral + isSet bool +} + +func (v NullableFloatLiteral) Get() *FloatLiteral { + return v.value +} + +func (v *NullableFloatLiteral) Set(val *FloatLiteral) { + v.value = val + v.isSet = true +} + +func (v NullableFloatLiteral) IsSet() bool { + return v.isSet +} + +func (v *NullableFloatLiteral) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloatLiteral(val *FloatLiteral) *NullableFloatLiteral { + return &NullableFloatLiteral{value: val, isSet: true} +} + +func (v NullableFloatLiteral) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloatLiteral) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_function_expression.gen.go b/internal/api/model_function_expression.gen.go new file mode 100644 index 0000000..f7d5312 --- /dev/null +++ b/internal/api/model_function_expression.gen.go @@ -0,0 +1,187 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// FunctionExpression Function expression +type FunctionExpression struct { + // Type of AST node + Type *string `json:"type,omitempty"` + // Function parameters + Params *[]Property `json:"params,omitempty"` + Body *Node `json:"body,omitempty"` +} + +// NewFunctionExpression instantiates a new FunctionExpression object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFunctionExpression() *FunctionExpression { + this := FunctionExpression{} + return &this +} + +// NewFunctionExpressionWithDefaults instantiates a new FunctionExpression object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFunctionExpressionWithDefaults() *FunctionExpression { + this := FunctionExpression{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *FunctionExpression) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunctionExpression) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *FunctionExpression) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *FunctionExpression) SetType(v string) { + o.Type = &v +} + +// GetParams returns the Params field value if set, zero value otherwise. +func (o *FunctionExpression) GetParams() []Property { + if o == nil || o.Params == nil { + var ret []Property + return ret + } + return *o.Params +} + +// GetParamsOk returns a tuple with the Params field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunctionExpression) GetParamsOk() (*[]Property, bool) { + if o == nil || o.Params == nil { + return nil, false + } + return o.Params, true +} + +// HasParams returns a boolean if a field has been set. +func (o *FunctionExpression) HasParams() bool { + if o != nil && o.Params != nil { + return true + } + + return false +} + +// SetParams gets a reference to the given []Property and assigns it to the Params field. +func (o *FunctionExpression) SetParams(v []Property) { + o.Params = &v +} + +// GetBody returns the Body field value if set, zero value otherwise. +func (o *FunctionExpression) GetBody() Node { + if o == nil || o.Body == nil { + var ret Node + return ret + } + return *o.Body +} + +// GetBodyOk returns a tuple with the Body field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FunctionExpression) GetBodyOk() (*Node, bool) { + if o == nil || o.Body == nil { + return nil, false + } + return o.Body, true +} + +// HasBody returns a boolean if a field has been set. +func (o *FunctionExpression) HasBody() bool { + if o != nil && o.Body != nil { + return true + } + + return false +} + +// SetBody gets a reference to the given Node and assigns it to the Body field. +func (o *FunctionExpression) SetBody(v Node) { + o.Body = &v +} + +func (o FunctionExpression) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Params != nil { + toSerialize["params"] = o.Params + } + if o.Body != nil { + toSerialize["body"] = o.Body + } + return json.Marshal(toSerialize) +} + +type NullableFunctionExpression struct { + value *FunctionExpression + isSet bool +} + +func (v NullableFunctionExpression) Get() *FunctionExpression { + return v.value +} + +func (v *NullableFunctionExpression) Set(val *FunctionExpression) { + v.value = val + v.isSet = true +} + +func (v NullableFunctionExpression) IsSet() bool { + return v.isSet +} + +func (v *NullableFunctionExpression) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFunctionExpression(val *FunctionExpression) *NullableFunctionExpression { + return &NullableFunctionExpression{value: val, isSet: true} +} + +func (v NullableFunctionExpression) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFunctionExpression) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_identifier.gen.go b/internal/api/model_identifier.gen.go new file mode 100644 index 0000000..8179f2a --- /dev/null +++ b/internal/api/model_identifier.gen.go @@ -0,0 +1,150 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// Identifier A valid Flux identifier +type Identifier struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` +} + +// NewIdentifier instantiates a new Identifier object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewIdentifier() *Identifier { + this := Identifier{} + return &this +} + +// NewIdentifierWithDefaults instantiates a new Identifier object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewIdentifierWithDefaults() *Identifier { + this := Identifier{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Identifier) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Identifier) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *Identifier) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *Identifier) SetType(v string) { + o.Type = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Identifier) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Identifier) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Identifier) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Identifier) SetName(v string) { + o.Name = &v +} + +func (o Identifier) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + return json.Marshal(toSerialize) +} + +type NullableIdentifier struct { + value *Identifier + isSet bool +} + +func (v NullableIdentifier) Get() *Identifier { + return v.value +} + +func (v *NullableIdentifier) Set(val *Identifier) { + v.value = val + v.isSet = true +} + +func (v NullableIdentifier) IsSet() bool { + return v.isSet +} + +func (v *NullableIdentifier) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIdentifier(val *Identifier) *NullableIdentifier { + return &NullableIdentifier{value: val, isSet: true} +} + +func (v NullableIdentifier) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIdentifier) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_import_declaration.gen.go b/internal/api/model_import_declaration.gen.go new file mode 100644 index 0000000..ecae7de --- /dev/null +++ b/internal/api/model_import_declaration.gen.go @@ -0,0 +1,186 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// ImportDeclaration Declares a package import +type ImportDeclaration struct { + // Type of AST node + Type *string `json:"type,omitempty"` + As *Identifier `json:"as,omitempty"` + Path *StringLiteral `json:"path,omitempty"` +} + +// NewImportDeclaration instantiates a new ImportDeclaration object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewImportDeclaration() *ImportDeclaration { + this := ImportDeclaration{} + return &this +} + +// NewImportDeclarationWithDefaults instantiates a new ImportDeclaration object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewImportDeclarationWithDefaults() *ImportDeclaration { + this := ImportDeclaration{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *ImportDeclaration) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImportDeclaration) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *ImportDeclaration) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *ImportDeclaration) SetType(v string) { + o.Type = &v +} + +// GetAs returns the As field value if set, zero value otherwise. +func (o *ImportDeclaration) GetAs() Identifier { + if o == nil || o.As == nil { + var ret Identifier + return ret + } + return *o.As +} + +// GetAsOk returns a tuple with the As field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImportDeclaration) GetAsOk() (*Identifier, bool) { + if o == nil || o.As == nil { + return nil, false + } + return o.As, true +} + +// HasAs returns a boolean if a field has been set. +func (o *ImportDeclaration) HasAs() bool { + if o != nil && o.As != nil { + return true + } + + return false +} + +// SetAs gets a reference to the given Identifier and assigns it to the As field. +func (o *ImportDeclaration) SetAs(v Identifier) { + o.As = &v +} + +// GetPath returns the Path field value if set, zero value otherwise. +func (o *ImportDeclaration) GetPath() StringLiteral { + if o == nil || o.Path == nil { + var ret StringLiteral + return ret + } + return *o.Path +} + +// GetPathOk returns a tuple with the Path field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImportDeclaration) GetPathOk() (*StringLiteral, bool) { + if o == nil || o.Path == nil { + return nil, false + } + return o.Path, true +} + +// HasPath returns a boolean if a field has been set. +func (o *ImportDeclaration) HasPath() bool { + if o != nil && o.Path != nil { + return true + } + + return false +} + +// SetPath gets a reference to the given StringLiteral and assigns it to the Path field. +func (o *ImportDeclaration) SetPath(v StringLiteral) { + o.Path = &v +} + +func (o ImportDeclaration) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.As != nil { + toSerialize["as"] = o.As + } + if o.Path != nil { + toSerialize["path"] = o.Path + } + return json.Marshal(toSerialize) +} + +type NullableImportDeclaration struct { + value *ImportDeclaration + isSet bool +} + +func (v NullableImportDeclaration) Get() *ImportDeclaration { + return v.value +} + +func (v *NullableImportDeclaration) Set(val *ImportDeclaration) { + v.value = val + v.isSet = true +} + +func (v NullableImportDeclaration) IsSet() bool { + return v.isSet +} + +func (v *NullableImportDeclaration) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImportDeclaration(val *ImportDeclaration) *NullableImportDeclaration { + return &NullableImportDeclaration{value: val, isSet: true} +} + +func (v NullableImportDeclaration) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImportDeclaration) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_index_expression.gen.go b/internal/api/model_index_expression.gen.go new file mode 100644 index 0000000..74b9d02 --- /dev/null +++ b/internal/api/model_index_expression.gen.go @@ -0,0 +1,186 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// IndexExpression Represents indexing into an array +type IndexExpression struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Array *Expression `json:"array,omitempty"` + Index *Expression `json:"index,omitempty"` +} + +// NewIndexExpression instantiates a new IndexExpression object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewIndexExpression() *IndexExpression { + this := IndexExpression{} + return &this +} + +// NewIndexExpressionWithDefaults instantiates a new IndexExpression object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewIndexExpressionWithDefaults() *IndexExpression { + this := IndexExpression{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *IndexExpression) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IndexExpression) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *IndexExpression) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *IndexExpression) SetType(v string) { + o.Type = &v +} + +// GetArray returns the Array field value if set, zero value otherwise. +func (o *IndexExpression) GetArray() Expression { + if o == nil || o.Array == nil { + var ret Expression + return ret + } + return *o.Array +} + +// GetArrayOk returns a tuple with the Array field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IndexExpression) GetArrayOk() (*Expression, bool) { + if o == nil || o.Array == nil { + return nil, false + } + return o.Array, true +} + +// HasArray returns a boolean if a field has been set. +func (o *IndexExpression) HasArray() bool { + if o != nil && o.Array != nil { + return true + } + + return false +} + +// SetArray gets a reference to the given Expression and assigns it to the Array field. +func (o *IndexExpression) SetArray(v Expression) { + o.Array = &v +} + +// GetIndex returns the Index field value if set, zero value otherwise. +func (o *IndexExpression) GetIndex() Expression { + if o == nil || o.Index == nil { + var ret Expression + return ret + } + return *o.Index +} + +// GetIndexOk returns a tuple with the Index field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IndexExpression) GetIndexOk() (*Expression, bool) { + if o == nil || o.Index == nil { + return nil, false + } + return o.Index, true +} + +// HasIndex returns a boolean if a field has been set. +func (o *IndexExpression) HasIndex() bool { + if o != nil && o.Index != nil { + return true + } + + return false +} + +// SetIndex gets a reference to the given Expression and assigns it to the Index field. +func (o *IndexExpression) SetIndex(v Expression) { + o.Index = &v +} + +func (o IndexExpression) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Array != nil { + toSerialize["array"] = o.Array + } + if o.Index != nil { + toSerialize["index"] = o.Index + } + return json.Marshal(toSerialize) +} + +type NullableIndexExpression struct { + value *IndexExpression + isSet bool +} + +func (v NullableIndexExpression) Get() *IndexExpression { + return v.value +} + +func (v *NullableIndexExpression) Set(val *IndexExpression) { + v.value = val + v.isSet = true +} + +func (v NullableIndexExpression) IsSet() bool { + return v.isSet +} + +func (v *NullableIndexExpression) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIndexExpression(val *IndexExpression) *NullableIndexExpression { + return &NullableIndexExpression{value: val, isSet: true} +} + +func (v NullableIndexExpression) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIndexExpression) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_integer_literal.gen.go b/internal/api/model_integer_literal.gen.go new file mode 100644 index 0000000..ffdb307 --- /dev/null +++ b/internal/api/model_integer_literal.gen.go @@ -0,0 +1,150 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// IntegerLiteral Represents integer numbers +type IntegerLiteral struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Value *string `json:"value,omitempty"` +} + +// NewIntegerLiteral instantiates a new IntegerLiteral object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewIntegerLiteral() *IntegerLiteral { + this := IntegerLiteral{} + return &this +} + +// NewIntegerLiteralWithDefaults instantiates a new IntegerLiteral object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewIntegerLiteralWithDefaults() *IntegerLiteral { + this := IntegerLiteral{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *IntegerLiteral) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegerLiteral) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *IntegerLiteral) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *IntegerLiteral) SetType(v string) { + o.Type = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *IntegerLiteral) GetValue() string { + if o == nil || o.Value == nil { + var ret string + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntegerLiteral) GetValueOk() (*string, bool) { + if o == nil || o.Value == nil { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *IntegerLiteral) HasValue() bool { + if o != nil && o.Value != nil { + return true + } + + return false +} + +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *IntegerLiteral) SetValue(v string) { + o.Value = &v +} + +func (o IntegerLiteral) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + return json.Marshal(toSerialize) +} + +type NullableIntegerLiteral struct { + value *IntegerLiteral + isSet bool +} + +func (v NullableIntegerLiteral) Get() *IntegerLiteral { + return v.value +} + +func (v *NullableIntegerLiteral) Set(val *IntegerLiteral) { + v.value = val + v.isSet = true +} + +func (v NullableIntegerLiteral) IsSet() bool { + return v.isSet +} + +func (v *NullableIntegerLiteral) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIntegerLiteral(val *IntegerLiteral) *NullableIntegerLiteral { + return &NullableIntegerLiteral{value: val, isSet: true} +} + +func (v NullableIntegerLiteral) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIntegerLiteral) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_logical_expression.gen.go b/internal/api/model_logical_expression.gen.go new file mode 100644 index 0000000..741df2d --- /dev/null +++ b/internal/api/model_logical_expression.gen.go @@ -0,0 +1,222 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// LogicalExpression Represents the rule conditions that collectively evaluate to either true or false +type LogicalExpression struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Operator *string `json:"operator,omitempty"` + Left *Expression `json:"left,omitempty"` + Right *Expression `json:"right,omitempty"` +} + +// NewLogicalExpression instantiates a new LogicalExpression object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewLogicalExpression() *LogicalExpression { + this := LogicalExpression{} + return &this +} + +// NewLogicalExpressionWithDefaults instantiates a new LogicalExpression object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewLogicalExpressionWithDefaults() *LogicalExpression { + this := LogicalExpression{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *LogicalExpression) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogicalExpression) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *LogicalExpression) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *LogicalExpression) SetType(v string) { + o.Type = &v +} + +// GetOperator returns the Operator field value if set, zero value otherwise. +func (o *LogicalExpression) GetOperator() string { + if o == nil || o.Operator == nil { + var ret string + return ret + } + return *o.Operator +} + +// GetOperatorOk returns a tuple with the Operator field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogicalExpression) GetOperatorOk() (*string, bool) { + if o == nil || o.Operator == nil { + return nil, false + } + return o.Operator, true +} + +// HasOperator returns a boolean if a field has been set. +func (o *LogicalExpression) HasOperator() bool { + if o != nil && o.Operator != nil { + return true + } + + return false +} + +// SetOperator gets a reference to the given string and assigns it to the Operator field. +func (o *LogicalExpression) SetOperator(v string) { + o.Operator = &v +} + +// GetLeft returns the Left field value if set, zero value otherwise. +func (o *LogicalExpression) GetLeft() Expression { + if o == nil || o.Left == nil { + var ret Expression + return ret + } + return *o.Left +} + +// GetLeftOk returns a tuple with the Left field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogicalExpression) GetLeftOk() (*Expression, bool) { + if o == nil || o.Left == nil { + return nil, false + } + return o.Left, true +} + +// HasLeft returns a boolean if a field has been set. +func (o *LogicalExpression) HasLeft() bool { + if o != nil && o.Left != nil { + return true + } + + return false +} + +// SetLeft gets a reference to the given Expression and assigns it to the Left field. +func (o *LogicalExpression) SetLeft(v Expression) { + o.Left = &v +} + +// GetRight returns the Right field value if set, zero value otherwise. +func (o *LogicalExpression) GetRight() Expression { + if o == nil || o.Right == nil { + var ret Expression + return ret + } + return *o.Right +} + +// GetRightOk returns a tuple with the Right field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogicalExpression) GetRightOk() (*Expression, bool) { + if o == nil || o.Right == nil { + return nil, false + } + return o.Right, true +} + +// HasRight returns a boolean if a field has been set. +func (o *LogicalExpression) HasRight() bool { + if o != nil && o.Right != nil { + return true + } + + return false +} + +// SetRight gets a reference to the given Expression and assigns it to the Right field. +func (o *LogicalExpression) SetRight(v Expression) { + o.Right = &v +} + +func (o LogicalExpression) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Operator != nil { + toSerialize["operator"] = o.Operator + } + if o.Left != nil { + toSerialize["left"] = o.Left + } + if o.Right != nil { + toSerialize["right"] = o.Right + } + return json.Marshal(toSerialize) +} + +type NullableLogicalExpression struct { + value *LogicalExpression + isSet bool +} + +func (v NullableLogicalExpression) Get() *LogicalExpression { + return v.value +} + +func (v *NullableLogicalExpression) Set(val *LogicalExpression) { + v.value = val + v.isSet = true +} + +func (v NullableLogicalExpression) IsSet() bool { + return v.isSet +} + +func (v *NullableLogicalExpression) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLogicalExpression(val *LogicalExpression) *NullableLogicalExpression { + return &NullableLogicalExpression{value: val, isSet: true} +} + +func (v NullableLogicalExpression) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLogicalExpression) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_member_assignment.gen.go b/internal/api/model_member_assignment.gen.go new file mode 100644 index 0000000..dff87b5 --- /dev/null +++ b/internal/api/model_member_assignment.gen.go @@ -0,0 +1,186 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// MemberAssignment Object property assignment +type MemberAssignment struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Member *MemberExpression `json:"member,omitempty"` + Init *Expression `json:"init,omitempty"` +} + +// NewMemberAssignment instantiates a new MemberAssignment object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMemberAssignment() *MemberAssignment { + this := MemberAssignment{} + return &this +} + +// NewMemberAssignmentWithDefaults instantiates a new MemberAssignment object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMemberAssignmentWithDefaults() *MemberAssignment { + this := MemberAssignment{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *MemberAssignment) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MemberAssignment) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *MemberAssignment) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *MemberAssignment) SetType(v string) { + o.Type = &v +} + +// GetMember returns the Member field value if set, zero value otherwise. +func (o *MemberAssignment) GetMember() MemberExpression { + if o == nil || o.Member == nil { + var ret MemberExpression + return ret + } + return *o.Member +} + +// GetMemberOk returns a tuple with the Member field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MemberAssignment) GetMemberOk() (*MemberExpression, bool) { + if o == nil || o.Member == nil { + return nil, false + } + return o.Member, true +} + +// HasMember returns a boolean if a field has been set. +func (o *MemberAssignment) HasMember() bool { + if o != nil && o.Member != nil { + return true + } + + return false +} + +// SetMember gets a reference to the given MemberExpression and assigns it to the Member field. +func (o *MemberAssignment) SetMember(v MemberExpression) { + o.Member = &v +} + +// GetInit returns the Init field value if set, zero value otherwise. +func (o *MemberAssignment) GetInit() Expression { + if o == nil || o.Init == nil { + var ret Expression + return ret + } + return *o.Init +} + +// GetInitOk returns a tuple with the Init field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MemberAssignment) GetInitOk() (*Expression, bool) { + if o == nil || o.Init == nil { + return nil, false + } + return o.Init, true +} + +// HasInit returns a boolean if a field has been set. +func (o *MemberAssignment) HasInit() bool { + if o != nil && o.Init != nil { + return true + } + + return false +} + +// SetInit gets a reference to the given Expression and assigns it to the Init field. +func (o *MemberAssignment) SetInit(v Expression) { + o.Init = &v +} + +func (o MemberAssignment) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Member != nil { + toSerialize["member"] = o.Member + } + if o.Init != nil { + toSerialize["init"] = o.Init + } + return json.Marshal(toSerialize) +} + +type NullableMemberAssignment struct { + value *MemberAssignment + isSet bool +} + +func (v NullableMemberAssignment) Get() *MemberAssignment { + return v.value +} + +func (v *NullableMemberAssignment) Set(val *MemberAssignment) { + v.value = val + v.isSet = true +} + +func (v NullableMemberAssignment) IsSet() bool { + return v.isSet +} + +func (v *NullableMemberAssignment) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMemberAssignment(val *MemberAssignment) *NullableMemberAssignment { + return &NullableMemberAssignment{value: val, isSet: true} +} + +func (v NullableMemberAssignment) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMemberAssignment) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_member_expression.gen.go b/internal/api/model_member_expression.gen.go new file mode 100644 index 0000000..4f573c9 --- /dev/null +++ b/internal/api/model_member_expression.gen.go @@ -0,0 +1,186 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// MemberExpression Represents accessing a property of an object +type MemberExpression struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Object *Expression `json:"object,omitempty"` + Property *PropertyKey `json:"property,omitempty"` +} + +// NewMemberExpression instantiates a new MemberExpression object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMemberExpression() *MemberExpression { + this := MemberExpression{} + return &this +} + +// NewMemberExpressionWithDefaults instantiates a new MemberExpression object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMemberExpressionWithDefaults() *MemberExpression { + this := MemberExpression{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *MemberExpression) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MemberExpression) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *MemberExpression) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *MemberExpression) SetType(v string) { + o.Type = &v +} + +// GetObject returns the Object field value if set, zero value otherwise. +func (o *MemberExpression) GetObject() Expression { + if o == nil || o.Object == nil { + var ret Expression + return ret + } + return *o.Object +} + +// GetObjectOk returns a tuple with the Object field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MemberExpression) GetObjectOk() (*Expression, bool) { + if o == nil || o.Object == nil { + return nil, false + } + return o.Object, true +} + +// HasObject returns a boolean if a field has been set. +func (o *MemberExpression) HasObject() bool { + if o != nil && o.Object != nil { + return true + } + + return false +} + +// SetObject gets a reference to the given Expression and assigns it to the Object field. +func (o *MemberExpression) SetObject(v Expression) { + o.Object = &v +} + +// GetProperty returns the Property field value if set, zero value otherwise. +func (o *MemberExpression) GetProperty() PropertyKey { + if o == nil || o.Property == nil { + var ret PropertyKey + return ret + } + return *o.Property +} + +// GetPropertyOk returns a tuple with the Property field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MemberExpression) GetPropertyOk() (*PropertyKey, bool) { + if o == nil || o.Property == nil { + return nil, false + } + return o.Property, true +} + +// HasProperty returns a boolean if a field has been set. +func (o *MemberExpression) HasProperty() bool { + if o != nil && o.Property != nil { + return true + } + + return false +} + +// SetProperty gets a reference to the given PropertyKey and assigns it to the Property field. +func (o *MemberExpression) SetProperty(v PropertyKey) { + o.Property = &v +} + +func (o MemberExpression) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Object != nil { + toSerialize["object"] = o.Object + } + if o.Property != nil { + toSerialize["property"] = o.Property + } + return json.Marshal(toSerialize) +} + +type NullableMemberExpression struct { + value *MemberExpression + isSet bool +} + +func (v NullableMemberExpression) Get() *MemberExpression { + return v.value +} + +func (v *NullableMemberExpression) Set(val *MemberExpression) { + v.value = val + v.isSet = true +} + +func (v NullableMemberExpression) IsSet() bool { + return v.isSet +} + +func (v *NullableMemberExpression) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMemberExpression(val *MemberExpression) *NullableMemberExpression { + return &NullableMemberExpression{value: val, isSet: true} +} + +func (v NullableMemberExpression) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMemberExpression) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_node.gen.go b/internal/api/model_node.gen.go new file mode 100644 index 0000000..cfd8254 --- /dev/null +++ b/internal/api/model_node.gen.go @@ -0,0 +1,138 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" + "errors" +) + +// Node - struct for Node +type Node struct { + Block *Block + Expression *Expression +} + +// BlockAsNode is a convenience function that returns Block wrapped in Node +func BlockAsNode(v *Block) Node { + return Node{Block: v} +} + +// ExpressionAsNode is a convenience function that returns Expression wrapped in Node +func ExpressionAsNode(v *Expression) Node { + return Node{Expression: v} +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *Node) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into Block + err = json.Unmarshal(data, &dst.Block) + if err == nil { + jsonBlock, _ := json.Marshal(dst.Block) + if string(jsonBlock) == "{}" { // empty struct + dst.Block = nil + } else { + match++ + } + } else { + dst.Block = nil + } + + // try to unmarshal data into Expression + err = json.Unmarshal(data, &dst.Expression) + if err == nil { + jsonExpression, _ := json.Marshal(dst.Expression) + if string(jsonExpression) == "{}" { // empty struct + dst.Expression = nil + } else { + match++ + } + } else { + dst.Expression = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.Block = nil + dst.Expression = nil + + return errors.New("data matches more than one schema in oneOf(Node)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return errors.New("data failed to match schemas in oneOf(Node)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src Node) MarshalJSON() ([]byte, error) { + if src.Block != nil { + return json.Marshal(&src.Block) + } + + if src.Expression != nil { + return json.Marshal(&src.Expression) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *Node) GetActualInstance() interface{} { + if obj.Block != nil { + return obj.Block + } + + if obj.Expression != nil { + return obj.Expression + } + + // all schemas are nil + return nil +} + +type NullableNode struct { + value *Node + isSet bool +} + +func (v NullableNode) Get() *Node { + return v.value +} + +func (v *NullableNode) Set(val *Node) { + v.value = val + v.isSet = true +} + +func (v NullableNode) IsSet() bool { + return v.isSet +} + +func (v *NullableNode) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNode(val *Node) *NullableNode { + return &NullableNode{value: val, isSet: true} +} + +func (v NullableNode) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNode) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_object_expression.gen.go b/internal/api/model_object_expression.gen.go new file mode 100644 index 0000000..4f7299c --- /dev/null +++ b/internal/api/model_object_expression.gen.go @@ -0,0 +1,151 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// ObjectExpression Allows the declaration of an anonymous object within a declaration +type ObjectExpression struct { + // Type of AST node + Type *string `json:"type,omitempty"` + // Object properties + Properties *[]Property `json:"properties,omitempty"` +} + +// NewObjectExpression instantiates a new ObjectExpression object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewObjectExpression() *ObjectExpression { + this := ObjectExpression{} + return &this +} + +// NewObjectExpressionWithDefaults instantiates a new ObjectExpression object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewObjectExpressionWithDefaults() *ObjectExpression { + this := ObjectExpression{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *ObjectExpression) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ObjectExpression) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *ObjectExpression) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *ObjectExpression) SetType(v string) { + o.Type = &v +} + +// GetProperties returns the Properties field value if set, zero value otherwise. +func (o *ObjectExpression) GetProperties() []Property { + if o == nil || o.Properties == nil { + var ret []Property + return ret + } + return *o.Properties +} + +// GetPropertiesOk returns a tuple with the Properties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ObjectExpression) GetPropertiesOk() (*[]Property, bool) { + if o == nil || o.Properties == nil { + return nil, false + } + return o.Properties, true +} + +// HasProperties returns a boolean if a field has been set. +func (o *ObjectExpression) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + +// SetProperties gets a reference to the given []Property and assigns it to the Properties field. +func (o *ObjectExpression) SetProperties(v []Property) { + o.Properties = &v +} + +func (o ObjectExpression) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + return json.Marshal(toSerialize) +} + +type NullableObjectExpression struct { + value *ObjectExpression + isSet bool +} + +func (v NullableObjectExpression) Get() *ObjectExpression { + return v.value +} + +func (v *NullableObjectExpression) Set(val *ObjectExpression) { + v.value = val + v.isSet = true +} + +func (v NullableObjectExpression) IsSet() bool { + return v.isSet +} + +func (v *NullableObjectExpression) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableObjectExpression(val *ObjectExpression) *NullableObjectExpression { + return &NullableObjectExpression{value: val, isSet: true} +} + +func (v NullableObjectExpression) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableObjectExpression) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_option_statement.gen.go b/internal/api/model_option_statement.gen.go new file mode 100644 index 0000000..1df18bd --- /dev/null +++ b/internal/api/model_option_statement.gen.go @@ -0,0 +1,150 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// OptionStatement A single variable declaration +type OptionStatement struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Assignment *VariableOrMemberAssignment `json:"assignment,omitempty"` +} + +// NewOptionStatement instantiates a new OptionStatement object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewOptionStatement() *OptionStatement { + this := OptionStatement{} + return &this +} + +// NewOptionStatementWithDefaults instantiates a new OptionStatement object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewOptionStatementWithDefaults() *OptionStatement { + this := OptionStatement{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *OptionStatement) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OptionStatement) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *OptionStatement) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *OptionStatement) SetType(v string) { + o.Type = &v +} + +// GetAssignment returns the Assignment field value if set, zero value otherwise. +func (o *OptionStatement) GetAssignment() VariableOrMemberAssignment { + if o == nil || o.Assignment == nil { + var ret VariableOrMemberAssignment + return ret + } + return *o.Assignment +} + +// GetAssignmentOk returns a tuple with the Assignment field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OptionStatement) GetAssignmentOk() (*VariableOrMemberAssignment, bool) { + if o == nil || o.Assignment == nil { + return nil, false + } + return o.Assignment, true +} + +// HasAssignment returns a boolean if a field has been set. +func (o *OptionStatement) HasAssignment() bool { + if o != nil && o.Assignment != nil { + return true + } + + return false +} + +// SetAssignment gets a reference to the given VariableOrMemberAssignment and assigns it to the Assignment field. +func (o *OptionStatement) SetAssignment(v VariableOrMemberAssignment) { + o.Assignment = &v +} + +func (o OptionStatement) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Assignment != nil { + toSerialize["assignment"] = o.Assignment + } + return json.Marshal(toSerialize) +} + +type NullableOptionStatement struct { + value *OptionStatement + isSet bool +} + +func (v NullableOptionStatement) Get() *OptionStatement { + return v.value +} + +func (v *NullableOptionStatement) Set(val *OptionStatement) { + v.value = val + v.isSet = true +} + +func (v NullableOptionStatement) IsSet() bool { + return v.isSet +} + +func (v *NullableOptionStatement) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOptionStatement(val *OptionStatement) *NullableOptionStatement { + return &NullableOptionStatement{value: val, isSet: true} +} + +func (v NullableOptionStatement) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOptionStatement) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_package_clause.gen.go b/internal/api/model_package_clause.gen.go new file mode 100644 index 0000000..21f6721 --- /dev/null +++ b/internal/api/model_package_clause.gen.go @@ -0,0 +1,150 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// PackageClause Defines a package identifier +type PackageClause struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Name *Identifier `json:"name,omitempty"` +} + +// NewPackageClause instantiates a new PackageClause object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPackageClause() *PackageClause { + this := PackageClause{} + return &this +} + +// NewPackageClauseWithDefaults instantiates a new PackageClause object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPackageClauseWithDefaults() *PackageClause { + this := PackageClause{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *PackageClause) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PackageClause) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *PackageClause) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *PackageClause) SetType(v string) { + o.Type = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *PackageClause) GetName() Identifier { + if o == nil || o.Name == nil { + var ret Identifier + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PackageClause) GetNameOk() (*Identifier, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *PackageClause) HasName() bool { + if o != nil && o.Name != nil { + return true + } + + return false +} + +// SetName gets a reference to the given Identifier and assigns it to the Name field. +func (o *PackageClause) SetName(v Identifier) { + o.Name = &v +} + +func (o PackageClause) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + return json.Marshal(toSerialize) +} + +type NullablePackageClause struct { + value *PackageClause + isSet bool +} + +func (v NullablePackageClause) Get() *PackageClause { + return v.value +} + +func (v *NullablePackageClause) Set(val *PackageClause) { + v.value = val + v.isSet = true +} + +func (v NullablePackageClause) IsSet() bool { + return v.isSet +} + +func (v *NullablePackageClause) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePackageClause(val *PackageClause) *NullablePackageClause { + return &NullablePackageClause{value: val, isSet: true} +} + +func (v NullablePackageClause) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePackageClause) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_paren_expression.gen.go b/internal/api/model_paren_expression.gen.go new file mode 100644 index 0000000..93b6076 --- /dev/null +++ b/internal/api/model_paren_expression.gen.go @@ -0,0 +1,150 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// ParenExpression Represents an expression wrapped in parenthesis +type ParenExpression struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Expression *Expression `json:"expression,omitempty"` +} + +// NewParenExpression instantiates a new ParenExpression object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewParenExpression() *ParenExpression { + this := ParenExpression{} + return &this +} + +// NewParenExpressionWithDefaults instantiates a new ParenExpression object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewParenExpressionWithDefaults() *ParenExpression { + this := ParenExpression{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *ParenExpression) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ParenExpression) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *ParenExpression) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *ParenExpression) SetType(v string) { + o.Type = &v +} + +// GetExpression returns the Expression field value if set, zero value otherwise. +func (o *ParenExpression) GetExpression() Expression { + if o == nil || o.Expression == nil { + var ret Expression + return ret + } + return *o.Expression +} + +// GetExpressionOk returns a tuple with the Expression field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ParenExpression) GetExpressionOk() (*Expression, bool) { + if o == nil || o.Expression == nil { + return nil, false + } + return o.Expression, true +} + +// HasExpression returns a boolean if a field has been set. +func (o *ParenExpression) HasExpression() bool { + if o != nil && o.Expression != nil { + return true + } + + return false +} + +// SetExpression gets a reference to the given Expression and assigns it to the Expression field. +func (o *ParenExpression) SetExpression(v Expression) { + o.Expression = &v +} + +func (o ParenExpression) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Expression != nil { + toSerialize["expression"] = o.Expression + } + return json.Marshal(toSerialize) +} + +type NullableParenExpression struct { + value *ParenExpression + isSet bool +} + +func (v NullableParenExpression) Get() *ParenExpression { + return v.value +} + +func (v *NullableParenExpression) Set(val *ParenExpression) { + v.value = val + v.isSet = true +} + +func (v NullableParenExpression) IsSet() bool { + return v.isSet +} + +func (v *NullableParenExpression) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableParenExpression(val *ParenExpression) *NullableParenExpression { + return &NullableParenExpression{value: val, isSet: true} +} + +func (v NullableParenExpression) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableParenExpression) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_pipe_expression.gen.go b/internal/api/model_pipe_expression.gen.go new file mode 100644 index 0000000..8f1b577 --- /dev/null +++ b/internal/api/model_pipe_expression.gen.go @@ -0,0 +1,186 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// PipeExpression Call expression with pipe argument +type PipeExpression struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Argument *Expression `json:"argument,omitempty"` + Call *CallExpression `json:"call,omitempty"` +} + +// NewPipeExpression instantiates a new PipeExpression object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPipeExpression() *PipeExpression { + this := PipeExpression{} + return &this +} + +// NewPipeExpressionWithDefaults instantiates a new PipeExpression object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPipeExpressionWithDefaults() *PipeExpression { + this := PipeExpression{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *PipeExpression) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PipeExpression) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *PipeExpression) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *PipeExpression) SetType(v string) { + o.Type = &v +} + +// GetArgument returns the Argument field value if set, zero value otherwise. +func (o *PipeExpression) GetArgument() Expression { + if o == nil || o.Argument == nil { + var ret Expression + return ret + } + return *o.Argument +} + +// GetArgumentOk returns a tuple with the Argument field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PipeExpression) GetArgumentOk() (*Expression, bool) { + if o == nil || o.Argument == nil { + return nil, false + } + return o.Argument, true +} + +// HasArgument returns a boolean if a field has been set. +func (o *PipeExpression) HasArgument() bool { + if o != nil && o.Argument != nil { + return true + } + + return false +} + +// SetArgument gets a reference to the given Expression and assigns it to the Argument field. +func (o *PipeExpression) SetArgument(v Expression) { + o.Argument = &v +} + +// GetCall returns the Call field value if set, zero value otherwise. +func (o *PipeExpression) GetCall() CallExpression { + if o == nil || o.Call == nil { + var ret CallExpression + return ret + } + return *o.Call +} + +// GetCallOk returns a tuple with the Call field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PipeExpression) GetCallOk() (*CallExpression, bool) { + if o == nil || o.Call == nil { + return nil, false + } + return o.Call, true +} + +// HasCall returns a boolean if a field has been set. +func (o *PipeExpression) HasCall() bool { + if o != nil && o.Call != nil { + return true + } + + return false +} + +// SetCall gets a reference to the given CallExpression and assigns it to the Call field. +func (o *PipeExpression) SetCall(v CallExpression) { + o.Call = &v +} + +func (o PipeExpression) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Argument != nil { + toSerialize["argument"] = o.Argument + } + if o.Call != nil { + toSerialize["call"] = o.Call + } + return json.Marshal(toSerialize) +} + +type NullablePipeExpression struct { + value *PipeExpression + isSet bool +} + +func (v NullablePipeExpression) Get() *PipeExpression { + return v.value +} + +func (v *NullablePipeExpression) Set(val *PipeExpression) { + v.value = val + v.isSet = true +} + +func (v NullablePipeExpression) IsSet() bool { + return v.isSet +} + +func (v *NullablePipeExpression) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePipeExpression(val *PipeExpression) *NullablePipeExpression { + return &NullablePipeExpression{value: val, isSet: true} +} + +func (v NullablePipeExpression) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePipeExpression) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_pipe_literal.gen.go b/internal/api/model_pipe_literal.gen.go new file mode 100644 index 0000000..6d861ca --- /dev/null +++ b/internal/api/model_pipe_literal.gen.go @@ -0,0 +1,114 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// PipeLiteral Represents a specialized literal value, indicating the left hand value of a pipe expression +type PipeLiteral struct { + // Type of AST node + Type *string `json:"type,omitempty"` +} + +// NewPipeLiteral instantiates a new PipeLiteral object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPipeLiteral() *PipeLiteral { + this := PipeLiteral{} + return &this +} + +// NewPipeLiteralWithDefaults instantiates a new PipeLiteral object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPipeLiteralWithDefaults() *PipeLiteral { + this := PipeLiteral{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *PipeLiteral) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PipeLiteral) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *PipeLiteral) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *PipeLiteral) SetType(v string) { + o.Type = &v +} + +func (o PipeLiteral) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + return json.Marshal(toSerialize) +} + +type NullablePipeLiteral struct { + value *PipeLiteral + isSet bool +} + +func (v NullablePipeLiteral) Get() *PipeLiteral { + return v.value +} + +func (v *NullablePipeLiteral) Set(val *PipeLiteral) { + v.value = val + v.isSet = true +} + +func (v NullablePipeLiteral) IsSet() bool { + return v.isSet +} + +func (v *NullablePipeLiteral) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePipeLiteral(val *PipeLiteral) *NullablePipeLiteral { + return &NullablePipeLiteral{value: val, isSet: true} +} + +func (v NullablePipeLiteral) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePipeLiteral) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_property.gen.go b/internal/api/model_property.gen.go new file mode 100644 index 0000000..44d6ed9 --- /dev/null +++ b/internal/api/model_property.gen.go @@ -0,0 +1,186 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// Property The value associated with a key +type Property struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Key *PropertyKey `json:"key,omitempty"` + Value *Expression `json:"value,omitempty"` +} + +// NewProperty instantiates a new Property object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewProperty() *Property { + this := Property{} + return &this +} + +// NewPropertyWithDefaults instantiates a new Property object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPropertyWithDefaults() *Property { + this := Property{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Property) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Property) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *Property) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *Property) SetType(v string) { + o.Type = &v +} + +// GetKey returns the Key field value if set, zero value otherwise. +func (o *Property) GetKey() PropertyKey { + if o == nil || o.Key == nil { + var ret PropertyKey + return ret + } + return *o.Key +} + +// GetKeyOk returns a tuple with the Key field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Property) GetKeyOk() (*PropertyKey, bool) { + if o == nil || o.Key == nil { + return nil, false + } + return o.Key, true +} + +// HasKey returns a boolean if a field has been set. +func (o *Property) HasKey() bool { + if o != nil && o.Key != nil { + return true + } + + return false +} + +// SetKey gets a reference to the given PropertyKey and assigns it to the Key field. +func (o *Property) SetKey(v PropertyKey) { + o.Key = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *Property) GetValue() Expression { + if o == nil || o.Value == nil { + var ret Expression + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Property) GetValueOk() (*Expression, bool) { + if o == nil || o.Value == nil { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *Property) HasValue() bool { + if o != nil && o.Value != nil { + return true + } + + return false +} + +// SetValue gets a reference to the given Expression and assigns it to the Value field. +func (o *Property) SetValue(v Expression) { + o.Value = &v +} + +func (o Property) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Key != nil { + toSerialize["key"] = o.Key + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + return json.Marshal(toSerialize) +} + +type NullableProperty struct { + value *Property + isSet bool +} + +func (v NullableProperty) Get() *Property { + return v.value +} + +func (v *NullableProperty) Set(val *Property) { + v.value = val + v.isSet = true +} + +func (v NullableProperty) IsSet() bool { + return v.isSet +} + +func (v *NullableProperty) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProperty(val *Property) *NullableProperty { + return &NullableProperty{value: val, isSet: true} +} + +func (v NullableProperty) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProperty) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_property_key.gen.go b/internal/api/model_property_key.gen.go new file mode 100644 index 0000000..34ca715 --- /dev/null +++ b/internal/api/model_property_key.gen.go @@ -0,0 +1,138 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" + "errors" +) + +// PropertyKey - struct for PropertyKey +type PropertyKey struct { + Identifier *Identifier + StringLiteral *StringLiteral +} + +// IdentifierAsPropertyKey is a convenience function that returns Identifier wrapped in PropertyKey +func IdentifierAsPropertyKey(v *Identifier) PropertyKey { + return PropertyKey{Identifier: v} +} + +// StringLiteralAsPropertyKey is a convenience function that returns StringLiteral wrapped in PropertyKey +func StringLiteralAsPropertyKey(v *StringLiteral) PropertyKey { + return PropertyKey{StringLiteral: v} +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *PropertyKey) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into Identifier + err = json.Unmarshal(data, &dst.Identifier) + if err == nil { + jsonIdentifier, _ := json.Marshal(dst.Identifier) + if string(jsonIdentifier) == "{}" { // empty struct + dst.Identifier = nil + } else { + match++ + } + } else { + dst.Identifier = nil + } + + // try to unmarshal data into StringLiteral + err = json.Unmarshal(data, &dst.StringLiteral) + if err == nil { + jsonStringLiteral, _ := json.Marshal(dst.StringLiteral) + if string(jsonStringLiteral) == "{}" { // empty struct + dst.StringLiteral = nil + } else { + match++ + } + } else { + dst.StringLiteral = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.Identifier = nil + dst.StringLiteral = nil + + return errors.New("data matches more than one schema in oneOf(PropertyKey)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return errors.New("data failed to match schemas in oneOf(PropertyKey)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src PropertyKey) MarshalJSON() ([]byte, error) { + if src.Identifier != nil { + return json.Marshal(&src.Identifier) + } + + if src.StringLiteral != nil { + return json.Marshal(&src.StringLiteral) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *PropertyKey) GetActualInstance() interface{} { + if obj.Identifier != nil { + return obj.Identifier + } + + if obj.StringLiteral != nil { + return obj.StringLiteral + } + + // all schemas are nil + return nil +} + +type NullablePropertyKey struct { + value *PropertyKey + isSet bool +} + +func (v NullablePropertyKey) Get() *PropertyKey { + return v.value +} + +func (v *NullablePropertyKey) Set(val *PropertyKey) { + v.value = val + v.isSet = true +} + +func (v NullablePropertyKey) IsSet() bool { + return v.isSet +} + +func (v *NullablePropertyKey) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePropertyKey(val *PropertyKey) *NullablePropertyKey { + return &NullablePropertyKey{value: val, isSet: true} +} + +func (v NullablePropertyKey) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePropertyKey) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_query.gen.go b/internal/api/model_query.gen.go new file mode 100644 index 0000000..119ab67 --- /dev/null +++ b/internal/api/model_query.gen.go @@ -0,0 +1,254 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" + "time" +) + +// Query Query influx using the Flux language +type Query struct { + Extern *File `json:"extern,omitempty"` + // Query script to execute. + Query string `json:"query"` + // The type of query. Must be \"flux\". + Type *string `json:"type,omitempty"` + Dialect *Dialect `json:"dialect,omitempty"` + // Specifies the time that should be reported as \"now\" in the query. Default is the server's now time. + Now *time.Time `json:"now,omitempty"` +} + +// NewQuery instantiates a new Query object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewQuery(query string) *Query { + this := Query{} + this.Query = query + return &this +} + +// NewQueryWithDefaults instantiates a new Query object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewQueryWithDefaults() *Query { + this := Query{} + return &this +} + +// GetExtern returns the Extern field value if set, zero value otherwise. +func (o *Query) GetExtern() File { + if o == nil || o.Extern == nil { + var ret File + return ret + } + return *o.Extern +} + +// GetExternOk returns a tuple with the Extern field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Query) GetExternOk() (*File, bool) { + if o == nil || o.Extern == nil { + return nil, false + } + return o.Extern, true +} + +// HasExtern returns a boolean if a field has been set. +func (o *Query) HasExtern() bool { + if o != nil && o.Extern != nil { + return true + } + + return false +} + +// SetExtern gets a reference to the given File and assigns it to the Extern field. +func (o *Query) SetExtern(v File) { + o.Extern = &v +} + +// GetQuery returns the Query field value +func (o *Query) GetQuery() string { + if o == nil { + var ret string + return ret + } + + return o.Query +} + +// GetQueryOk returns a tuple with the Query field value +// and a boolean to check if the value has been set. +func (o *Query) GetQueryOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Query, true +} + +// SetQuery sets field value +func (o *Query) SetQuery(v string) { + o.Query = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Query) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Query) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *Query) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *Query) SetType(v string) { + o.Type = &v +} + +// GetDialect returns the Dialect field value if set, zero value otherwise. +func (o *Query) GetDialect() Dialect { + if o == nil || o.Dialect == nil { + var ret Dialect + return ret + } + return *o.Dialect +} + +// GetDialectOk returns a tuple with the Dialect field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Query) GetDialectOk() (*Dialect, bool) { + if o == nil || o.Dialect == nil { + return nil, false + } + return o.Dialect, true +} + +// HasDialect returns a boolean if a field has been set. +func (o *Query) HasDialect() bool { + if o != nil && o.Dialect != nil { + return true + } + + return false +} + +// SetDialect gets a reference to the given Dialect and assigns it to the Dialect field. +func (o *Query) SetDialect(v Dialect) { + o.Dialect = &v +} + +// GetNow returns the Now field value if set, zero value otherwise. +func (o *Query) GetNow() time.Time { + if o == nil || o.Now == nil { + var ret time.Time + return ret + } + return *o.Now +} + +// GetNowOk returns a tuple with the Now field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Query) GetNowOk() (*time.Time, bool) { + if o == nil || o.Now == nil { + return nil, false + } + return o.Now, true +} + +// HasNow returns a boolean if a field has been set. +func (o *Query) HasNow() bool { + if o != nil && o.Now != nil { + return true + } + + return false +} + +// SetNow gets a reference to the given time.Time and assigns it to the Now field. +func (o *Query) SetNow(v time.Time) { + o.Now = &v +} + +func (o Query) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Extern != nil { + toSerialize["extern"] = o.Extern + } + if true { + toSerialize["query"] = o.Query + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Dialect != nil { + toSerialize["dialect"] = o.Dialect + } + if o.Now != nil { + toSerialize["now"] = o.Now + } + return json.Marshal(toSerialize) +} + +type NullableQuery struct { + value *Query + isSet bool +} + +func (v NullableQuery) Get() *Query { + return v.value +} + +func (v *NullableQuery) Set(val *Query) { + v.value = val + v.isSet = true +} + +func (v NullableQuery) IsSet() bool { + return v.isSet +} + +func (v *NullableQuery) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuery(val *Query) *NullableQuery { + return &NullableQuery{value: val, isSet: true} +} + +func (v NullableQuery) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuery) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_regexp_literal.gen.go b/internal/api/model_regexp_literal.gen.go new file mode 100644 index 0000000..7849c5e --- /dev/null +++ b/internal/api/model_regexp_literal.gen.go @@ -0,0 +1,150 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// RegexpLiteral Expressions begin and end with `/` and are regular expressions with syntax accepted by RE2 +type RegexpLiteral struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Value *string `json:"value,omitempty"` +} + +// NewRegexpLiteral instantiates a new RegexpLiteral object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRegexpLiteral() *RegexpLiteral { + this := RegexpLiteral{} + return &this +} + +// NewRegexpLiteralWithDefaults instantiates a new RegexpLiteral object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRegexpLiteralWithDefaults() *RegexpLiteral { + this := RegexpLiteral{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *RegexpLiteral) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RegexpLiteral) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *RegexpLiteral) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *RegexpLiteral) SetType(v string) { + o.Type = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *RegexpLiteral) GetValue() string { + if o == nil || o.Value == nil { + var ret string + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RegexpLiteral) GetValueOk() (*string, bool) { + if o == nil || o.Value == nil { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *RegexpLiteral) HasValue() bool { + if o != nil && o.Value != nil { + return true + } + + return false +} + +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *RegexpLiteral) SetValue(v string) { + o.Value = &v +} + +func (o RegexpLiteral) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + return json.Marshal(toSerialize) +} + +type NullableRegexpLiteral struct { + value *RegexpLiteral + isSet bool +} + +func (v NullableRegexpLiteral) Get() *RegexpLiteral { + return v.value +} + +func (v *NullableRegexpLiteral) Set(val *RegexpLiteral) { + v.value = val + v.isSet = true +} + +func (v NullableRegexpLiteral) IsSet() bool { + return v.isSet +} + +func (v *NullableRegexpLiteral) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegexpLiteral(val *RegexpLiteral) *NullableRegexpLiteral { + return &NullableRegexpLiteral{value: val, isSet: true} +} + +func (v NullableRegexpLiteral) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegexpLiteral) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_return_statement.gen.go b/internal/api/model_return_statement.gen.go new file mode 100644 index 0000000..d2526df --- /dev/null +++ b/internal/api/model_return_statement.gen.go @@ -0,0 +1,150 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// ReturnStatement Defines an expression to return +type ReturnStatement struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Argument *Expression `json:"argument,omitempty"` +} + +// NewReturnStatement instantiates a new ReturnStatement object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewReturnStatement() *ReturnStatement { + this := ReturnStatement{} + return &this +} + +// NewReturnStatementWithDefaults instantiates a new ReturnStatement object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewReturnStatementWithDefaults() *ReturnStatement { + this := ReturnStatement{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *ReturnStatement) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ReturnStatement) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *ReturnStatement) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *ReturnStatement) SetType(v string) { + o.Type = &v +} + +// GetArgument returns the Argument field value if set, zero value otherwise. +func (o *ReturnStatement) GetArgument() Expression { + if o == nil || o.Argument == nil { + var ret Expression + return ret + } + return *o.Argument +} + +// GetArgumentOk returns a tuple with the Argument field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ReturnStatement) GetArgumentOk() (*Expression, bool) { + if o == nil || o.Argument == nil { + return nil, false + } + return o.Argument, true +} + +// HasArgument returns a boolean if a field has been set. +func (o *ReturnStatement) HasArgument() bool { + if o != nil && o.Argument != nil { + return true + } + + return false +} + +// SetArgument gets a reference to the given Expression and assigns it to the Argument field. +func (o *ReturnStatement) SetArgument(v Expression) { + o.Argument = &v +} + +func (o ReturnStatement) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Argument != nil { + toSerialize["argument"] = o.Argument + } + return json.Marshal(toSerialize) +} + +type NullableReturnStatement struct { + value *ReturnStatement + isSet bool +} + +func (v NullableReturnStatement) Get() *ReturnStatement { + return v.value +} + +func (v *NullableReturnStatement) Set(val *ReturnStatement) { + v.value = val + v.isSet = true +} + +func (v NullableReturnStatement) IsSet() bool { + return v.isSet +} + +func (v *NullableReturnStatement) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableReturnStatement(val *ReturnStatement) *NullableReturnStatement { + return &NullableReturnStatement{value: val, isSet: true} +} + +func (v NullableReturnStatement) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableReturnStatement) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_statement.gen.go b/internal/api/model_statement.gen.go new file mode 100644 index 0000000..7c3f19e --- /dev/null +++ b/internal/api/model_statement.gen.go @@ -0,0 +1,306 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" + "errors" +) + +// Statement - struct for Statement +type Statement struct { + BadStatement *BadStatement + BuiltinStatement *BuiltinStatement + ExpressionStatement *ExpressionStatement + MemberAssignment *MemberAssignment + OptionStatement *OptionStatement + ReturnStatement *ReturnStatement + TestStatement *TestStatement + VariableAssignment *VariableAssignment +} + +// BadStatementAsStatement is a convenience function that returns BadStatement wrapped in Statement +func BadStatementAsStatement(v *BadStatement) Statement { + return Statement{BadStatement: v} +} + +// BuiltinStatementAsStatement is a convenience function that returns BuiltinStatement wrapped in Statement +func BuiltinStatementAsStatement(v *BuiltinStatement) Statement { + return Statement{BuiltinStatement: v} +} + +// ExpressionStatementAsStatement is a convenience function that returns ExpressionStatement wrapped in Statement +func ExpressionStatementAsStatement(v *ExpressionStatement) Statement { + return Statement{ExpressionStatement: v} +} + +// MemberAssignmentAsStatement is a convenience function that returns MemberAssignment wrapped in Statement +func MemberAssignmentAsStatement(v *MemberAssignment) Statement { + return Statement{MemberAssignment: v} +} + +// OptionStatementAsStatement is a convenience function that returns OptionStatement wrapped in Statement +func OptionStatementAsStatement(v *OptionStatement) Statement { + return Statement{OptionStatement: v} +} + +// ReturnStatementAsStatement is a convenience function that returns ReturnStatement wrapped in Statement +func ReturnStatementAsStatement(v *ReturnStatement) Statement { + return Statement{ReturnStatement: v} +} + +// TestStatementAsStatement is a convenience function that returns TestStatement wrapped in Statement +func TestStatementAsStatement(v *TestStatement) Statement { + return Statement{TestStatement: v} +} + +// VariableAssignmentAsStatement is a convenience function that returns VariableAssignment wrapped in Statement +func VariableAssignmentAsStatement(v *VariableAssignment) Statement { + return Statement{VariableAssignment: v} +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *Statement) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into BadStatement + err = json.Unmarshal(data, &dst.BadStatement) + if err == nil { + jsonBadStatement, _ := json.Marshal(dst.BadStatement) + if string(jsonBadStatement) == "{}" { // empty struct + dst.BadStatement = nil + } else { + match++ + } + } else { + dst.BadStatement = nil + } + + // try to unmarshal data into BuiltinStatement + err = json.Unmarshal(data, &dst.BuiltinStatement) + if err == nil { + jsonBuiltinStatement, _ := json.Marshal(dst.BuiltinStatement) + if string(jsonBuiltinStatement) == "{}" { // empty struct + dst.BuiltinStatement = nil + } else { + match++ + } + } else { + dst.BuiltinStatement = nil + } + + // try to unmarshal data into ExpressionStatement + err = json.Unmarshal(data, &dst.ExpressionStatement) + if err == nil { + jsonExpressionStatement, _ := json.Marshal(dst.ExpressionStatement) + if string(jsonExpressionStatement) == "{}" { // empty struct + dst.ExpressionStatement = nil + } else { + match++ + } + } else { + dst.ExpressionStatement = nil + } + + // try to unmarshal data into MemberAssignment + err = json.Unmarshal(data, &dst.MemberAssignment) + if err == nil { + jsonMemberAssignment, _ := json.Marshal(dst.MemberAssignment) + if string(jsonMemberAssignment) == "{}" { // empty struct + dst.MemberAssignment = nil + } else { + match++ + } + } else { + dst.MemberAssignment = nil + } + + // try to unmarshal data into OptionStatement + err = json.Unmarshal(data, &dst.OptionStatement) + if err == nil { + jsonOptionStatement, _ := json.Marshal(dst.OptionStatement) + if string(jsonOptionStatement) == "{}" { // empty struct + dst.OptionStatement = nil + } else { + match++ + } + } else { + dst.OptionStatement = nil + } + + // try to unmarshal data into ReturnStatement + err = json.Unmarshal(data, &dst.ReturnStatement) + if err == nil { + jsonReturnStatement, _ := json.Marshal(dst.ReturnStatement) + if string(jsonReturnStatement) == "{}" { // empty struct + dst.ReturnStatement = nil + } else { + match++ + } + } else { + dst.ReturnStatement = nil + } + + // try to unmarshal data into TestStatement + err = json.Unmarshal(data, &dst.TestStatement) + if err == nil { + jsonTestStatement, _ := json.Marshal(dst.TestStatement) + if string(jsonTestStatement) == "{}" { // empty struct + dst.TestStatement = nil + } else { + match++ + } + } else { + dst.TestStatement = nil + } + + // try to unmarshal data into VariableAssignment + err = json.Unmarshal(data, &dst.VariableAssignment) + if err == nil { + jsonVariableAssignment, _ := json.Marshal(dst.VariableAssignment) + if string(jsonVariableAssignment) == "{}" { // empty struct + dst.VariableAssignment = nil + } else { + match++ + } + } else { + dst.VariableAssignment = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.BadStatement = nil + dst.BuiltinStatement = nil + dst.ExpressionStatement = nil + dst.MemberAssignment = nil + dst.OptionStatement = nil + dst.ReturnStatement = nil + dst.TestStatement = nil + dst.VariableAssignment = nil + + return errors.New("data matches more than one schema in oneOf(Statement)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return errors.New("data failed to match schemas in oneOf(Statement)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src Statement) MarshalJSON() ([]byte, error) { + if src.BadStatement != nil { + return json.Marshal(&src.BadStatement) + } + + if src.BuiltinStatement != nil { + return json.Marshal(&src.BuiltinStatement) + } + + if src.ExpressionStatement != nil { + return json.Marshal(&src.ExpressionStatement) + } + + if src.MemberAssignment != nil { + return json.Marshal(&src.MemberAssignment) + } + + if src.OptionStatement != nil { + return json.Marshal(&src.OptionStatement) + } + + if src.ReturnStatement != nil { + return json.Marshal(&src.ReturnStatement) + } + + if src.TestStatement != nil { + return json.Marshal(&src.TestStatement) + } + + if src.VariableAssignment != nil { + return json.Marshal(&src.VariableAssignment) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *Statement) GetActualInstance() interface{} { + if obj.BadStatement != nil { + return obj.BadStatement + } + + if obj.BuiltinStatement != nil { + return obj.BuiltinStatement + } + + if obj.ExpressionStatement != nil { + return obj.ExpressionStatement + } + + if obj.MemberAssignment != nil { + return obj.MemberAssignment + } + + if obj.OptionStatement != nil { + return obj.OptionStatement + } + + if obj.ReturnStatement != nil { + return obj.ReturnStatement + } + + if obj.TestStatement != nil { + return obj.TestStatement + } + + if obj.VariableAssignment != nil { + return obj.VariableAssignment + } + + // all schemas are nil + return nil +} + +type NullableStatement struct { + value *Statement + isSet bool +} + +func (v NullableStatement) Get() *Statement { + return v.value +} + +func (v *NullableStatement) Set(val *Statement) { + v.value = val + v.isSet = true +} + +func (v NullableStatement) IsSet() bool { + return v.isSet +} + +func (v *NullableStatement) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStatement(val *Statement) *NullableStatement { + return &NullableStatement{value: val, isSet: true} +} + +func (v NullableStatement) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStatement) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_string_literal.gen.go b/internal/api/model_string_literal.gen.go new file mode 100644 index 0000000..1f521df --- /dev/null +++ b/internal/api/model_string_literal.gen.go @@ -0,0 +1,150 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// StringLiteral Expressions begin and end with double quote marks +type StringLiteral struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Value *string `json:"value,omitempty"` +} + +// NewStringLiteral instantiates a new StringLiteral object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewStringLiteral() *StringLiteral { + this := StringLiteral{} + return &this +} + +// NewStringLiteralWithDefaults instantiates a new StringLiteral object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewStringLiteralWithDefaults() *StringLiteral { + this := StringLiteral{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *StringLiteral) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *StringLiteral) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *StringLiteral) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *StringLiteral) SetType(v string) { + o.Type = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *StringLiteral) GetValue() string { + if o == nil || o.Value == nil { + var ret string + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *StringLiteral) GetValueOk() (*string, bool) { + if o == nil || o.Value == nil { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *StringLiteral) HasValue() bool { + if o != nil && o.Value != nil { + return true + } + + return false +} + +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *StringLiteral) SetValue(v string) { + o.Value = &v +} + +func (o StringLiteral) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + return json.Marshal(toSerialize) +} + +type NullableStringLiteral struct { + value *StringLiteral + isSet bool +} + +func (v NullableStringLiteral) Get() *StringLiteral { + return v.value +} + +func (v *NullableStringLiteral) Set(val *StringLiteral) { + v.value = val + v.isSet = true +} + +func (v NullableStringLiteral) IsSet() bool { + return v.isSet +} + +func (v *NullableStringLiteral) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStringLiteral(val *StringLiteral) *NullableStringLiteral { + return &NullableStringLiteral{value: val, isSet: true} +} + +func (v NullableStringLiteral) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStringLiteral) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_test_statement.gen.go b/internal/api/model_test_statement.gen.go new file mode 100644 index 0000000..e9e68b5 --- /dev/null +++ b/internal/api/model_test_statement.gen.go @@ -0,0 +1,150 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// TestStatement Declares a Flux test case +type TestStatement struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Assignment *VariableAssignment `json:"assignment,omitempty"` +} + +// NewTestStatement instantiates a new TestStatement object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTestStatement() *TestStatement { + this := TestStatement{} + return &this +} + +// NewTestStatementWithDefaults instantiates a new TestStatement object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTestStatementWithDefaults() *TestStatement { + this := TestStatement{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *TestStatement) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TestStatement) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *TestStatement) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *TestStatement) SetType(v string) { + o.Type = &v +} + +// GetAssignment returns the Assignment field value if set, zero value otherwise. +func (o *TestStatement) GetAssignment() VariableAssignment { + if o == nil || o.Assignment == nil { + var ret VariableAssignment + return ret + } + return *o.Assignment +} + +// GetAssignmentOk returns a tuple with the Assignment field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TestStatement) GetAssignmentOk() (*VariableAssignment, bool) { + if o == nil || o.Assignment == nil { + return nil, false + } + return o.Assignment, true +} + +// HasAssignment returns a boolean if a field has been set. +func (o *TestStatement) HasAssignment() bool { + if o != nil && o.Assignment != nil { + return true + } + + return false +} + +// SetAssignment gets a reference to the given VariableAssignment and assigns it to the Assignment field. +func (o *TestStatement) SetAssignment(v VariableAssignment) { + o.Assignment = &v +} + +func (o TestStatement) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Assignment != nil { + toSerialize["assignment"] = o.Assignment + } + return json.Marshal(toSerialize) +} + +type NullableTestStatement struct { + value *TestStatement + isSet bool +} + +func (v NullableTestStatement) Get() *TestStatement { + return v.value +} + +func (v *NullableTestStatement) Set(val *TestStatement) { + v.value = val + v.isSet = true +} + +func (v NullableTestStatement) IsSet() bool { + return v.isSet +} + +func (v *NullableTestStatement) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTestStatement(val *TestStatement) *NullableTestStatement { + return &NullableTestStatement{value: val, isSet: true} +} + +func (v NullableTestStatement) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTestStatement) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_unary_expression.gen.go b/internal/api/model_unary_expression.gen.go new file mode 100644 index 0000000..3e5d67b --- /dev/null +++ b/internal/api/model_unary_expression.gen.go @@ -0,0 +1,186 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// UnaryExpression Uses operators to act on a single operand in an expression +type UnaryExpression struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Operator *string `json:"operator,omitempty"` + Argument *Expression `json:"argument,omitempty"` +} + +// NewUnaryExpression instantiates a new UnaryExpression object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUnaryExpression() *UnaryExpression { + this := UnaryExpression{} + return &this +} + +// NewUnaryExpressionWithDefaults instantiates a new UnaryExpression object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUnaryExpressionWithDefaults() *UnaryExpression { + this := UnaryExpression{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *UnaryExpression) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UnaryExpression) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *UnaryExpression) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *UnaryExpression) SetType(v string) { + o.Type = &v +} + +// GetOperator returns the Operator field value if set, zero value otherwise. +func (o *UnaryExpression) GetOperator() string { + if o == nil || o.Operator == nil { + var ret string + return ret + } + return *o.Operator +} + +// GetOperatorOk returns a tuple with the Operator field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UnaryExpression) GetOperatorOk() (*string, bool) { + if o == nil || o.Operator == nil { + return nil, false + } + return o.Operator, true +} + +// HasOperator returns a boolean if a field has been set. +func (o *UnaryExpression) HasOperator() bool { + if o != nil && o.Operator != nil { + return true + } + + return false +} + +// SetOperator gets a reference to the given string and assigns it to the Operator field. +func (o *UnaryExpression) SetOperator(v string) { + o.Operator = &v +} + +// GetArgument returns the Argument field value if set, zero value otherwise. +func (o *UnaryExpression) GetArgument() Expression { + if o == nil || o.Argument == nil { + var ret Expression + return ret + } + return *o.Argument +} + +// GetArgumentOk returns a tuple with the Argument field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UnaryExpression) GetArgumentOk() (*Expression, bool) { + if o == nil || o.Argument == nil { + return nil, false + } + return o.Argument, true +} + +// HasArgument returns a boolean if a field has been set. +func (o *UnaryExpression) HasArgument() bool { + if o != nil && o.Argument != nil { + return true + } + + return false +} + +// SetArgument gets a reference to the given Expression and assigns it to the Argument field. +func (o *UnaryExpression) SetArgument(v Expression) { + o.Argument = &v +} + +func (o UnaryExpression) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Operator != nil { + toSerialize["operator"] = o.Operator + } + if o.Argument != nil { + toSerialize["argument"] = o.Argument + } + return json.Marshal(toSerialize) +} + +type NullableUnaryExpression struct { + value *UnaryExpression + isSet bool +} + +func (v NullableUnaryExpression) Get() *UnaryExpression { + return v.value +} + +func (v *NullableUnaryExpression) Set(val *UnaryExpression) { + v.value = val + v.isSet = true +} + +func (v NullableUnaryExpression) IsSet() bool { + return v.isSet +} + +func (v *NullableUnaryExpression) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUnaryExpression(val *UnaryExpression) *NullableUnaryExpression { + return &NullableUnaryExpression{value: val, isSet: true} +} + +func (v NullableUnaryExpression) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUnaryExpression) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_unsigned_integer_literal.gen.go b/internal/api/model_unsigned_integer_literal.gen.go new file mode 100644 index 0000000..d583f25 --- /dev/null +++ b/internal/api/model_unsigned_integer_literal.gen.go @@ -0,0 +1,150 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// UnsignedIntegerLiteral Represents integer numbers +type UnsignedIntegerLiteral struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Value *string `json:"value,omitempty"` +} + +// NewUnsignedIntegerLiteral instantiates a new UnsignedIntegerLiteral object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUnsignedIntegerLiteral() *UnsignedIntegerLiteral { + this := UnsignedIntegerLiteral{} + return &this +} + +// NewUnsignedIntegerLiteralWithDefaults instantiates a new UnsignedIntegerLiteral object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUnsignedIntegerLiteralWithDefaults() *UnsignedIntegerLiteral { + this := UnsignedIntegerLiteral{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *UnsignedIntegerLiteral) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UnsignedIntegerLiteral) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *UnsignedIntegerLiteral) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *UnsignedIntegerLiteral) SetType(v string) { + o.Type = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *UnsignedIntegerLiteral) GetValue() string { + if o == nil || o.Value == nil { + var ret string + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UnsignedIntegerLiteral) GetValueOk() (*string, bool) { + if o == nil || o.Value == nil { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *UnsignedIntegerLiteral) HasValue() bool { + if o != nil && o.Value != nil { + return true + } + + return false +} + +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *UnsignedIntegerLiteral) SetValue(v string) { + o.Value = &v +} + +func (o UnsignedIntegerLiteral) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Value != nil { + toSerialize["value"] = o.Value + } + return json.Marshal(toSerialize) +} + +type NullableUnsignedIntegerLiteral struct { + value *UnsignedIntegerLiteral + isSet bool +} + +func (v NullableUnsignedIntegerLiteral) Get() *UnsignedIntegerLiteral { + return v.value +} + +func (v *NullableUnsignedIntegerLiteral) Set(val *UnsignedIntegerLiteral) { + v.value = val + v.isSet = true +} + +func (v NullableUnsignedIntegerLiteral) IsSet() bool { + return v.isSet +} + +func (v *NullableUnsignedIntegerLiteral) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUnsignedIntegerLiteral(val *UnsignedIntegerLiteral) *NullableUnsignedIntegerLiteral { + return &NullableUnsignedIntegerLiteral{value: val, isSet: true} +} + +func (v NullableUnsignedIntegerLiteral) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUnsignedIntegerLiteral) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_variable_assignment.gen.go b/internal/api/model_variable_assignment.gen.go new file mode 100644 index 0000000..1f6c780 --- /dev/null +++ b/internal/api/model_variable_assignment.gen.go @@ -0,0 +1,186 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" +) + +// VariableAssignment Represents the declaration of a variable +type VariableAssignment struct { + // Type of AST node + Type *string `json:"type,omitempty"` + Id *Identifier `json:"id,omitempty"` + Init *Expression `json:"init,omitempty"` +} + +// NewVariableAssignment instantiates a new VariableAssignment object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVariableAssignment() *VariableAssignment { + this := VariableAssignment{} + return &this +} + +// NewVariableAssignmentWithDefaults instantiates a new VariableAssignment object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVariableAssignmentWithDefaults() *VariableAssignment { + this := VariableAssignment{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *VariableAssignment) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VariableAssignment) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *VariableAssignment) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *VariableAssignment) SetType(v string) { + o.Type = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *VariableAssignment) GetId() Identifier { + if o == nil || o.Id == nil { + var ret Identifier + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VariableAssignment) GetIdOk() (*Identifier, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *VariableAssignment) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// SetId gets a reference to the given Identifier and assigns it to the Id field. +func (o *VariableAssignment) SetId(v Identifier) { + o.Id = &v +} + +// GetInit returns the Init field value if set, zero value otherwise. +func (o *VariableAssignment) GetInit() Expression { + if o == nil || o.Init == nil { + var ret Expression + return ret + } + return *o.Init +} + +// GetInitOk returns a tuple with the Init field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VariableAssignment) GetInitOk() (*Expression, bool) { + if o == nil || o.Init == nil { + return nil, false + } + return o.Init, true +} + +// HasInit returns a boolean if a field has been set. +func (o *VariableAssignment) HasInit() bool { + if o != nil && o.Init != nil { + return true + } + + return false +} + +// SetInit gets a reference to the given Expression and assigns it to the Init field. +func (o *VariableAssignment) SetInit(v Expression) { + o.Init = &v +} + +func (o VariableAssignment) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Type != nil { + toSerialize["type"] = o.Type + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Init != nil { + toSerialize["init"] = o.Init + } + return json.Marshal(toSerialize) +} + +type NullableVariableAssignment struct { + value *VariableAssignment + isSet bool +} + +func (v NullableVariableAssignment) Get() *VariableAssignment { + return v.value +} + +func (v *NullableVariableAssignment) Set(val *VariableAssignment) { + v.value = val + v.isSet = true +} + +func (v NullableVariableAssignment) IsSet() bool { + return v.isSet +} + +func (v *NullableVariableAssignment) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVariableAssignment(val *VariableAssignment) *NullableVariableAssignment { + return &NullableVariableAssignment{value: val, isSet: true} +} + +func (v NullableVariableAssignment) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVariableAssignment) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/model_variable_or_member_assignment.gen.go b/internal/api/model_variable_or_member_assignment.gen.go new file mode 100644 index 0000000..2212bc7 --- /dev/null +++ b/internal/api/model_variable_or_member_assignment.gen.go @@ -0,0 +1,138 @@ +/* + * Subset of Influx API covered by Influx CLI + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * API version: 2.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package api + +import ( + "encoding/json" + "errors" +) + +// VariableOrMemberAssignment - struct for VariableOrMemberAssignment +type VariableOrMemberAssignment struct { + MemberAssignment *MemberAssignment + VariableAssignment *VariableAssignment +} + +// MemberAssignmentAsVariableOrMemberAssignment is a convenience function that returns MemberAssignment wrapped in VariableOrMemberAssignment +func MemberAssignmentAsVariableOrMemberAssignment(v *MemberAssignment) VariableOrMemberAssignment { + return VariableOrMemberAssignment{MemberAssignment: v} +} + +// VariableAssignmentAsVariableOrMemberAssignment is a convenience function that returns VariableAssignment wrapped in VariableOrMemberAssignment +func VariableAssignmentAsVariableOrMemberAssignment(v *VariableAssignment) VariableOrMemberAssignment { + return VariableOrMemberAssignment{VariableAssignment: v} +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *VariableOrMemberAssignment) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into MemberAssignment + err = json.Unmarshal(data, &dst.MemberAssignment) + if err == nil { + jsonMemberAssignment, _ := json.Marshal(dst.MemberAssignment) + if string(jsonMemberAssignment) == "{}" { // empty struct + dst.MemberAssignment = nil + } else { + match++ + } + } else { + dst.MemberAssignment = nil + } + + // try to unmarshal data into VariableAssignment + err = json.Unmarshal(data, &dst.VariableAssignment) + if err == nil { + jsonVariableAssignment, _ := json.Marshal(dst.VariableAssignment) + if string(jsonVariableAssignment) == "{}" { // empty struct + dst.VariableAssignment = nil + } else { + match++ + } + } else { + dst.VariableAssignment = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.MemberAssignment = nil + dst.VariableAssignment = nil + + return errors.New("data matches more than one schema in oneOf(VariableOrMemberAssignment)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return errors.New("data failed to match schemas in oneOf(VariableOrMemberAssignment)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src VariableOrMemberAssignment) MarshalJSON() ([]byte, error) { + if src.MemberAssignment != nil { + return json.Marshal(&src.MemberAssignment) + } + + if src.VariableAssignment != nil { + return json.Marshal(&src.VariableAssignment) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *VariableOrMemberAssignment) GetActualInstance() interface{} { + if obj.MemberAssignment != nil { + return obj.MemberAssignment + } + + if obj.VariableAssignment != nil { + return obj.VariableAssignment + } + + // all schemas are nil + return nil +} + +type NullableVariableOrMemberAssignment struct { + value *VariableOrMemberAssignment + isSet bool +} + +func (v NullableVariableOrMemberAssignment) Get() *VariableOrMemberAssignment { + return v.value +} + +func (v *NullableVariableOrMemberAssignment) Set(val *VariableOrMemberAssignment) { + v.value = val + v.isSet = true +} + +func (v NullableVariableOrMemberAssignment) IsSet() bool { + return v.isSet +} + +func (v *NullableVariableOrMemberAssignment) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVariableOrMemberAssignment(val *VariableOrMemberAssignment) *NullableVariableOrMemberAssignment { + return &NullableVariableOrMemberAssignment{value: val, isSet: true} +} + +func (v NullableVariableOrMemberAssignment) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVariableOrMemberAssignment) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/api/templates/README.md b/internal/api/templates/README.md index 4e11027..ae8200d 100644 --- a/internal/api/templates/README.md +++ b/internal/api/templates/README.md @@ -30,3 +30,6 @@ multiple locations. `configuration.mustache` * Deleted `ContextOAuth2` key to match modification in client * Fixed error strings to be idiomatic according to staticcheck (lowercase, no punctuation) + +`model_oneof.mustache` +* Fixed error strings to be idiomatic according to staticcheck (lowercase, no punctuation) diff --git a/internal/api/templates/model_oneof.mustache b/internal/api/templates/model_oneof.mustache new file mode 100644 index 0000000..3a3f631 --- /dev/null +++ b/internal/api/templates/model_oneof.mustache @@ -0,0 +1,109 @@ +// {{classname}} - {{#description}}{{{description}}}{{/description}}{{^description}}struct for {{{classname}}}{{/description}} +type {{classname}} struct { +{{#oneOf}} + {{{.}}} *{{{.}}} +{{/oneOf}} +} + +{{#oneOf}} + // {{{.}}}As{{classname}} is a convenience function that returns {{{.}}} wrapped in {{classname}} + func {{{.}}}As{{classname}}(v *{{{.}}}) {{classname}} { + return {{classname}}{ {{{.}}}: v} + } + +{{/oneOf}} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *{{classname}}) UnmarshalJSON(data []byte) error { +var err error +{{#isNullable}} + // this object is nullable so check if the payload is null or empty string + if string(data) == "" || string(data) == "{}" { + return nil + } + +{{/isNullable}} +{{#useOneOfDiscriminatorLookup}} + {{#discriminator}} + {{#mappedModels}} + {{#-first}} + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = json.Unmarshal(data, &jsonDict) + if err != nil { + return fmt.Errorf("Failed to unmarshal JSON into map for the discrimintor lookup.") + } + + {{/-first}} + // check if the discriminator value is '{{{mappingName}}}' + if jsonDict["{{{propertyBaseName}}}"] == "{{{mappingName}}}" { + // try to unmarshal JSON data into {{{modelName}}} + err = json.Unmarshal(data, &dst.{{{modelName}}}) + if err == nil { + return nil // data stored in dst.{{{modelName}}}, return on the first match + } else { + dst.{{{modelName}}} = nil + return fmt.Errorf("Failed to unmarshal {{classname}} as {{{modelName}}}: %s", err.Error()) + } + } + + {{/mappedModels}} + {{/discriminator}} + return nil +{{/useOneOfDiscriminatorLookup}} +{{^useOneOfDiscriminatorLookup}} + match := 0 + {{#oneOf}} + // try to unmarshal data into {{{.}}} + err = json.Unmarshal(data, &dst.{{{.}}}) + if err == nil { + json{{{.}}}, _ := json.Marshal(dst.{{{.}}}) + if string(json{{{.}}}) == "{}" { // empty struct + dst.{{{.}}} = nil + } else { + match++ + } + } else { + dst.{{{.}}} = nil + } + + {{/oneOf}} + if match > 1 { // more than 1 match + // reset to nil + {{#oneOf}} + dst.{{{.}}} = nil + {{/oneOf}} + + return errors.New("data matches more than one schema in oneOf({{classname}})") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return errors.New("data failed to match schemas in oneOf({{classname}})") + } +{{/useOneOfDiscriminatorLookup}} +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src {{classname}}) MarshalJSON() ([]byte, error) { +{{#oneOf}} + if src.{{{.}}} != nil { + return json.Marshal(&src.{{{.}}}) + } + +{{/oneOf}} +return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *{{classname}}) GetActualInstance() (interface{}) { +{{#oneOf}} + if obj.{{{.}}} != nil { + return obj.{{{.}}} + } + +{{/oneOf}} +// all schemas are nil +return nil +} + +{{>nullable_model}}