Skip to content

Commit

Permalink
Merge pull request #141 from hanix/master
Browse files Browse the repository at this point in the history
added mobilegw endpoints
  • Loading branch information
iljaSL committed Nov 9, 2023
2 parents 6538865 + edc1db9 commit cbb526a
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 0 deletions.
18 changes: 18 additions & 0 deletions api/auth/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,21 @@ func (store *Auth) Logout() error {
Post(nil)
return err
}

func (store *Auth) GetUserPairedDevices(userID string) (*PairedDevices, error) {
devices := &PairedDevices{}

_, err := store.api.
URL("/auth/api/v1/users/%s/devices", userID).
Get(devices)

return devices, err
}

func (store *Auth) UnpairUserDevice(userID, deviceID string) error {
_, err := store.api.
URL("/auth/api/v1/users/%s/devices/%s", userID, deviceID).
Delete()

return err
}
14 changes: 14 additions & 0 deletions api/auth/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,17 @@ type SearchParams struct {
UserID string `json:"user_id,omitempty"`
Type string `json:"type,omitempty"`
}

type Device struct {
ID string `json:"id"`
OS string `json:"os"`
Name string `json:"name"`
Activated string `json:"activated"`
Updated string `json:"updated"`
LastUsed string `json:"lastUsed"`
}

type PairedDevices struct {
Count int `json:"count"`
Items []Device `json:"items"`
}
29 changes: 29 additions & 0 deletions api/licensemanager/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,32 @@ func (store *LicenseManager) License() (*License, error) {

return license, err
}

// Register PrivX instance to mobilegw
func (store *LicenseManager) RegisterToMobileGW() error {
_, err := store.api.
URL("/license-manager/api/v1/mobilegw/register").
Post(nil)

return err
}

// Unregister PrivX instance from mobilegw
func (store *LicenseManager) UnregisterToMobileGW() error {
_, err := store.api.
URL("/license-manager/api/v1/mobilegw/unregister").
Delete(nil)

return err
}

// Get PrivX registration status to mobilegw
func (store *LicenseManager) GetMobileGwRegistration() (*RegistrationStatus, error) {
status := &RegistrationStatus{}

_, err := store.api.
URL("/license-manager/api/v1/mobilegw/status").
Get(status)

return status, err
}
8 changes: 8 additions & 0 deletions api/licensemanager/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

package licensemanager

import "github.com/SSHcom/privx-sdk-go/api/rolestore"

// License license definition
type License struct {
LicenseStatus string `json:"license_status,omitempty"`
Expand Down Expand Up @@ -35,3 +37,9 @@ type License struct {
AuditHostsInUse int `json:"audit_hosts_in_use,omitempty"`
UsersInUse int `json:"users_in_use,omitempty"`
}

type RegistrationStatus struct {
Status string `json:"status"`
UsedSources []rolestore.Source `json:"used_sources"`
ProductId string `json:"product_id"`
}

0 comments on commit cbb526a

Please sign in to comment.