1Hello! Thank you for choosing to help contribute to one of the SendGrid open source projects. There are many ways you can contribute and help is always welcome.  We simply ask that you follow the following contribution policies.
2
3- [CLAs and CCLAs](#cla)
4- [Roadmap & Milestones](#roadmap)
5- [Feature Request](#feature-request)
6- [Submit a Bug Report](#submit-a-bug-report)
7- [Improvements to the Codebase](#improvements-to-the-codebase)
8- [Understanding the Code Base](#understanding-the-codebase)
9- [Testing](#testing)
10- [Style Guidelines & Naming Conventions](#style-guidelines-and-naming-conventions)
11- [Creating a Pull Request](#creating-a-pull-request)
12
13<a name="roadmap"></a>
14We use [Milestones](https://github.com/sendgrid/rest/milestones) to help define current roadmaps, please feel free to grab an issue from the current milestone. Please indicate that you have begun work on it to avoid collisions. Once a PR is made, community review, comments, suggestions and additional PRs are welcomed and encouraged.
15
16<a name="cla"></a>
17## CLAs and CCLAs
18
19Before you get started, SendGrid requires that a SendGrid Contributor License Agreement (CLA) be filled out by every contributor to a SendGrid open source project.
20
21Our goal with the CLA is to clarify the rights of our contributors and reduce other risks arising from inappropriate contributions.  The CLA also clarifies the rights SendGrid holds in each contribution and helps to avoid misunderstandings over what rights each contributor is required to grant to SendGrid when making a contribution.  In this way the CLA encourages broad participation by our open source community and helps us build strong open source projects, free from any individual contributor withholding or revoking rights to any contribution.
22
23SendGrid does not merge a pull request made against a SendGrid open source project until that pull request is associated with a signed CLA. Copies of the CLA are available [here](https://gist.github.com/SendGridDX/98b42c0a5d500058357b80278fde3be8#file-sendgrid-cla).
24
25When you create a Pull Request, after a few seconds, a comment will appear with a link to the CLA. Click the link and fill out the brief form and then click the "I agree" button and you are all set. You will not be asked to re-sign the CLA unless we make a change.
26
27There are a few ways to contribute, which we'll enumerate below:
28
29<a name="feature-request"></a>
30## Feature Request
31
32If you'd like to make a feature request, please read this section.
33
34The GitHub issue tracker is the preferred channel for library feature requests, but please respect the following restrictions:
35
36- Please **search for existing issues** in order to ensure we don't have duplicate bugs/feature requests.
37- Please be respectful and considerate of others when commenting on issues
38
39<a name="submit-a-bug-report"></a>
40## Submit a Bug Report
41
42Note: DO NOT include your credentials in ANY code examples, descriptions, or media you make public.
43
44A software bug is a demonstrable issue in the code base. In order for us to diagnose the issue and respond as quickly as possible, please add as much detail as possible into your bug report.
45
46Before you decide to create a new issue, please try the following:
47
481. Check the Github issues tab if the identified issue has already been reported, if so, please add a +1 to the existing post.
492. Update to the latest version of this code and check if issue has already been fixed
503. Copy and fill in the Bug Report Template we have provided below
51
52### Please use our Bug Report Template
53
54In order to make the process easier, we've included a [sample bug report template](https://github.com/sendgrid/rest/.github/ISSUE_TEMPLATE) (borrowed from [Ghost](https://github.com/TryGhost/Ghost/)). The template uses [GitHub flavored markdown](https://help.github.com/articles/github-flavored-markdown/) for formatting.
55
56<a name="improvements-to-the-codebase"></a>
57## Improvements to the Codebase
58
59We welcome direct contributions to the rest code base. Thank you!
60
61### Development Environment ###
62
63#### Install and Run Locally ####
64
65##### Prerequisites #####
66
67- Go version 1.6
68
69##### Initial setup: #####
70
71```bash
72git clone https://github.com/sendgrid/rest.git
73cd rest
74```
75
76##### Execute: #####
77
78See the [examples folder](https://github.com/sendgrid/rest/tree/master/examples) to get started quickly.
79
80If you want to try the SendGrid example:
81
82First, get your free SendGrid account [here](https://sendgrid.com/free?source=rest).
83
84You will need to setup the following environment to use the SendGrid example:
85
86```
87echo "export SENDGRID-API-KEY='YOUR-API-KEY'" > sendgrid.env
88echo "sendgrid.env" >> .gitignore
89source ./sendgrid.env
90go run examples/example.go
91```
92
93<a name="understanding-the-codebase"></a>
94## Understanding the Code Base
95
96**/examples**
97
98Working examples that demonstrate usage.
99
100**rest.go**
101
102There is a struct to hold both the request and response to the API server.
103
104The main function that does the heavy lifting (and external entry point) is `API`.
105
106<a name="testing"></a>
107## Testing
108
109All PRs require passing tests before the PR will be reviewed.
110
111All test files are in [`rest-test.go`](https://github.com/sendgrid/rest/blob/master/rest_test.go).
112
113For the purposes of contributing to this repo, please update the [`rest-test.go`](https://github.com/sendgrid/rest/blob/master/rest_test.go) file with unit tests as you modify the code.
114
115Run the test:
116
117```bash
118go test -v
119```
120
121<a name="style-guidelines-and-naming-conventions"></a>
122## Style Guidelines & Naming Conventions
123
124Generally, we follow the style guidelines as suggested by the official language. However, we ask that you conform to the styles that already exist in the library. If you wish to deviate, please explain your reasoning.
125
126- [Go Code Review Comments](https://github.com/golang/go/wiki/CodeReviewComments)
127
128Please run your code through:
129
130- [fmt](https://blog.golang.org/go-fmt-your-code)
131
132## Creating a Pull Request<a name="creating-a-pull-request"></a>
133
1341. [Fork](https://help.github.com/fork-a-repo/) the project, clone your fork,
135   and configure the remotes:
136
137   ```bash
138   # Clone your fork of the repo into the current directory
139   git clone https://github.com/sendgrid/rest
140   # Navigate to the newly cloned directory
141   cd rest
142   # Assign the original repo to a remote called "upstream"
143   git remote add upstream https://github.com/sendgrid/rest
144   ```
145
1462. If you cloned a while ago, get the latest changes from upstream:
147
148   ```bash
149   git checkout <dev-branch>
150   git pull upstream <dev-branch>
151   ```
152
1533. Create a new topic branch (off the main project development branch) to
154   contain your feature, change, or fix:
155
156   ```bash
157   git checkout -b <topic-branch-name>
158   ```
159
1604. Commit your changes in logical chunks. Please adhere to these [git commit
161   message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
162   or your code is unlikely be merged into the main project. Use Git's
163   [interactive rebase](https://help.github.com/articles/interactive-rebase)
164   feature to tidy up your commits before making them public.
165
1664a. Create tests.
167
1684b. Create or update the example code that demonstrates the functionality of this change to the code.
169
1705. Locally merge (or rebase) the upstream development branch into your topic branch:
171
172   ```bash
173   git pull [--rebase] upstream master
174   ```
175
1766. Push your topic branch up to your fork:
177
178   ```bash
179   git push origin <topic-branch-name>
180   ```
181
1827. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
183    with a clear title and description against the `master` branch. All tests must be passing before we will review the PR.
184
185If you have any additional questions, please feel free to [email](mailto:dx@sendgrid.com) us or create an issue in this repo.
186