-
Notifications
You must be signed in to change notification settings - Fork 8
/
internal_api.go
35 lines (28 loc) · 1.73 KB
/
internal_api.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package httpapi
import (
"context"
"encoding/json"
"fmt"
)
// WhoAmI returns the details for the user who is making the request
func WhoAmI(ctx context.Context, apiClient *Client) (*WhoAmIResponse, error) {
return ExecuteGet[WhoAmIResponse](ctx, apiClient, "accounts/user/v1/user:WhoAmI", nil)
}
// GetSheqsyCompany returns the details for the selected company
func GetSheqsyCompany(ctx context.Context, apiClient *Client, companyID string) (*GetSheqsyCompanyResponse, error) {
return ExecuteGet[GetSheqsyCompanyResponse](ctx, apiClient, fmt.Sprintf("/SheqsyIntegrationApi/api/v3/companies/%s", companyID), nil)
}
// GetRawInspection returns the JSON Raw Message of an inspection response
func GetRawInspection(ctx context.Context, apiClient *Client, id string) (*json.RawMessage, error) {
return ExecuteGet[json.RawMessage](ctx, apiClient, fmt.Sprintf("/audits/%s", id), nil)
}
// ListInspections retrieves the list of inspections from SafetyCulture
func ListInspections(ctx context.Context, apiClient *Client, params *ListInspectionsParams) (*ListInspectionsResponse, error) {
return ExecuteGet[ListInspectionsResponse](ctx, apiClient, "/audits/search", params)
}
func CheckInspectionReportExportCompletion(ctx context.Context, apiClient *Client, auditID string, messageID string) (*InspectionReportExportCompletionResponse, error) {
return ExecuteGet[InspectionReportExportCompletionResponse](ctx, apiClient, fmt.Sprintf("audits/%s/report/%s", auditID, messageID), nil)
}
func ListOrganisationActivityLog(ctx context.Context, apiClient *Client, request *GetAccountsActivityLogRequestParams) (*GetAccountsActivityLogResponse, error) {
return ExecutePost[GetAccountsActivityLogResponse](ctx, apiClient, "/accounts/history/v1/activity_log/list", request)
}