Skip to content

Commit

Permalink
Merge branch 'master' of /Users/degroff/dev/inversoft/fusionauth/go-c…
Browse files Browse the repository at this point in the history
…lient with conflicts.
  • Loading branch information
robotdan committed Jun 7, 2021
1 parent eab02a3 commit 25325b9
Show file tree
Hide file tree
Showing 3 changed files with 503 additions and 60 deletions.
2 changes: 1 addition & 1 deletion build.savant
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
savantVersion = "1.0.0"

project(group: "io.fusionauth", name: "go-client", version: "1.27.3", licenses: ["ApacheV2_0"]) {
project(group: "io.fusionauth", name: "go-client", version: "1.28.0", licenses: ["ApacheV2_0"]) {
workflow {
standard()
}
Expand Down
121 changes: 121 additions & 0 deletions pkg/fusionauth/Client.go
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,24 @@ func (c *FusionAuthClient) CreateUserConsent(userConsentId string, request UserC
return &resp, &errors, err
}

// CreateUserLink
// Link an external user from a 3rd party identity provider to a FusionAuth user.
// IdentityProviderLinkRequest request The request object that contains all of the information used to link the FusionAuth user.
func (c *FusionAuthClient) CreateUserLink(request IdentityProviderLinkRequest) (*IdentityProviderLinkResponse, *Errors, error) {
var resp IdentityProviderLinkResponse
var errors Errors

restClient := c.Start(&resp, &errors)
err := restClient.WithUri("/api/identity-provider/link").
WithJSONBody(request).
WithMethod(http.MethodPost).
Do()
if restClient.ErrorRef == nil {
return &resp, nil, err
}
return &resp, &errors, err
}

// CreateWebhook
// Creates a webhook. You can optionally specify an Id for the webhook, if not provided one will be generated.
// string webhookId (Optional) The Id for the webhook. If not provided a secure random UUID will be generated.
Expand Down Expand Up @@ -1431,6 +1449,28 @@ func (c *FusionAuthClient) DeleteUserActionReason(userActionReasonId string) (*B
return &resp, &errors, err
}

// DeleteUserLink
// Remove an existing link that has been made from a 3rd party identity provider to a FusionAuth user.
// string identityProviderId The unique Id of the identity provider.
// string identityProviderUserId The unique Id of the user in the 3rd party identity provider to unlink.
// string userId The unique Id of the FusionAuth user to unlink.
func (c *FusionAuthClient) DeleteUserLink(identityProviderId string, identityProviderUserId string, userId string) (*IdentityProviderLinkResponse, *Errors, error) {
var resp IdentityProviderLinkResponse
var errors Errors

restClient := c.Start(&resp, &errors)
err := restClient.WithUri("/api/identity-provider/link").
WithParameter("identityProviderId", identityProviderId).
WithParameter("identityProviderUserId", identityProviderUserId).
WithParameter("userId", userId).
WithMethod(http.MethodDelete).
Do()
if restClient.ErrorRef == nil {
return &resp, nil, err
}
return &resp, &errors, err
}

// DeleteUsers
// Deletes the users with the given ids, or users matching the provided JSON query or queryString.
// The order of preference is ids, query and then queryString, it is recommended to only provide one of the three for the request.
Expand Down Expand Up @@ -2593,6 +2633,28 @@ func (c *FusionAuthClient) Register(userId string, request RegistrationRequest)
return &resp, &errors, err
}

// Reindex
// Requests Elasticsearch to delete and rebuild the index for FusionAuth users or entities. Be very careful when running this request as it will
// increase the CPU and I/O load on your database until the operation completes. Generally speaking you do not ever need to run this operation unless
// instructed by FusionAuth support, or if you are migrating a database another system and you are not brining along the Elasticsearch index.
//
// You have been warned.
// ReindexRequest request The request that contains the index name.
func (c *FusionAuthClient) Reindex(request ReindexRequest) (*BaseHTTPResponse, *Errors, error) {
var resp BaseHTTPResponse
var errors Errors

restClient := c.Start(&resp, &errors)
err := restClient.WithUri("/api/system/reindex").
WithJSONBody(request).
WithMethod(http.MethodPost).
Do()
if restClient.ErrorRef == nil {
return &resp, nil, err
}
return &resp, &errors, err
}

// RemoveUserFromFamily
// Removes a user from the family with the given id.
// string familyId The id of the family to remove the user from.
Expand Down Expand Up @@ -3645,6 +3707,23 @@ func (c *FusionAuthClient) RetrieveRegistrationReport(applicationId string, star
return &resp, &errors, err
}

// RetrieveReindexStatus
// Retrieve the status of a re-index process. A status code of 200 indicates the re-index is in progress, a status code of
// 404 indicates no re-index is in progress.
func (c *FusionAuthClient) RetrieveReindexStatus() (*BaseHTTPResponse, *Errors, error) {
var resp BaseHTTPResponse
var errors Errors

restClient := c.Start(&resp, &errors)
err := restClient.WithUri("/api/system/reindex").
WithMethod(http.MethodGet).
Do()
if restClient.ErrorRef == nil {
return &resp, nil, err
}
return &resp, &errors, err
}

// RetrieveSystemConfiguration
// Retrieves the system configuration.
func (c *FusionAuthClient) RetrieveSystemConfiguration() (*SystemConfigurationResponse, error) {
Expand Down Expand Up @@ -3976,6 +4055,48 @@ func (c *FusionAuthClient) RetrieveUserInfoFromAccessToken(encodedJWT string) (*
return &resp, &errors, err
}

// RetrieveUserLink
// Retrieve a single Identity Provider user (link).
// string identityProviderId The unique Id of the identity provider.
// string identityProviderUserId The unique Id of the user in the 3rd party identity provider.
// string userId The unique Id of the FusionAuth user.
func (c *FusionAuthClient) RetrieveUserLink(identityProviderId string, identityProviderUserId string, userId string) (*IdentityProviderLinkResponse, *Errors, error) {
var resp IdentityProviderLinkResponse
var errors Errors

restClient := c.Start(&resp, &errors)
err := restClient.WithUri("/api/identity-provider/link").
WithParameter("identityProviderId", identityProviderId).
WithParameter("identityProviderUserId", identityProviderUserId).
WithParameter("userId", userId).
WithMethod(http.MethodGet).
Do()
if restClient.ErrorRef == nil {
return &resp, nil, err
}
return &resp, &errors, err
}

// RetrieveUserLinksByUserId
// Retrieve all Identity Provider users (links) for the user. Specify the optional identityProviderId to retrieve links for a particular IdP.
// string identityProviderId (Optional) The unique Id of the identity provider. Specify this value to reduce the links returned to those for a particular IdP.
// string userId The unique Id of the user.
func (c *FusionAuthClient) RetrieveUserLinksByUserId(identityProviderId string, userId string) (*IdentityProviderLinkResponse, *Errors, error) {
var resp IdentityProviderLinkResponse
var errors Errors

restClient := c.Start(&resp, &errors)
err := restClient.WithUri("/api/identity-provider/link").
WithParameter("identityProviderId", identityProviderId).
WithParameter("userId", userId).
WithMethod(http.MethodGet).
Do()
if restClient.ErrorRef == nil {
return &resp, nil, err
}
return &resp, &errors, err
}

// RetrieveUserLoginReport
// Retrieves the login report between the two instants for a particular user by Id. If you specify an application id, it will only return the
// login counts for that application.
Expand Down

0 comments on commit 25325b9

Please sign in to comment.