Skip to content
This repository has been archived by the owner on Nov 12, 2021. It is now read-only.

Latest commit

 

History

History
256 lines (188 loc) · 8.38 KB

UsersApi.md

File metadata and controls

256 lines (188 loc) · 8.38 KB

\UsersApi

Method HTTP request Description
CreateUser Post /users Create user
DeleteUser Delete /users/{user_guid} Delete user
ListUsers Get /users List users
ReadUser Get /users/{user_guid} Read user
UpdateUser Put /users/{user_guid} Update user

CreateUser

UserResponseBody CreateUser(ctx, body) Create user

Call this endpoint to create a new user. Atrium will respond with the newly-created user object if successful. This endpoint accepts several parameters: identifier, metadata, and is_disabled.
Disabling a user means that accounts and transactions associated with it will not be updated in the background by MX. It will also restrict access to that user's data until they are no longer disabled. Users who are disabled for the entirety of an Atrium billing period will not be factored into that month's bill.

Example

package main

import (
  "context"
  "fmt"
  "github.com/mxenabled/atrium-go"
)

func main() {
  client := atrium.AtriumClient("YOUR_API_KEY", "YOUR_CLIENT_ID")
  ctx := context.Background()
  
  body := atrium.UserCreateRequestBody{} // UserCreateRequestBody | User object to be created with optional parameters (identifier, is_disabled, metadata)

  response, _, err := client.Users.CreateUser(ctx, body)
  if err != nil {
    fmt.Printf("Error: %v\n", err)
  } else {
    fmt.Printf("Response: %s\n", response)
  }
}

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
body UserCreateRequestBody User object to be created with optional parameters (identifier, is_disabled, metadata)

Return type

UserResponseBody

[Back to top] [Back to API list] [Back to Model list] [Back to README]

DeleteUser

DeleteUser(ctx, userGUID) Delete user

Calling this endpoint will permanently delete a user from Atrium. If successful, the API will respond with Status: 204 No Content.

Example

package main

import (
  "context"
  "fmt"
  "github.com/mxenabled/atrium-go"
)

func main() {
  client := atrium.AtriumClient("YOUR_API_KEY", "YOUR_CLIENT_ID")
  ctx := context.Background()
  
  userGUID := "USR-123" // string | The unique identifier for a `user`.

  response, _, err := client.Users.DeleteUser(ctx, userGUID, )
  if err != nil {
    fmt.Printf("Error: %v\n", err)
  } else {
    fmt.Printf("Response: %s\n", response)
  }
}

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
userGUID string The unique identifier for a `user`.

Return type

(empty response body)

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListUsers

UsersResponseBody ListUsers(ctx, optional) List users

Use this endpoint to list every user you've created in Atrium.

Example

package main

import (
  "context"
  "fmt"
  "github.com/mxenabled/atrium-go"
  "github.com/antihax/optional"
)

func main() {
  client := atrium.AtriumClient("YOUR_API_KEY", "YOUR_CLIENT_ID")
  ctx := context.Background()
  
  opts := &atrium.ListUsersOpts{ 
    Page: optional.NewInt32(1), // int32 | Specify current page.
    RecordsPerPage: optional.NewInt32(12), // int32 | Specify records per page.
  }

  response, _, err := client.Users.ListUsers(ctx, opts)
  if err != nil {
    fmt.Printf("Error: %v\n", err)
  } else {
    fmt.Printf("Response: %s\n", response)
  }
}

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
optional *ListUsersOpts optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a pointer to a ListUsersOpts struct

Name Type Description Notes
page optional.Int32 Specify current page.
recordsPerPage optional.Int32 Specify records per page.

Return type

UsersResponseBody

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ReadUser

UserResponseBody ReadUser(ctx, userGUID) Read user

Use this endpoint to read the attributes of a specific user.

Example

package main

import (
  "context"
  "fmt"
  "github.com/mxenabled/atrium-go"
)

func main() {
  client := atrium.AtriumClient("YOUR_API_KEY", "YOUR_CLIENT_ID")
  ctx := context.Background()
  
  userGUID := "USR-123" // string | The unique identifier for a `user`.

  response, _, err := client.Users.ReadUser(ctx, userGUID, )
  if err != nil {
    fmt.Printf("Error: %v\n", err)
  } else {
    fmt.Printf("Response: %s\n", response)
  }
}

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
userGUID string The unique identifier for a `user`.

Return type

UserResponseBody

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UpdateUser

UserResponseBody UpdateUser(ctx, userGUID, optional) Update user

Use this endpoint to update the attributes of a specific user. Atrium will respond with the updated user object.
Disabling a user means that accounts and transactions associated with it will not be updated in the background by MX. It will also restrict access to that user's data until they are no longer disabled. Users who are disabled for the entirety of an Atrium billing period will not be factored into that month's bill.
To disable a user, update it and set the is_disabled parameter to true. Set it to false to re-enable the user.

Example

package main

import (
  "context"
  "fmt"
  "github.com/mxenabled/atrium-go"
  "github.com/antihax/optional"
)

func main() {
  client := atrium.AtriumClient("YOUR_API_KEY", "YOUR_CLIENT_ID")
  ctx := context.Background()
  
  userGUID := "USR-123" // string | The unique identifier for a `user`.
  opts := &atrium.UpdateUserOpts{ 
    Body: optional.NewInterface(atrium.UserUpdateRequestBody{}), // UserUpdateRequestBody | User object to be updated with optional parameters (identifier, is_disabled, metadata)
  }

  response, _, err := client.Users.UpdateUser(ctx, userGUID, , opts)
  if err != nil {
    fmt.Printf("Error: %v\n", err)
  } else {
    fmt.Printf("Response: %s\n", response)
  }
}

Required Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
userGUID string The unique identifier for a `user`.
optional *UpdateUserOpts optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a pointer to a UpdateUserOpts struct

Name Type Description Notes

body | optional.Interface of UserUpdateRequestBody| User object to be updated with optional parameters (identifier, is_disabled, metadata) |

Return type

UserResponseBody

[Back to top] [Back to API list] [Back to Model list] [Back to README]