Documentation ¶
Index ¶
- type ApiKeyResponse
- type ApiKeyScopesResponse
- type ApiService
- func (c *ApiService) CreateApiKey(params *CreateApiKeyParam) (interface{}, error)
- func (c *ApiService) DeleteApiKey(params *DeleteApiKeyParam) (interface{}, error)
- func (c *ApiService) GetApiKey(params *GetApiKeyParam) (interface{}, error)
- func (c *ApiService) ListApiKey(params *ListApiKeyParam) (interface{}, error)
- func (c *ApiService) UpdateApiKey(params *UpdateApiKeyParam) (interface{}, error)
- func (c *ApiService) UpdateApiKeyName(params *UpdateApiKeyNameParam) (interface{}, error)
- type CreateApiKey201Response
- type CreateApiKeyParam
- type CreateApiKeyRequest
- type DeleteApiKeyParam
- type ErrorResponse
- type ErrorResponseErrorsInner
- type GetApiKey200Response
- type GetApiKeyParam
- type ListApiKey200Response
- type ListApiKeyParam
- type UpdateApiKeyNameParam
- func (params *UpdateApiKeyNameParam) SetApiKeyId(ApiKeyId string) *UpdateApiKeyNameParam
- func (params *UpdateApiKeyNameParam) SetOnbehalfof(Onbehalfof string) *UpdateApiKeyNameParam
- func (params *UpdateApiKeyNameParam) SetUpdateApiKeyNameRequest(UpdateApiKeyNameRequest UpdateApiKeyNameRequest) *UpdateApiKeyNameParam
- type UpdateApiKeyNameRequest
- type UpdateApiKeyParam
- type UpdateApiKeyRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiKeyResponse ¶
type ApiKeyResponse struct { // The ID of your API Key. ApiKeyId *string `json:"api_key_id,omitempty"` // The name of your API Key. Name *string `json:"name,omitempty"` }
ApiKeyResponse struct for ApiKeyResponse
type ApiKeyScopesResponse ¶
type ApiKeyScopesResponse struct { // The permissions this API Key has access to. Scopes *[]string `json:"scopes,omitempty"` // The ID of your API Key. ApiKeyId *string `json:"api_key_id,omitempty"` // The name of your API Key. Name *string `json:"name,omitempty"` }
ApiKeyScopesResponse struct for ApiKeyScopesResponse
type ApiService ¶
type ApiService struct {
// contains filtered or unexported fields
}
func NewApiService ¶
func NewApiService(requestHandler *sendgrid.RequestHandler) *ApiService
func NewApiServiceWithClient ¶
func NewApiServiceWithClient(client sendgrid.BaseClient) *ApiService
func (*ApiService) CreateApiKey ¶
func (c *ApiService) CreateApiKey(params *CreateApiKeyParam) (interface{}, error)
**This endpoint allows you to create a new API Key for the user.** To create your initial SendGrid API Key, you should [use the SendGrid App](https://app.sendgrid.com/settings/api_keys). Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management. A JSON request body containing a `name` property is required when making requests to this endpoint. If the number of maximum keys, 100, is reached, a `403` status will be returned. Though the `name` field is required, it does not need to be unique. A unique API key ID will be generated for each key you create and returned in the response body. It is not necessary to pass a `scopes` field to the API when creating a key, but you should be aware that omitting the `scopes` field from your request will create a key with \"Full Access\" permissions by default. See the [API Key Permissions List](https://docs.sendgrid.com/api-reference/how-to-use-the-sendgrid-v3-api/authorization) for all available scopes. An API key's scopes can be updated after creation using the \"Update API keys\" endpoint.
func (*ApiService) DeleteApiKey ¶
func (c *ApiService) DeleteApiKey(params *DeleteApiKeyParam) (interface{}, error)
**This endpoint allows you to revoke an existing API Key using an `api_key_id`** Authentications using a revoked API Key will fail after after some small propogation delay. If the API Key ID does not exist, a `404` status will be returned.
func (*ApiService) GetApiKey ¶
func (c *ApiService) GetApiKey(params *GetApiKeyParam) (interface{}, error)
**This endpoint allows you to retrieve a single API key using an `api_key_id`.** The endpoint will return a key's name, ID, and scopes. If the API Key ID does not, exist a `404` status will be returned. See the [API Key Permissions List](https://docs.sendgrid.com/api-reference/how-to-use-the-sendgrid-v3-api/authorization) for all available scopes. An API key's scopes can be updated after creation using the \"Update API keys\" endpoint.
func (*ApiService) ListApiKey ¶
func (c *ApiService) ListApiKey(params *ListApiKeyParam) (interface{}, error)
**This endpoint allows you to retrieve all API Keys that belong to the authenticated user.** A successful response from this API will include all available API keys' names and IDs. For security reasons, there is not a way to retrieve the key itself after it's created. If you lose your API key, you must create a new one. Only the \"Create API keys\" endpoint will return a key to you and only at the time of creation. An `api_key_id` can be used to update or delete the key, as well as retrieve the key's details, such as its scopes.
func (*ApiService) UpdateApiKey ¶
func (c *ApiService) UpdateApiKey(params *UpdateApiKeyParam) (interface{}, error)
**This endpoint allows you to update the name and scopes of a given API key.** You must pass this endpoint a JSON request body with a `name` field and a `scopes` array containing at least one scope. The `name` and `scopes` fields will be used to update the key associated with the `api_key_id` in the request URL. If you need to update a key's scopes only, pass the `name` field with the key's existing name; the `name` will not be modified. If you need to update a key's name only, use the \"Update API key name\" endpoint. See the [API Key Permissions List](https://docs.sendgrid.com/api-reference/how-to-use-the-sendgrid-v3-api/authorization) for all available scopes.
func (*ApiService) UpdateApiKeyName ¶
func (c *ApiService) UpdateApiKeyName(params *UpdateApiKeyNameParam) (interface{}, error)
**This endpoint allows you to update the name of an existing API Key.** You must pass this endpoint a JSON request body with a `name` property, which will be used to rename the key associated with the `api_key_id` passed in the URL.
type CreateApiKey201Response ¶
type CreateApiKey201Response struct { ApiKey *string `json:"api_key,omitempty"` ApiKeyId *string `json:"api_key_id,omitempty"` Name *string `json:"name,omitempty"` Scopes *[]string `json:"scopes,omitempty"` }
CreateApiKey201Response struct for CreateApiKey201Response
type CreateApiKeyParam ¶
type CreateApiKeyParam struct { // The `on-behalf-of` header allows you to make API calls from a parent account on behalf of the parent's Subusers or customer accounts. You will use the parent account's API key when using this header. When making a call on behalf of a customer account, the property value should be \"account-id\" followed by the customer account's ID (e.g., `on-behalf-of: account-id <account-id>`). When making a call on behalf of a Subuser, the property value should be the Subuser's username (e.g., `on-behalf-of: <subuser-username>`). See [**On Behalf Of**](https://docs.sendgrid.com/api-reference/how-to-use-the-sendgrid-v3-api/on-behalf-of) for more information. Onbehalfof *string `json:"on-behalf-of,omitempty"` // CreateApiKeyRequest *CreateApiKeyRequest `json:"CreateApiKeyRequest,omitempty"` }
func (*CreateApiKeyParam) SetCreateApiKeyRequest ¶
func (params *CreateApiKeyParam) SetCreateApiKeyRequest(CreateApiKeyRequest CreateApiKeyRequest) *CreateApiKeyParam
func (*CreateApiKeyParam) SetOnbehalfof ¶
func (params *CreateApiKeyParam) SetOnbehalfof(Onbehalfof string) *CreateApiKeyParam
type CreateApiKeyRequest ¶
type CreateApiKeyRequest struct { // The name you will use to describe this API Key. Name string `json:"name"` // The individual permissions that you are giving to this API Key. Scopes *[]string `json:"scopes,omitempty"` }
CreateApiKeyRequest struct for CreateApiKeyRequest
type DeleteApiKeyParam ¶
type DeleteApiKeyParam struct { // ApiKeyId *string `json:"api_key_id"` // The `on-behalf-of` header allows you to make API calls from a parent account on behalf of the parent's Subusers or customer accounts. You will use the parent account's API key when using this header. When making a call on behalf of a customer account, the property value should be \"account-id\" followed by the customer account's ID (e.g., `on-behalf-of: account-id <account-id>`). When making a call on behalf of a Subuser, the property value should be the Subuser's username (e.g., `on-behalf-of: <subuser-username>`). See [**On Behalf Of**](https://docs.sendgrid.com/api-reference/how-to-use-the-sendgrid-v3-api/on-behalf-of) for more information. Onbehalfof *string `json:"on-behalf-of,omitempty"` }
func (*DeleteApiKeyParam) SetApiKeyId ¶
func (params *DeleteApiKeyParam) SetApiKeyId(ApiKeyId string) *DeleteApiKeyParam
func (*DeleteApiKeyParam) SetOnbehalfof ¶
func (params *DeleteApiKeyParam) SetOnbehalfof(Onbehalfof string) *DeleteApiKeyParam
type ErrorResponse ¶
type ErrorResponse struct { Errors *[]ErrorResponseErrorsInner `json:"errors,omitempty"` // When applicable, this property value will be an error ID. Id *string `json:"id,omitempty"` }
ErrorResponse struct for ErrorResponse
type ErrorResponseErrorsInner ¶
type ErrorResponseErrorsInner struct { // An error message. Message *string `json:"message,omitempty"` // When applicable, this property value will be the field that generated the error. Field *string `json:"field,omitempty"` // When applicable, this property value will be helper text or a link to documentation to help you troubleshoot the error. Help *map[string]interface{} `json:"help,omitempty"` }
ErrorResponseErrorsInner struct for ErrorResponseErrorsInner
type GetApiKey200Response ¶
type GetApiKey200Response struct {
Result *[]ApiKeyScopesResponse `json:"result,omitempty"`
}
GetApiKey200Response struct for GetApiKey200Response
type GetApiKeyParam ¶
type GetApiKeyParam struct { // ApiKeyId *string `json:"api_key_id"` // The `on-behalf-of` header allows you to make API calls from a parent account on behalf of the parent's Subusers or customer accounts. You will use the parent account's API key when using this header. When making a call on behalf of a customer account, the property value should be \"account-id\" followed by the customer account's ID (e.g., `on-behalf-of: account-id <account-id>`). When making a call on behalf of a Subuser, the property value should be the Subuser's username (e.g., `on-behalf-of: <subuser-username>`). See [**On Behalf Of**](https://docs.sendgrid.com/api-reference/how-to-use-the-sendgrid-v3-api/on-behalf-of) for more information. Onbehalfof *string `json:"on-behalf-of,omitempty"` }
func (*GetApiKeyParam) SetApiKeyId ¶
func (params *GetApiKeyParam) SetApiKeyId(ApiKeyId string) *GetApiKeyParam
func (*GetApiKeyParam) SetOnbehalfof ¶
func (params *GetApiKeyParam) SetOnbehalfof(Onbehalfof string) *GetApiKeyParam
type ListApiKey200Response ¶
type ListApiKey200Response struct {
Result *[]ApiKeyResponse `json:"result,omitempty"`
}
ListApiKey200Response struct for ListApiKey200Response
type ListApiKeyParam ¶
type ListApiKeyParam struct { // Limit *int32 `json:"limit,omitempty"` // The `on-behalf-of` header allows you to make API calls from a parent account on behalf of the parent's Subusers or customer accounts. You will use the parent account's API key when using this header. When making a call on behalf of a customer account, the property value should be \"account-id\" followed by the customer account's ID (e.g., `on-behalf-of: account-id <account-id>`). When making a call on behalf of a Subuser, the property value should be the Subuser's username (e.g., `on-behalf-of: <subuser-username>`). See [**On Behalf Of**](https://docs.sendgrid.com/api-reference/how-to-use-the-sendgrid-v3-api/on-behalf-of) for more information. Onbehalfof *string `json:"on-behalf-of,omitempty"` }
func (*ListApiKeyParam) SetLimit ¶
func (params *ListApiKeyParam) SetLimit(Limit int32) *ListApiKeyParam
func (*ListApiKeyParam) SetOnbehalfof ¶
func (params *ListApiKeyParam) SetOnbehalfof(Onbehalfof string) *ListApiKeyParam
type UpdateApiKeyNameParam ¶
type UpdateApiKeyNameParam struct { // ApiKeyId *string `json:"api_key_id"` // The `on-behalf-of` header allows you to make API calls from a parent account on behalf of the parent's Subusers or customer accounts. You will use the parent account's API key when using this header. When making a call on behalf of a customer account, the property value should be \"account-id\" followed by the customer account's ID (e.g., `on-behalf-of: account-id <account-id>`). When making a call on behalf of a Subuser, the property value should be the Subuser's username (e.g., `on-behalf-of: <subuser-username>`). See [**On Behalf Of**](https://docs.sendgrid.com/api-reference/how-to-use-the-sendgrid-v3-api/on-behalf-of) for more information. Onbehalfof *string `json:"on-behalf-of,omitempty"` // UpdateApiKeyNameRequest *UpdateApiKeyNameRequest `json:"UpdateApiKeyNameRequest,omitempty"` }
func (*UpdateApiKeyNameParam) SetApiKeyId ¶
func (params *UpdateApiKeyNameParam) SetApiKeyId(ApiKeyId string) *UpdateApiKeyNameParam
func (*UpdateApiKeyNameParam) SetOnbehalfof ¶
func (params *UpdateApiKeyNameParam) SetOnbehalfof(Onbehalfof string) *UpdateApiKeyNameParam
func (*UpdateApiKeyNameParam) SetUpdateApiKeyNameRequest ¶
func (params *UpdateApiKeyNameParam) SetUpdateApiKeyNameRequest(UpdateApiKeyNameRequest UpdateApiKeyNameRequest) *UpdateApiKeyNameParam
type UpdateApiKeyNameRequest ¶
type UpdateApiKeyNameRequest struct { // The new name of the API Key. Name string `json:"name"` }
UpdateApiKeyNameRequest struct for UpdateApiKeyNameRequest
type UpdateApiKeyParam ¶
type UpdateApiKeyParam struct { // ApiKeyId *string `json:"api_key_id"` // The `on-behalf-of` header allows you to make API calls from a parent account on behalf of the parent's Subusers or customer accounts. You will use the parent account's API key when using this header. When making a call on behalf of a customer account, the property value should be \"account-id\" followed by the customer account's ID (e.g., `on-behalf-of: account-id <account-id>`). When making a call on behalf of a Subuser, the property value should be the Subuser's username (e.g., `on-behalf-of: <subuser-username>`). See [**On Behalf Of**](https://docs.sendgrid.com/api-reference/how-to-use-the-sendgrid-v3-api/on-behalf-of) for more information. Onbehalfof *string `json:"on-behalf-of,omitempty"` // UpdateApiKeyRequest *UpdateApiKeyRequest `json:"UpdateApiKeyRequest,omitempty"` }
func (*UpdateApiKeyParam) SetApiKeyId ¶
func (params *UpdateApiKeyParam) SetApiKeyId(ApiKeyId string) *UpdateApiKeyParam
func (*UpdateApiKeyParam) SetOnbehalfof ¶
func (params *UpdateApiKeyParam) SetOnbehalfof(Onbehalfof string) *UpdateApiKeyParam
func (*UpdateApiKeyParam) SetUpdateApiKeyRequest ¶
func (params *UpdateApiKeyParam) SetUpdateApiKeyRequest(UpdateApiKeyRequest UpdateApiKeyRequest) *UpdateApiKeyParam
type UpdateApiKeyRequest ¶
type UpdateApiKeyRequest struct { Name string `json:"name"` Scopes *[]string `json:"scopes,omitempty"` }
UpdateApiKeyRequest struct for UpdateApiKeyRequest
Source Files ¶
- api_create_api_key.go
- api_delete_api_key.go
- api_get_api_key.go
- api_list_api_key.go
- api_service.go
- api_update_api_key.go
- api_update_api_key_name.go
- model_api_key_response.go
- model_api_key_scopes_response.go
- model_create_api_key_201_response.go
- model_create_api_key_request.go
- model_error_response.go
- model_error_response_errors_inner.go
- model_get_api_key_200_response.go
- model_list_api_key_200_response.go
- model_update_api_key_name_request.go
- model_update_api_key_request.go