This repository has been archived by the owner on Oct 21, 2024. It is now read-only.
-
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.
feat(BUX-500): add X-DeploymentID header Arc client option (#84)
* feat: add arc client headers * fix: fix the name of xdeployment-id header * feat: add required header for to all examples * docs: update readme
- Loading branch information
Showing
13 changed files
with
67 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package broadcast_client | ||
|
||
// ArcClientOptFunc defines an optional arguments that can be passed to the SubmitTransaction method. | ||
type ArcClientOptFunc func(o *ArcClientOpts) | ||
|
||
type ArcClientOpts struct { | ||
// XDeploymentID is the deployment id (id of instance using Arc API) that will be sent in the request header. | ||
XDeploymentID string | ||
} | ||
|
||
// GetApiUrl returns the API url. | ||
func (c *ArcClientOpts) GetArcClientHeaders() map[string]string { | ||
headers := make(map[string]string) | ||
if c.XDeploymentID != "" { | ||
headers["XDeployment-ID"] = c.XDeploymentID | ||
} | ||
|
||
return headers | ||
} | ||
|
||
// WithXDeploymentID is an option that allows you to set the deployment id (id of instance using Arc API) that will be sent in the request header. | ||
func WithXDeploymentID(deploymentID string) ArcClientOptFunc { | ||
return func(o *ArcClientOpts) { | ||
o.XDeploymentID = deploymentID | ||
} | ||
} |
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
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
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