Skip to content

Commit faa5e3e

Browse files
authored
Merge pull request #90 from deploymenttheory/dev
Dev
2 parents 234e4d9 + d06e798 commit faa5e3e

File tree

1 file changed

+7
-24
lines changed

1 file changed

+7
-24
lines changed

README.md

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ This client leverages API-specific SDKs to provide a comprehensive and consisten
1616
- **Header Management**: Easy and efficient management of HTTP request headers, ensuring compliance with API requirements.
1717
- **Enhanced Logging with Zap**: Utilizes Uber's zap library for structured, high-performance logging, offering levels from Debug to Fatal, including structured context and dynamic adjustment based on the environment.
1818
- **API Handler Interface**: Provides a flexible and extensible way to interact with different APIs, including encoding and decoding requests and responses, managing authentication endpoints, and handling API-specific logic.
19+
- **Configuration via JSON or Environment Variables**: The Go API HTTP Client supports configuration via JSON files or environment variables, providing flexibility in defining authentication credentials, API endpoints, logging settings, and other parameters.
1920

2021
## API Handler
2122

@@ -45,39 +46,21 @@ Example usage with a configuration file:
4546
package main
4647

4748
import (
49+
"encoding/xml"
4850
"fmt"
4951
"log"
5052

51-
"github.com/deploymenttheory/go-api-http-client/httpclient"
5253
"github.com/deploymenttheory/go-api-sdk-jamfpro/sdk/jamfpro"
5354
)
5455

5556
func main() {
56-
configFilePath := "/path/to/clientconfig.json"
57-
loadedConfig, err := jamfpro.LoadClientConfig(configFilePath)
58-
if err != nil {
59-
log.Fatalf("Failed to load client OAuth configuration: %v", err)
60-
}
61-
62-
config := httpclient.ClientConfig{
63-
Auth: httpclient.AuthConfig{
64-
ClientID: loadedConfig.Auth.ClientID,
65-
ClientSecret: loadedConfig.Auth.ClientSecret,
66-
},
67-
Environment: httpclient.EnvironmentConfig{
68-
APIType: loadedConfig.Environment.APIType,
69-
InstanceName: loadedConfig.Environment.InstanceName,
70-
},
71-
ClientOptions: httpclient.ClientOptions{
72-
LogLevel: loadedConfig.ClientOptions.LogLevel,
73-
HideSensitiveData: loadedConfig.ClientOptions.HideSensitiveData,
74-
LogOutputFormat: loadedConfig.ClientOptions.LogOutputFormat,
75-
},
76-
}
57+
// Define the path to the JSON configuration file
58+
configFilePath := "/path/to/your/clientconfig.json"
7759

78-
client, err := jamfpro.BuildClient(config)
60+
// Initialize the Jamf Pro client with the HTTP client configuration
61+
client, err := jamfpro.BuildClientWithConfigFile(configFilePath)
7962
if err != nil {
80-
log.Fatalf("Failed to create client: %v", err)
63+
log.Fatalf("Failed to initialize Jamf Pro client: %v", err)
8164
}
8265
}
8366

0 commit comments

Comments
 (0)