generated from hashicorp/terraform-provider-scaffolding-framework
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
638 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,4 +34,5 @@ website/vendor | |
# Keep windows files with windows line endings | ||
*.winfile eol=crlf | ||
|
||
local/ | ||
local/ | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package akeneox | ||
|
||
import ( | ||
goakeneo "github.com/ezifyio/go-akeneo" | ||
) | ||
|
||
const ( | ||
measurementFamilyPath = "/api/rest/v1/measurement-families" | ||
) | ||
|
||
type MeasurementFamilyService struct { | ||
goakeneo.FamilyService | ||
client *goakeneo.Client | ||
} | ||
|
||
func NewMeasurementFamilyClient(client *goakeneo.Client) *MeasurementFamilyService { | ||
return &MeasurementFamilyService{ | ||
FamilyService: client.Family, | ||
client: client, | ||
} | ||
} | ||
|
||
func (a *MeasurementFamilyService) GetMeasurementFamily(code string) (*MeasurementFamily, error) { | ||
data := new(MeasurementFamily) | ||
response := new([]MeasurementFamily) | ||
err := a.client.GET( | ||
measurementFamilyPath, | ||
nil, | ||
nil, | ||
response, | ||
) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
for _, r := range *response { | ||
if r.Code == code { | ||
data = &r | ||
break | ||
} | ||
} | ||
|
||
return data, nil | ||
} | ||
|
||
func (a *MeasurementFamilyService) UpdateMeasurementFamilies(families []MeasurementFamily) (*[]MeasurementFamilyPatchResponse, error) { | ||
response := new([]MeasurementFamilyPatchResponse) | ||
err := a.client.PATCH( | ||
measurementFamilyPath, | ||
nil, | ||
families, | ||
response, | ||
) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return response, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.