generated from deploymenttheory/Template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Refactor custom request handling to introduce graphcustom package; im…
…plement ByIDRequestUrlTemplate and PutRequestByResourceId functions for improved URL construction and PUT request management. Update existing CRUD operations to utilize new configurations, enhancing code organization and maintainability.
Showing
6 changed files
with
65 additions
and
63 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
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,27 @@ | ||
package graphcustom | ||
|
||
import "strings" | ||
|
||
// ByIDRequestUrlTemplate constructs a URL template for a single resource request using the provided configuration. | ||
// The function combines the endpoint path with a resource ID and optional suffix to create a complete URL template. | ||
// For example, if the config contains: | ||
// - Endpoint: "/deviceManagement/configurationPolicies" | ||
// - ResourceIDPattern: "('id')" | ||
// - ResourceID: "12345" | ||
// - EndpointSuffix: "/settings" | ||
// | ||
// The resulting template would be: "{+baseurl}/deviceManagement/configurationPolicies('12345')/settings" | ||
// | ||
// Parameters: | ||
// - reqConfig: GetRequestConfig containing the endpoint path, resource ID pattern, actual ID, and optional suffix | ||
// | ||
// Returns: | ||
// - string: The constructed URL template ready for use with the Kiota request adapter | ||
func ByIDRequestUrlTemplate(reqConfig GetRequestConfig) string { | ||
idFormat := strings.ReplaceAll(reqConfig.ResourceIDPattern, "id", reqConfig.ResourceID) | ||
endpoint := reqConfig.Endpoint + idFormat | ||
if reqConfig.EndpointSuffix != "" { | ||
endpoint += reqConfig.EndpointSuffix | ||
} | ||
return "{+baseurl}" + endpoint | ||
} |
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