Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #54

Open
wants to merge 2 commits into
base: latest
Choose a base branch
from
Open
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
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,15 @@ import (
"context"
"fmt"

jcapiv2 "github.com/TheJumpCloud/jcapi-go/v2"
jcapiv2 "github.com/TheJumpCloud/jcapi-go/jcapiv2"
"github.com/antihax/optional"
)

func main() {
apiKey := "YOUR_API_KEY"
XOrgId := "YOUR_ORG_ID"
userGroupID := "YOUR_GROUP_ID"

contentType := "application/json"
accept := "application/json"

// Instantiate the API client
client := jcapiv2.NewAPIClient(jcapiv2.NewConfiguration())

Expand All @@ -57,7 +56,7 @@ func main() {
})

// Make an API call to retrieve a specific user group by ID
userGroup, res, err := client.UserGroupsApi.GroupsUserGet(auth, userGroupID, contentType, accept, nil)
userGroup, res, err := client.UserGroupsApi.GroupsUserGet(auth, userGroupID, &jcapiv2.UserGroupsApiGroupsUserGetOpts{XOrgId: optional.NewString(XOrgId)})
if err != nil {
fmt.Printf("Error retrieving user group %s: %s - response = %+v\n", userGroupID, err, res)
} else {
Expand Down
3 changes: 3 additions & 0 deletions hello-world/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/TheJumpCloud/jcapi-go/hello-world

go 1.18
6 changes: 6 additions & 0 deletions hello-world/go.work
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
go 1.18

use (
.
../jcapiv2
)
31 changes: 31 additions & 0 deletions hello-world/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package main

import (
"context"
"fmt"

jcapiv2 "github.com/TheJumpCloud/jcapi-go/jcapiv2"
"github.com/antihax/optional"
)

func main() {
apiKey := "YOUR_API_KEY"
XOrgId := "YOUR_ORG_ID"
userGroupID := "YOUR_GROUP_ID"

// Instantiate the API client
client := jcapiv2.NewAPIClient(jcapiv2.NewConfiguration())

// Set up the API key via context
auth := context.WithValue(context.TODO(), jcapiv2.ContextAPIKey, jcapiv2.APIKey{
Key: apiKey,
})

// Make an API call to retrieve a specific user group by ID
userGroup, res, err := client.UserGroupsApi.GroupsUserGet(auth, userGroupID, &jcapiv2.UserGroupsApiGroupsUserGetOpts{XOrgId: optional.NewString(XOrgId)})
if err != nil {
fmt.Printf("Error retrieving user group %s: %s - response = %+v\n", userGroupID, err, res)
} else {
fmt.Printf("Details for User group %s: %+v\n", userGroupID, userGroup)
}
}
27 changes: 27 additions & 0 deletions hello-world/notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

# Setup "hello-world" project

1. Created directory `hello-world`
2. `cd hello-world`
3. Created file `go.work` to point module to local version of SDK
4. Created file `main.go` and populated with example from main [README.md](https://github.com/TheJumpCloud/jcapi-go/tree/latest)
5. Created "go.mod" file by running `go mod init github.com/TheJumpCloud/jcapi-go/hello-world`
6. Ran `go mod tidy` as prompt suggests
7. Run `go run main.go` to execute program

# SDK fixes

1. `cd jcapiv2`
2. Run `go mod init github.com/TheJumpCloud/jcapi-go/jcapiv2`
3. Run `go mod tidy`
4. Run `cd ../hello-world; go run main.go;` but found errors
1. Error: `undefined: os` to fix I opened each file, saved it, and let linting do its magic
1. `../jcapi-go/jcapiv2/api_logos.go`
2. `../jcapi-go/jcapiv2/api_managed_service_provider.go`
3. `../jcapi-go/jcapiv2/api_providers.go`
5. Made some fixes in the example `../hello-world/main.go`
6. It worked! `Details for User group 635ac16209b40b00016188f1: {Attributes:0xc000189ef0 Description: Email: Id:635ac16209b40b00016188f1 MemberQuery:<nil> MemberQueryExemptions:[] MemberSuggestionsNotify:false MembershipAutomated:false Name:PesterTest_UserGroup SuggestionCounts:<nil> Type_:user_group}`

# Misc.

The VSCode linter still is reporting a lot of errors that probably need to be fixed.
57 changes: 29 additions & 28 deletions jcapiv2/api_logos.go

Large diffs are not rendered by default.

880 changes: 445 additions & 435 deletions jcapiv2/api_managed_service_provider.go

Large diffs are not rendered by default.

3,853 changes: 1,945 additions & 1,908 deletions jcapiv2/api_providers.go

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions jcapiv2/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module github.com/TheJumpCloud/jcapi-go/jcapiv2

go 1.18

require (
github.com/antihax/optional v1.0.0
golang.org/x/oauth2 v0.1.0
)

require (
github.com/golang/protobuf v1.5.2 // indirect
golang.org/x/net v0.1.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.0 // indirect
)
25 changes: 25 additions & 0 deletions jcapiv2/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0=
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
golang.org/x/oauth2 v0.1.0 h1:isLCZuhj4v+tYv7eskaN4v/TM+A1begWWgyVJDdl1+Y=
golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=