onelogin / onelogin-go-sdk

golang sdk for onelogin apis
MIT License
10 stars 24 forks source link

Missing apps for users API #45

Closed zinaliker closed 2 years ago

zinaliker commented 2 years ago

Hi, How can I get the applications associate with users with your client sdk?

Thanks in advanced

bzvestey commented 2 years ago

Hello, taking a look at this it does seem that we are missing this. As seen here we have an endpoint for this, but I am not seeing it in the SDK.

Two things for this:

  1. I will add this to the list and see about getting it added to the SDK.
  2. Until this can be added you can use the following code load this information:
    
    // To make the call on your side, the userId variable needs to be the ID of the user you want to load the apps for.
    apps, err := olc.Services.HTTPService.Read(olhttp.OLHTTPRequest{
    URL:        fmt.Sprintf("%s/%d/apps", olc.Services.UsersV2.Endpoint, userId),
    Headers:    map[string]string{"Content-Type": "application/json"},
    AuthMethod: "bearer",
    })
    if err != nil {
    return errors.Wrap(err, "Failed to load the user apps.")
    }

// This is a paged endpoint, and the read will keep pulling until all the results are pulled back from the server. // An array is returned with byte arrays representing each response back from the server that are JSON that // should look like the expected output from the link above. for _, v := range apps { fmt.Println(string(v)) }

bzvestey commented 2 years ago

Planning to cut a new version with this later today.

bzvestey commented 2 years ago

Added in release v1.1.20