Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 44 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,33 +271,26 @@ func main() {
return
}

design := accessgrid.TemplateDesign{
BackgroundColor: "#FFFFFF",
LabelColor: "#000000",
LabelSecondaryColor: "#333333",
BackgroundImage: "[image_in_base64_encoded_format]",
LogoImage: "[image_in_base64_encoded_format]",
IconImage: "[image_in_base64_encoded_format]",
}

supportInfo := accessgrid.SupportInfo{
SupportURL: "https://help.yourcompany.com",
SupportPhoneNumber: "+1-555-123-4567",
SupportEmail: "support@yourcompany.com",
PrivacyPolicyURL: "https://yourcompany.com/privacy",
TermsAndConditionsURL: "https://yourcompany.com/terms",
}

params := accessgrid.CreateTemplateParams{
Name: "Employee NFC key",
Platform: "apple",
UseCase: "employee_badge",
Protocol: "desfire",
Name: "Employee Access Pass",
Platform: "apple",
UseCase: "employee_badge",
Protocol: "desfire",
AllowOnMultipleDevices: true,
WatchCount: 2,
IPhoneCount: 3,
Design: design,
SupportInfo: supportInfo,
WatchCount: 2,
IPhoneCount: 3,
BackgroundColor: "#FFFFFF",
LabelColor: "#000000",
LabelSecondaryColor: "#333333",
SupportURL: "https://help.yourcompany.com",
SupportPhoneNumber: "+1-555-123-4567",
SupportEmail: "support@yourcompany.com",
PrivacyPolicyURL: "https://yourcompany.com/privacy",
TermsAndConditionsURL: "https://yourcompany.com/terms",
Metadata: map[string]interface{}{
"version": "2.1",
"approval_status": "approved",
},
}

ctx := context.Background()
Expand Down Expand Up @@ -488,6 +481,32 @@ The SDK automatically handles:

Never expose your `secretKey` in source code. Always use environment variables or a secure configuration management system.

## Feature Matrix

| Endpoint | Method | Supported |
|---|---|:---:|
| POST /v1/key-cards | `AccessCards.Provision()` | Y |
| GET /v1/key-cards/{id} | `AccessCards.Get()` | Y |
| PATCH /v1/key-cards/{id} | `AccessCards.Update()` | Y |
| GET /v1/key-cards | `AccessCards.List()` | Y |
| POST /v1/key-cards/{id}/suspend | `AccessCards.Suspend()` | Y |
| POST /v1/key-cards/{id}/resume | `AccessCards.Resume()` | Y |
| POST /v1/key-cards/{id}/unlink | `AccessCards.Unlink()` | Y |
| POST /v1/key-cards/{id}/delete | `AccessCards.Delete()` | Y |
| POST /v1/console/card-templates | `Console.CreateTemplate()` | Y |
| PUT /v1/console/card-templates/{id} | `Console.UpdateTemplate()` | Y |
| GET /v1/console/card-templates/{id} | `Console.ReadTemplate()` | Y |
| GET /v1/console/card-templates/{id}/logs | `Console.EventLog()` | Y |
| GET /v1/console/pass-template-pairs | `Console.ListPassTemplatePairs()` | Y |
| POST /v1/console/card-templates/{id}/ios_preflight | `Console.IosPreflight()` | - |
| GET /v1/console/ledger-items | `Console.ListLedgerItems()` | Y |
| GET /v1/console/webhooks | `Console.Webhooks.List()` | - |
| POST /v1/console/webhooks | `Console.Webhooks.Create()` | - |
| DELETE /v1/console/webhooks/{id} | `Console.Webhooks.Delete()` | - |
| POST /v1/console/hid/orgs | `Console.HID.Orgs.Create()` | - |
| POST /v1/console/hid/orgs/activate | `Console.HID.Orgs.Activate()` | - |
| GET /v1/console/hid/orgs | `Console.HID.Orgs.List()` | - |

## License

MIT License - See LICENSE file for details.
27 changes: 19 additions & 8 deletions models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,25 @@ type SupportInfo struct {

// CreateTemplateParams defines parameters for creating a new template
type CreateTemplateParams struct {
Name string `json:"name"`
Platform string `json:"platform"`
UseCase string `json:"use_case"`
Protocol string `json:"protocol"`
WatchCount int `json:"watch_count"`
IPhoneCount int `json:"iphone_count"`
Design TemplateDesign `json:"design"`
SupportInfo SupportInfo `json:"support_info"`
Name string `json:"name"`
Platform string `json:"platform"`
UseCase string `json:"use_case"`
Protocol string `json:"protocol"`
AllowOnMultipleDevices bool `json:"allow_on_multiple_devices,omitempty"`
WatchCount int `json:"watch_count"`
IPhoneCount int `json:"iphone_count"`
BackgroundColor string `json:"background_color,omitempty"`
LabelColor string `json:"label_color,omitempty"`
LabelSecondaryColor string `json:"label_secondary_color,omitempty"`
BackgroundImage string `json:"background_image,omitempty"`
LogoImage string `json:"logo_image,omitempty"`
IconImage string `json:"icon_image,omitempty"`
SupportURL string `json:"support_url,omitempty"`
SupportPhoneNumber string `json:"support_phone_number,omitempty"`
SupportEmail string `json:"support_email,omitempty"`
PrivacyPolicyURL string `json:"privacy_policy_url,omitempty"`
TermsAndConditionsURL string `json:"terms_and_conditions_url,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}

// UpdateTemplateParams defines parameters for updating an existing template
Expand Down
41 changes: 19 additions & 22 deletions services/console_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,29 +157,26 @@ func TestConsoleService_CreateTemplate(t *testing.T) {
server, service := setupConsoleTestServer()
defer server.Close()

design := models.TemplateDesign{
BackgroundColor: "#FFFFFF",
LabelColor: "#000000",
LabelSecondaryColor: "#333333",
}

supportInfo := models.SupportInfo{
SupportURL: "https://help.example.com",
SupportPhoneNumber: "+1-555-123-4567",
SupportEmail: "support@example.com",
PrivacyPolicyURL: "https://example.com/privacy",
TermsAndConditionsURL: "https://example.com/terms",
}

params := models.CreateTemplateParams{
Name: "Employee NFC key",
Platform: "apple",
UseCase: "employee_badge",
Protocol: "desfire",
WatchCount: 2,
IPhoneCount: 3,
Design: design,
SupportInfo: supportInfo,
Name: "Employee NFC key",
Platform: "apple",
UseCase: "employee_badge",
Protocol: "desfire",
AllowOnMultipleDevices: true,
WatchCount: 2,
IPhoneCount: 3,
BackgroundColor: "#FFFFFF",
LabelColor: "#000000",
LabelSecondaryColor: "#333333",
SupportURL: "https://help.example.com",
SupportPhoneNumber: "+1-555-123-4567",
SupportEmail: "support@example.com",
PrivacyPolicyURL: "https://example.com/privacy",
TermsAndConditionsURL: "https://example.com/terms",
Metadata: map[string]interface{}{
"version": "2.1",
"approval_status": "approved",
},
}

ctx := context.Background()
Expand Down
Loading