This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//sort query sorts the document based on the field specified | |
{ | |
"query": { | |
"match_all": {}, | |
"sort": [ | |
{ | |
"id": { | |
"order": "desc" | |
} | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This brings the record from 100th document and gets the next 100 document | |
{ | |
"query": { | |
"match_all": {}, | |
"from": 100, | |
"size": 100 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//size retrieves only 10 documents back | |
{ | |
"size": 10, | |
"query": { | |
"match_all": {} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Elastic match_all gives all records | |
{ | |
"query": { | |
"match_all": { | |
"boost":1.5 | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AccessToken": "xoxp-827479-624459-260853-a4291948ksjkjdksdds6df5511ea", | |
"Expiry": "0001-01-01T00:00:00Z", | |
"RefreshToken": "", | |
"TokenType": "" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"redirectURL": "https://slack.com/oauth/authorize?access_type=offline&client_id=6xxxvvv.28976558208&response_type=code&scope=identity.basic&state=state", | |
"error": "" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package circle | |
import "github.com/err/square" | |
//CircleShape is the typealias for square.Shape | |
type CircleShape = square.Shape |