Skip to content

Instantly share code, notes, and snippets.

View kanapuli's full-sized avatar
🏠
Working from home

Athavan Kanapuli kanapuli

🏠
Working from home
View GitHub Profile
//sort query sorts the document based on the field specified
{
"query": {
"match_all": {},
"sort": [
{
"id": {
"order": "desc"
}
},
//This brings the record from 100th document and gets the next 100 document
{
"query": {
"match_all": {},
"from": 100,
"size": 100
}
}
//size retrieves only 10 documents back
{
"size": 10,
"query": {
"match_all": {}
}
}
//Elastic match_all gives all records
{
"query": {
"match_all": {
"boost":1.5
}
}
}
{
"AccessToken": "xoxp-827479-624459-260853-a4291948ksjkjdksdds6df5511ea",
"Expiry": "0001-01-01T00:00:00Z",
"RefreshToken": "",
"TokenType": ""
}
//SlackSignIn gives the Authentication token in return to the code
func (LoginService) SlackSignIn(ctx context.Context, code string) (token SlackTokenResponse, err error) {
conf := &oauth2.Config{
ClientID: slackClientID,
ClientSecret: slackClientSecret,
Scopes: slackScopes,
Endpoint: oauth2.Endpoint{
AuthURL: slackAuthURL,
TokenURL: slackTokenURL,
{
"redirectURL": "https://slack.com/oauth/authorize?access_type=offline&client_id=6xxxvvv.28976558208&response_type=code&scope=identity.basic&state=state",
"error": ""
}
package authentication
//SlackAuth responses back the Login URL
func (LoginService) SlackAuth(ctx context.Context) (redirectURL string, err error) {
conf := &oauth2.Config{
ClientID: slackClientID,
ClientSecret: slackClientSecret,
Scopes: slackScopes,
Endpoint: oauth2.Endpoint{
AuthURL: slackAuthURL,
package authentication
//config.go has all the configuration constants
//The following has the slack constants
const (
slackClientID = "6XXXXXXXXXXXXXXXXOOOOOOOOOOOOOOO"
slackClientSecret = "xxxxxxxxxxxxa2ffexxxxxxxxxxxxxxx"
slackAuthURL = "https://slack.com/oauth/authorize"
slackTokenURL = "https://slack.com/api/oauth.access"
@kanapuli
kanapuli / circle.go
Created September 11, 2017 02:43
Type Alias main.go after refactoring
package circle
import "github.com/err/square"
//CircleShape is the typealias for square.Shape
type CircleShape = square.Shape