Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helping get golint to 100%. #200

Merged
merged 15 commits into from
Oct 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions examples/accesssettings/accesssettings.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ package main

import (
"fmt"
"github.com/sendgrid/sendgrid-go"
"log"
"os"

"github.com/sendgrid/sendgrid-go"
)

// Retrieveallrecentaccessattempts Retrieve all recent access attempts
// Retrieveallrecentaccessattempts : Retrieve all recent access attempts
// GET /access_settings/activity
func Retrieveallrecentaccessattempts() {
apiKey := os.Getenv("YOUR_SENDGRID_APIKEY")
Expand All @@ -28,7 +27,7 @@ func Retrieveallrecentaccessattempts() {
}
}

// AddoneormoreIPstothewhitelist Add one or more IPs to the whitelist
// AddoneormoreIPstothewhitelist : Add one or more IPs to the whitelist
// POST /access_settings/whitelist
func AddoneormoreIPstothewhitelist() {
apiKey := os.Getenv("YOUR_SENDGRID_APIKEY")
Expand All @@ -39,10 +38,10 @@ func AddoneormoreIPstothewhitelist() {
"ips": [
{
"ip": "192.168.1.1"
},
},
{
"ip": "192.*.*.*"
},
},
{
"ip": "192.168.1.3/32"
}
Expand All @@ -58,7 +57,7 @@ func AddoneormoreIPstothewhitelist() {
}
}

// RetrievealistofcurrentlywhitelistedIPs Retrieve a list of currently whitelisted IPs
// RetrievealistofcurrentlywhitelistedIPs : Retrieve a list of currently whitelisted IPs
// GET /access_settings/whitelist
func RetrievealistofcurrentlywhitelistedIPs() {
apiKey := os.Getenv("YOUR_SENDGRID_APIKEY")
Expand All @@ -75,7 +74,7 @@ func RetrievealistofcurrentlywhitelistedIPs() {
}
}

