GoodMem
ReferenceClient SDKsGo SDK

Users API

Users API documentation for Go SDK

All URIs are relative to http://localhost:8080

MethodHTTP requestDescription
GetCurrentUserGet /v1/users/meGet current user profile
GetUserGet /v1/users/{id}Get a user by ID
GetUserByEmailGet /v1/users/email/{email}Get user by email address

GetCurrentUser

UserResponse GetCurrentUser(ctx).Execute()

Get current user profile

Example

package main

import (
	"context"
	"fmt"
	"os"
	goodmem_client "github.com/PAIR-Systems-Inc/goodmem/clients/go"
)

func main() {

	configuration := goodmem_client.NewConfiguration()
	apiClient := goodmem_client.NewAPIClient(configuration)
	resp, r, err := apiClient.UsersAPI.GetCurrentUser(context.Background()).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `UsersAPI.GetCurrentUser``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetCurrentUser`: UserResponse
	fmt.Fprintf(os.Stdout, "Response from `UsersAPI.GetCurrentUser`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiGetCurrentUserRequest struct via the builder pattern

Return type

UserResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

↑ Back to Go SDK ↑ Back to Go SDK ↑ Back to Go SDK

GetUser

UserResponse GetUser(ctx, id).Execute()

Get a user by ID

Example

package main

import (
	"context"
	"fmt"
	"os"
	goodmem_client "github.com/PAIR-Systems-Inc/goodmem/clients/go"
)

func main() {
	id := "550e8400-e29b-41d4-a716-446655440000" // string | The unique identifier of the user to retrieve

	configuration := goodmem_client.NewConfiguration()
	apiClient := goodmem_client.NewAPIClient(configuration)
	resp, r, err := apiClient.UsersAPI.GetUser(context.Background(), id).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `UsersAPI.GetUser``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetUser`: UserResponse
	fmt.Fprintf(os.Stdout, "Response from `UsersAPI.GetUser`: %v\n", resp)
}

Path Parameters

NameTypeDescriptionNotes
ctxcontext.Contextcontext for authentication, logging, cancellation, deadlines, tracing, etc.
idstringThe unique identifier of the user to retrieve

Other Parameters

Other parameters are passed through a pointer to a apiGetUserRequest struct via the builder pattern

NameTypeDescriptionNotes

Return type

UserResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

↑ Back to Go SDK ↑ Back to Go SDK ↑ Back to Go SDK

GetUserByEmail

UserResponse GetUserByEmail(ctx, email).Execute()

Get user by email address

Example

package main

import (
	"context"
	"fmt"
	"os"
	goodmem_client "github.com/PAIR-Systems-Inc/goodmem/clients/go"
)

func main() {
	email := "[email protected]" // string | The email address of the user to retrieve

	configuration := goodmem_client.NewConfiguration()
	apiClient := goodmem_client.NewAPIClient(configuration)
	resp, r, err := apiClient.UsersAPI.GetUserByEmail(context.Background(), email).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `UsersAPI.GetUserByEmail``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetUserByEmail`: UserResponse
	fmt.Fprintf(os.Stdout, "Response from `UsersAPI.GetUserByEmail`: %v\n", resp)
}

Path Parameters

NameTypeDescriptionNotes
ctxcontext.Contextcontext for authentication, logging, cancellation, deadlines, tracing, etc.
emailstringThe email address of the user to retrieve

Other Parameters

Other parameters are passed through a pointer to a apiGetUserByEmailRequest struct via the builder pattern

NameTypeDescriptionNotes

Return type

UserResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

↑ Back to Go SDK ↑ Back to Go SDK ↑ Back to Go SDK