Skip to content

Commit

Permalink
Merge pull request #148 from prateekpandey14/fix-lint-fmt
Browse files Browse the repository at this point in the history
Fixing golint and gofmt errors
  • Loading branch information
Matt Bernier authored Oct 24, 2017
2 parents e5c86c1 + 2a2ef23 commit 3f7126b
Show file tree
Hide file tree
Showing 28 changed files with 543 additions and 951 deletions.
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

0 comments on commit 3f7126b

Please sign in to comment.