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

Fixing golint and gofmt errors #148

Merged
merged 2 commits into from
Oct 24, 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
35 changes: 12 additions & 23 deletions examples/accesssettings/accesssettings.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ package main

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

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

///////////////////////////////////////////////////
// Retrieve all recent access attempts
// Retrieveallrecentaccessattempts Retrieve all recent access attempts
// GET /access_settings/activity

func Retrieveallrecentaccessattempts() {
apiKey := os.Getenv("YOUR_SENDGRID_APIKEY")
host := "https://api.sendgrid.com"
Expand All @@ -29,10 +28,8 @@ func Retrieveallrecentaccessattempts() {
}
}

///////////////////////////////////////////////////
// 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")
host := "https://api.sendgrid.com"
Expand All @@ -42,10 +39,10 @@ func AddoneormoreIPstothewhitelist() {
"ips": [
{
"ip": "192.168.1.1"
},
},
{
"ip": "192.*.*.*"
},
},
{
"ip": "192.168.1.3/32"
}
Expand All @@ -61,10 +58,8 @@ func AddoneormoreIPstothewhitelist() {
}
}

///////////////////////////////////////////////////
// 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")
host := "https://api.sendgrid.com"
Expand All @@ -80,19 +75,17 @@ func RetrievealistofcurrentlywhitelistedIPs() {
}
}

///////////////////////////////////////////////////
// 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")
host := "https://api.sendgrid.com"
request := sendgrid.GetRequest(apiKey, "/v3/access_settings/whitelist", host)
request.Method = "DELETE"
request.Body = []byte(` {
"ids": [
1,
2,
1,
2,
3
]
}`)
Expand All @@ -106,10 +99,8 @@ func RemoveoneormoreIPsfromthewhitelist() {
}
}

///////////////////////////////////////////////////
// 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")
host := "https://api.sendgrid.com"
Expand All @@ -125,10 +116,8 @@ func RetrieveaspecificwhitelistedIP() {
}
}

///////////////////////////////////////////////////
// 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")
host := "https://api.sendgrid.com"
Expand Down
27 changes: 9 additions & 18 deletions examples/alerts/alerts.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,22 @@ package main

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

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

///////////////////////////////////////////////////
// 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 @@ -31,10 +30,8 @@ func CreateanewAlert() {
}
}

///////////////////////////////////////////////////
// Retrieve all alerts
// Retrieveallalerts Retrieve all alerts
// GET /alerts

func Retrieveallalerts() {
apiKey := os.Getenv("YOUR_SENDGRID_APIKEY")
host := "https://api.sendgrid.com"
Expand All @@ -50,10 +47,8 @@ func Retrieveallalerts() {
}
}

///////////////////////////////////////////////////
// Update an alert
// Updateanalert Update an alert
// PATCH /alerts/{alert_id}

func Updateanalert() {
apiKey := os.Getenv("YOUR_SENDGRID_APIKEY")
host := "https://api.sendgrid.com"
Expand All @@ -72,10 +67,8 @@ func Updateanalert() {
}
}

///////////////////////////////////////////////////
// Retrieve a specific alert
// Retrieveaspecificalert Retrieve a specific alert
// GET /alerts/{alert_id}

func Retrieveaspecificalert() {
apiKey := os.Getenv("YOUR_SENDGRID_APIKEY")
host := "https://api.sendgrid.com"
Expand All @@ -91,10 +84,8 @@ func Retrieveaspecificalert() {
}
}

///////////////////////////////////////////////////
// Delete an alert
// Deleteanalert Delete an alert
// DELETE /alerts/{alert_id}

func Deleteanalert() {
apiKey := os.Getenv("YOUR_SENDGRID_APIKEY")
host := "https://api.sendgrid.com"
Expand Down
39 changes: 14 additions & 25 deletions examples/apikeys/apikeys.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,25 @@ package main

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

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

///////////////////////////////////////////////////
// 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 @@ -35,10 +34,8 @@ func CreateAPIkeys() {
}
}

///////////////////////////////////////////////////
// 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")
host := "https://api.sendgrid.com"
Expand All @@ -57,19 +54,17 @@ func RetrieveallAPIKeysbelongingtotheauthenticateduser() {
}
}

///////////////////////////////////////////////////
// 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 @@ -83,10 +78,8 @@ func UpdatethenamescopesofanAPIKey() {
}
}

///////////////////////////////////////////////////
// Update API keys
// UpdateAPIkeys Update API keys
// PATCH /api_keys/{api_key_id}

func UpdateAPIkeys() {
apiKey := os.Getenv("YOUR_SENDGRID_APIKEY")
host := "https://api.sendgrid.com"
Expand All @@ -105,10 +98,8 @@ func UpdateAPIkeys() {
}
}

///////////////////////////////////////////////////
// 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")
host := "https://api.sendgrid.com"
Expand All @@ -124,10 +115,8 @@ func RetrieveanexistingAPIKey() {
}
}

///////////////////////////////////////////////////
// Delete API keys
// DeleteAPIkeys Delete API keys
// DELETE /api_keys/{api_key_id}

func DeleteAPIkeys() {
apiKey := os.Getenv("YOUR_SENDGRID_APIKEY")
host := "https://api.sendgrid.com"
Expand Down
Loading