From 6f803abd96be0e837db53261c44c73cfe0b72403 Mon Sep 17 00:00:00 2001 From: Vernon Keenan Date: Sat, 8 Apr 2023 02:47:39 +0000 Subject: [PATCH] clean up research --- .../get_company_products_parameters.go | 68 ++++++------ .../industry/get_industries_parameters.go | 102 ++++++++++++------ api/research/research_models/industry.go | 3 + swagger/external/research-vernonkeenan.yaml | 20 +++- swagger/research-vernonkeenan.yaml | 20 +++- 5 files changed, 141 insertions(+), 72 deletions(-) diff --git a/api/research/research_client/company_products/get_company_products_parameters.go b/api/research/research_client/company_products/get_company_products_parameters.go index 4265d2b..1e0cf49 100644 --- a/api/research/research_client/company_products/get_company_products_parameters.go +++ b/api/research/research_client/company_products/get_company_products_parameters.go @@ -92,12 +92,6 @@ type GetCompanyProductsParams struct { */ Limit *int64 - /* Name. - - The Name of this Object - */ - Name *string - /* Offset. How many objects to skip? @@ -106,6 +100,12 @@ type GetCompanyProductsParams struct { */ Offset *int64 + /* Slug. + + The Slug of this Object + */ + Slug *string + timeout time.Duration Context context.Context HTTPClient *http.Client @@ -203,17 +203,6 @@ func (o *GetCompanyProductsParams) SetLimit(limit *int64) { o.Limit = limit } -// WithName adds the name to the get company products params -func (o *GetCompanyProductsParams) WithName(name *string) *GetCompanyProductsParams { - o.SetName(name) - return o -} - -// SetName adds the name to the get company products params -func (o *GetCompanyProductsParams) SetName(name *string) { - o.Name = name -} - // WithOffset adds the offset to the get company products params func (o *GetCompanyProductsParams) WithOffset(offset *int64) *GetCompanyProductsParams { o.SetOffset(offset) @@ -225,6 +214,17 @@ func (o *GetCompanyProductsParams) SetOffset(offset *int64) { o.Offset = offset } +// WithSlug adds the slug to the get company products params +func (o *GetCompanyProductsParams) WithSlug(slug *string) *GetCompanyProductsParams { + o.SetSlug(slug) + return o +} + +// SetSlug adds the slug to the get company products params +func (o *GetCompanyProductsParams) SetSlug(slug *string) { + o.Slug = slug +} + // WriteToRequest writes these params to a swagger request func (o *GetCompanyProductsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { @@ -301,23 +301,6 @@ func (o *GetCompanyProductsParams) WriteToRequest(r runtime.ClientRequest, reg s } } - if o.Name != nil { - - // query param name - var qrName string - - if o.Name != nil { - qrName = *o.Name - } - qName := qrName - if qName != "" { - - if err := r.SetQueryParam("name", qName); err != nil { - return err - } - } - } - if o.Offset != nil { // query param offset @@ -335,6 +318,23 @@ func (o *GetCompanyProductsParams) WriteToRequest(r runtime.ClientRequest, reg s } } + if o.Slug != nil { + + // query param slug + var qrSlug string + + if o.Slug != nil { + qrSlug = *o.Slug + } + qSlug := qrSlug + if qSlug != "" { + + if err := r.SetQueryParam("slug", qSlug); err != nil { + return err + } + } + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } diff --git a/api/research/research_client/industry/get_industries_parameters.go b/api/research/research_client/industry/get_industries_parameters.go index 2547510..24ea72c 100644 --- a/api/research/research_client/industry/get_industries_parameters.go +++ b/api/research/research_client/industry/get_industries_parameters.go @@ -80,12 +80,6 @@ type GetIndustriesParams struct { */ Limit *int64 - /* Name. - - The Name of this Object - */ - Name *string - /* Offset. How many objects to skip? @@ -94,6 +88,18 @@ type GetIndustriesParams struct { */ Offset *int64 + /* ProductCategory. + + Is this industry a product category? + */ + ProductCategory *bool + + /* Slug. + + The Slug of this Object + */ + Slug *string + timeout time.Duration Context context.Context HTTPClient *http.Client @@ -169,17 +175,6 @@ func (o *GetIndustriesParams) SetLimit(limit *int64) { o.Limit = limit } -// WithName adds the name to the get industries params -func (o *GetIndustriesParams) WithName(name *string) *GetIndustriesParams { - o.SetName(name) - return o -} - -// SetName adds the name to the get industries params -func (o *GetIndustriesParams) SetName(name *string) { - o.Name = name -} - // WithOffset adds the offset to the get industries params func (o *GetIndustriesParams) WithOffset(offset *int64) *GetIndustriesParams { o.SetOffset(offset) @@ -191,6 +186,28 @@ func (o *GetIndustriesParams) SetOffset(offset *int64) { o.Offset = offset } +// WithProductCategory adds the productCategory to the get industries params +func (o *GetIndustriesParams) WithProductCategory(productCategory *bool) *GetIndustriesParams { + o.SetProductCategory(productCategory) + return o +} + +// SetProductCategory adds the productCategory to the get industries params +func (o *GetIndustriesParams) SetProductCategory(productCategory *bool) { + o.ProductCategory = productCategory +} + +// WithSlug adds the slug to the get industries params +func (o *GetIndustriesParams) WithSlug(slug *string) *GetIndustriesParams { + o.SetSlug(slug) + return o +} + +// SetSlug adds the slug to the get industries params +func (o *GetIndustriesParams) SetSlug(slug *string) { + o.Slug = slug +} + // WriteToRequest writes these params to a swagger request func (o *GetIndustriesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { @@ -233,23 +250,6 @@ func (o *GetIndustriesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt } } - if o.Name != nil { - - // query param name - var qrName string - - if o.Name != nil { - qrName = *o.Name - } - qName := qrName - if qName != "" { - - if err := r.SetQueryParam("name", qName); err != nil { - return err - } - } - } - if o.Offset != nil { // query param offset @@ -267,6 +267,40 @@ func (o *GetIndustriesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt } } + if o.ProductCategory != nil { + + // query param productCategory + var qrProductCategory bool + + if o.ProductCategory != nil { + qrProductCategory = *o.ProductCategory + } + qProductCategory := swag.FormatBool(qrProductCategory) + if qProductCategory != "" { + + if err := r.SetQueryParam("productCategory", qProductCategory); err != nil { + return err + } + } + } + + if o.Slug != nil { + + // query param slug + var qrSlug string + + if o.Slug != nil { + qrSlug = *o.Slug + } + qSlug := qrSlug + if qSlug != "" { + + if err := r.SetQueryParam("slug", qSlug); err != nil { + return err + } + } + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } diff --git a/api/research/research_models/industry.go b/api/research/research_models/industry.go index caa5388..a5c15ad 100644 --- a/api/research/research_models/industry.go +++ b/api/research/research_models/industry.go @@ -65,6 +65,9 @@ type Industry struct { // The full path of this industry, including Parent Path string `json:"Path,omitempty"` + // Is this industry a product category? + ProductCategory bool `json:"ProductCategory,omitempty"` + // The CMS Slug for this Industry Slug string `json:"Slug,omitempty"` diff --git a/swagger/external/research-vernonkeenan.yaml b/swagger/external/research-vernonkeenan.yaml index e4e329a..19286a1 100644 --- a/swagger/external/research-vernonkeenan.yaml +++ b/swagger/external/research-vernonkeenan.yaml @@ -104,6 +104,12 @@ parameters: name: industryId required: false type: string + productCategoryQuery: + description: Is this industry a product category? + in: query + name: productCategory + required: false + type: boolean industryProductIdQuery: description: IndustryProduct record ID in: query @@ -143,6 +149,12 @@ parameters: name: name required: false type: string + slugQuery: + description: The Slug of this Object + in: query + name: slug + required: false + type: string observationIdQuery: description: Observation record ID in: query @@ -303,7 +315,7 @@ paths: operationId: getCompanyProducts parameters: - $ref: "#/parameters/limitQuery" - - $ref: "#/parameters/nameQuery" + - $ref: "#/parameters/slugQuery" - $ref: "#/parameters/offsetQuery" - $ref: "#/parameters/activeQuery" - $ref: "#/parameters/accountIdQuery" @@ -572,9 +584,10 @@ paths: operationId: getIndustries parameters: - $ref: "#/parameters/limitQuery" - - $ref: "#/parameters/nameQuery" + - $ref: "#/parameters/slugQuery" - $ref: "#/parameters/offsetQuery" - $ref: "#/parameters/industryIdQuery" + - $ref: "#/parameters/productCategoryQuery" responses: "200": $ref: "#/responses/IndustryResponse" @@ -1203,6 +1216,9 @@ definitions: Path: description: The full path of this industry, including Parent type: string + ProductCategory: + description: Is this industry a product category? + type: boolean Slug: description: The CMS Slug for this Industry type: string diff --git a/swagger/research-vernonkeenan.yaml b/swagger/research-vernonkeenan.yaml index cf42bb5..7b12b39 100644 --- a/swagger/research-vernonkeenan.yaml +++ b/swagger/research-vernonkeenan.yaml @@ -104,6 +104,12 @@ parameters: name: industryId required: false type: string + productCategoryQuery: + description: Is this industry a product category? + in: query + name: productCategory + required: false + type: boolean industryProductIdQuery: description: IndustryProduct record ID in: query @@ -143,6 +149,12 @@ parameters: name: name required: false type: string + slugQuery: + description: The Slug of this Object + in: query + name: slug + required: false + type: string observationIdQuery: description: Observation record ID in: query @@ -303,7 +315,7 @@ paths: operationId: getCompanyProducts parameters: - $ref: "#/parameters/limitQuery" - - $ref: "#/parameters/nameQuery" + - $ref: "#/parameters/slugQuery" - $ref: "#/parameters/offsetQuery" - $ref: "#/parameters/activeQuery" - $ref: "#/parameters/accountIdQuery" @@ -572,9 +584,10 @@ paths: operationId: getIndustries parameters: - $ref: "#/parameters/limitQuery" - - $ref: "#/parameters/nameQuery" + - $ref: "#/parameters/slugQuery" - $ref: "#/parameters/offsetQuery" - $ref: "#/parameters/industryIdQuery" + - $ref: "#/parameters/productCategoryQuery" responses: "200": $ref: "#/responses/IndustryResponse" @@ -1203,6 +1216,9 @@ definitions: Path: description: The full path of this industry, including Parent type: string + ProductCategory: + description: Is this industry a product category? + type: boolean Slug: description: The CMS Slug for this Industry type: string