All URIs are relative to https://api.gitbook.com/v1
Method | HTTP request | Description |
---|---|---|
GetAuthenticatedUser | Get /user | Get profile of authenticated user |
GetUserById | Get /users/{userId} | Get a user by its ID |
ListSpacesForAuthenticatedUser | Get /user/spaces | List spaces for the authenticated user |
User GetAuthenticatedUser(ctx).Execute()
Get profile of authenticated user
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/GitbookIO/go-gitbook"
)
func main() {
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.UsersApi.GetAuthenticatedUser(context.Background()).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.GetAuthenticatedUser``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetAuthenticatedUser`: User
fmt.Fprintf(os.Stdout, "Response from `UsersApi.GetAuthenticatedUser`: %v\n", resp)
}
This endpoint does not need any parameter.
Other parameters are passed through a pointer to a apiGetAuthenticatedUserRequest struct via the builder pattern
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
User GetUserById(ctx, userId).Execute()
Get a user by its ID
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/GitbookIO/go-gitbook"
)
func main() {
userId := "userId_example" // string | The unique ID of the User
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.UsersApi.GetUserById(context.Background(), userId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.GetUserById``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetUserById`: User
fmt.Fprintf(os.Stdout, "Response from `UsersApi.GetUserById`: %v\n", resp)
}
Name | Type | Description | Notes |
---|---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
userId | string | The unique ID of the User |
Other parameters are passed through a pointer to a apiGetUserByIdRequest struct via the builder pattern
Name | Type | Description | Notes |
---|
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ListSpacesForAuthenticatedUser200Response ListSpacesForAuthenticatedUser(ctx).Page(page).Limit(limit).Execute()
List spaces for the authenticated user
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/GitbookIO/go-gitbook"
)
func main() {
page := "page_example" // string | Identifier of the page results to fetch. (optional)
limit := float32(8.14) // float32 | The number of results per page (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.UsersApi.ListSpacesForAuthenticatedUser(context.Background()).Page(page).Limit(limit).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.ListSpacesForAuthenticatedUser``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `ListSpacesForAuthenticatedUser`: ListSpacesForAuthenticatedUser200Response
fmt.Fprintf(os.Stdout, "Response from `UsersApi.ListSpacesForAuthenticatedUser`: %v\n", resp)
}
Other parameters are passed through a pointer to a apiListSpacesForAuthenticatedUserRequest struct via the builder pattern
Name | Type | Description | Notes |
---|---|---|---|
page | string | Identifier of the page results to fetch. | |
limit | float32 | The number of results per page |
ListSpacesForAuthenticatedUser200Response
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]