@@ -425,6 +425,32 @@ func CompanyDelete(
425425 return twapi .Execute [CompanyDeleteRequest , * CompanyDeleteResponse ](ctx , engine , req )
426426}
427427
428+ // CompanyRequestSideload contains the possible sideload options when loading
429+ // companies.
430+ type CompanyRequestSideload string
431+
432+ // List of possible sideload options for CompanyRequestSideload.
433+ const (
434+ CompanyRequestSideloadCompanyCustomFields CompanyRequestSideload = "customfields"
435+ CompanyRequestSideloadCompanyCustomFieldValues CompanyRequestSideload = "customfieldcompanies"
436+ )
437+
438+ // CompanyRequestFilters contains the filters for loading companies.
439+ type CompanyRequestFilters struct {
440+ // Include specifies related resources to include.
441+ Include []CompanyRequestSideload
442+ }
443+
444+ func (p CompanyRequestFilters ) apply (req * http.Request ) {
445+ query := req .URL .Query ()
446+ if len (p .Include ) > 0 {
447+ for _ , include := range p .Include {
448+ query .Add ("include" , string (include ))
449+ }
450+ }
451+ req .URL .RawQuery = query .Encode ()
452+ }
453+
428454// CompanyGetRequestPath contains the path parameters for loading a single company.
429455type CompanyGetRequestPath struct {
430456 // ID is the unique identifier of the company to be retrieved.
@@ -438,6 +464,9 @@ type CompanyGetRequestPath struct {
438464type CompanyGetRequest struct {
439465 // Path contains the path parameters for the request.
440466 Path CompanyGetRequestPath
467+
468+ // Filters contains the filters for loading a single company.
469+ Filters CompanyRequestFilters
441470}
442471
443472// NewCompanyGetRequest creates a new CompanyGetRequest with the provided
@@ -458,6 +487,7 @@ func (c CompanyGetRequest) HTTPRequest(ctx context.Context, server string) (*htt
458487 if err != nil {
459488 return nil , err
460489 }
490+ c .Filters .apply (req )
461491
462492 return req , nil
463493}
@@ -467,6 +497,19 @@ func (c CompanyGetRequest) HTTPRequest(ctx context.Context, server string) (*htt
467497// https://apidocs.teamwork.com/docs/teamwork/v3/companies/get-projects-api-v3-companies-company-id-json
468498type CompanyGetResponse struct {
469499 Company Company `json:"company"`
500+
501+ // Included contains related objects included in the response.
502+ Included struct {
503+ // CustomFields contains the custom fields associated with the company.
504+ //
505+ // The key is the string representation of the custom field ID.
506+ CustomFields map [string ]CustomField `json:"customfields,omitempty"`
507+ // CustomFieldValues contains the values of the custom fields associated
508+ // with the company.
509+ //
510+ // The key is the string representation of the custom field value ID.
511+ CustomFieldValues map [string ]CustomFieldValue `json:"customfieldCompanies,omitempty"`
512+ } `json:"included"`
470513}
471514
472515// HandleHTTPResponse handles the HTTP response for the CompanyGetResponse. If
@@ -496,6 +539,8 @@ func CompanyGet(
496539// CompanyListRequestFilters contains the filters for loading multiple
497540// clients/companies.
498541type CompanyListRequestFilters struct {
542+ CompanyRequestFilters
543+
499544 // SearchTerm is an optional search term to filter clients/companies by name.
500545 SearchTerm string
501546
@@ -514,6 +559,8 @@ type CompanyListRequestFilters struct {
514559}
515560
516561func (c CompanyListRequestFilters ) apply (req * http.Request ) {
562+ c .CompanyRequestFilters .apply (req )
563+
517564 query := req .URL .Query ()
518565 if c .SearchTerm != "" {
519566 query .Set ("searchTerm" , c .SearchTerm )
@@ -576,12 +623,28 @@ func (c CompanyListRequest) HTTPRequest(ctx context.Context, server string) (*ht
576623type CompanyListResponse struct {
577624 request CompanyListRequest
578625
626+ // Meta contains metadata about the response, including pagination details.
579627 Meta struct {
580628 Page struct {
581629 HasMore bool `json:"hasMore"`
582630 } `json:"page"`
583631 } `json:"meta"`
632+
633+ // Companies is the list of companies matching the request filters.
584634 Companies []Company `json:"companies"`
635+
636+ // Included contains related objects included in the response.
637+ Included struct {
638+ // CustomFields contains the custom fields associated with the company.
639+ //
640+ // The key is the string representation of the custom field ID.
641+ CustomFields map [string ]CustomField `json:"customfields,omitempty"`
642+ // CustomFieldValues contains the values of the custom fields associated
643+ // with the company.
644+ //
645+ // The key is the string representation of the custom field value ID.
646+ CustomFieldValues map [string ]CustomFieldValue `json:"customfieldCompanies,omitempty"`
647+ } `json:"included"`
585648}
586649
587650// HandleHTTPResponse handles the HTTP response for the CompanyListResponse. If
0 commit comments