// RemoveoneormoreIPsfromthewhitelist Remove one or more IPs from the whitelist
// RemoveoneormoreIPsfromthewhitelist : Remove one or more IPs from the whitelist
// DELETE /access_settings/whitelist
func RemoveoneormoreIPsfromthewhitelist() {
apiKey := os.Getenv("YOUR_SENDGRID_APIKEY")
Expand All @@ -84,8 +83,8 @@ func RemoveoneormoreIPsfromthewhitelist() {
request.Method = "DELETE"
request.Body = []byte(` {
"ids": [
1,
2,
1,
2,
3
]
}`)
Expand All @@ -99,7 +98,7 @@ func RemoveoneormoreIPsfromthewhitelist() {
}
}

// RetrieveaspecificwhitelistedIP Retrieve a specific whitelisted IP
// RetrieveaspecificwhitelistedIP : Retrieve a specific whitelisted IP
// GET /access_settings/whitelist/{rule_id}
func RetrieveaspecificwhitelistedIP() {
apiKey := os.Getenv("YOUR_SENDGRID_APIKEY")
Expand All @@ -116,7 +115,7 @@ func RetrieveaspecificwhitelistedIP() {
}
}

// RemoveaspecificIPfromthewhitelist Remove a specific IP from the whitelist
// RemoveaspecificIPfromthewhitelist : Remove a specific IP from the whitelist
// DELETE /access_settings/whitelist/{rule_id}
func RemoveaspecificIPfromthewhitelist() {
apiKey := os.Getenv("YOUR_SENDGRID_APIKEY")
Expand Down
17 changes: 8 additions & 9 deletions examples/alerts/alerts.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@ package main

import (
"fmt"
"github.com/sendgrid/sendgrid-go"
"log"
"os"

"github.com/sendgrid/sendgrid-go"
)

// CreateanewAlert Create a new Alert
// CreateanewAlert : Create a new Alert
// POST /alerts
func CreateanewAlert() {
apiKey := os.Getenv("YOUR_SENDGRID_APIKEY")
host := "https://api.sendgrid.com"
request := sendgrid.GetRequest(apiKey, "/v3/alerts", host)
request.Method = "POST"
request.Body = []byte(` {
"email_to": "[email protected]",
"frequency": "daily",
"email_to": "[email protected]",
"frequency": "daily",
"type": "stats_notification"
}`)
response, err := sendgrid.API(request)
Expand All @@ -30,7 +29,7 @@ func CreateanewAlert() {
}
}

// Retrieveallalerts Retrieve all alerts
// Retrieveallalerts : Retrieve all alerts
// GET /alerts
func Retrieveallalerts() {
apiKey := os.Getenv("YOUR_SENDGRID_APIKEY")
Expand All @@ -47,7 +46,7 @@ func Retrieveallalerts() {
}
}

// Updateanalert Update an alert
// Updateanalert : Update an alert
// PATCH /alerts/{alert_id}
func Updateanalert() {
apiKey := os.Getenv("YOUR_SENDGRID_APIKEY")
Expand All @@ -67,7 +66,7 @@ func Updateanalert() {
}
}

// Retrieveaspecificalert Retrieve a specific alert
// Retrieveaspecificalert : Retrieve a specific alert
// GET /alerts/{alert_id}
func Retrieveaspecificalert() {
apiKey := os.Getenv("YOUR_SENDGRID_APIKEY")
Expand All @@ -84,7 +83,7 @@ func Retrieveaspecificalert() {
}
}

// Deleteanalert Delete an alert
// Deleteanalert : Delete an alert
// DELETE /alerts/{alert_id}
func Deleteanalert() {
apiKey := os.Getenv("YOUR_SENDGRID_APIKEY")
Expand Down
27 changes: 13 additions & 14 deletions examples/apikeys/apikeys.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,24 @@ package main

import (
"fmt"
"github.com/sendgrid/sendgrid-go"
"log"
"os"

"github.com/sendgrid/sendgrid-go"
)

// CreateAPIkeys Create API keys
// CreateAPIkeys : Create API keys
// POST /api_keys
func CreateAPIkeys() {
apiKey := os.Getenv("YOUR_SENDGRID_APIKEY")
host := "https://api.sendgrid.com"
request := sendgrid.GetRequest(apiKey, "/v3/api_keys", host)
request.Method = "POST"
request.Body = []byte(` {
"name": "My API Key",
"sample": "data",
"name": "My API Key",
"sample": "data",
"scopes": [
"mail.send",
"alerts.create",
"mail.send",
"alerts.create",
"alerts.read"
]
}`)
Expand All @@ -34,7 +33,7 @@ func CreateAPIkeys() {
}
}

// RetrieveallAPIKeysbelongingtotheauthenticateduser Retrieve all API Keys belonging to the authenticated user
// RetrieveallAPIKeysbelongingtotheauthenticateduser : Retrieve all API Keys belonging to the authenticated user
// GET /api_keys
func RetrieveallAPIKeysbelongingtotheauthenticateduser() {
apiKey := os.Getenv("YOUR_SENDGRID_APIKEY")
Expand All @@ -54,17 +53,17 @@ func RetrieveallAPIKeysbelongingtotheauthenticateduser() {
}
}

// UpdatethenamescopesofanAPIKey Update the name & scopes of an API Key
// UpdatethenamescopesofanAPIKey : Update the name & scopes of an API Key
// PUT /api_keys/{api_key_id}
func UpdatethenamescopesofanAPIKey() {
apiKey := os.Getenv("YOUR_SENDGRID_APIKEY")
host := "https://api.sendgrid.com"
request := sendgrid.GetRequest(apiKey, "/v3/api_keys/{api_key_id}", host)
request.Method = "PUT"
request.Body = []byte(` {
"name": "A New Hope",
"name": "A New Hope",
"scopes": [
"user.profile.read",
"user.profile.read",
"user.profile.update"
]
}`)
Expand All @@ -78,7 +77,7 @@ func UpdatethenamescopesofanAPIKey() {
}
}

// UpdateAPIkeys Update API keys
// UpdateAPIkeys : Update API keys
// PATCH /api_keys/{api_key_id}
func UpdateAPIkeys() {
apiKey := os.Getenv("YOUR_SENDGRID_APIKEY")
Expand All @@ -98,7 +97,7 @@ func UpdateAPIkeys() {
}
}

// RetrieveanexistingAPIKey Retrieve an existing API Key
// RetrieveanexistingAPIKey : Retrieve an existing API Key
// GET /api_keys/{api_key_id}
func RetrieveanexistingAPIKey() {
apiKey := os.Getenv("YOUR_SENDGRID_APIKEY")
Expand All @@ -115,7 +114,7 @@ func RetrieveanexistingAPIKey() {
}
}

// DeleteAPIkeys Delete API keys
// DeleteAPIkeys : Delete API keys
// DELETE /api_keys/{api_key_id}
func DeleteAPIkeys() {
apiKey := os.Getenv("YOUR_SENDGRID_APIKEY")
Expand Down
Loading