id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
140,300 | fagongzi/goetty | protocol/redis/reply.go | WriteScorePairArray | func WriteScorePairArray(members [][]byte, scores []float64, withScores bool, buf *goetty.ByteBuf) {
buf.WriteByte('*')
if len(members) == 0 || len(scores) == 0 {
buf.Write(NullArray)
buf.Write(Delims)
} else {
if withScores {
buf.Write(goetty.StringToSlice(strconv.Itoa(len(members) * 2)))
buf.Wr... | go | func WriteScorePairArray(members [][]byte, scores []float64, withScores bool, buf *goetty.ByteBuf) {
buf.WriteByte('*')
if len(members) == 0 || len(scores) == 0 {
buf.Write(NullArray)
buf.Write(Delims)
} else {
if withScores {
buf.Write(goetty.StringToSlice(strconv.Itoa(len(members) * 2)))
buf.Wr... | [
"func",
"WriteScorePairArray",
"(",
"members",
"[",
"]",
"[",
"]",
"byte",
",",
"scores",
"[",
"]",
"float64",
",",
"withScores",
"bool",
",",
"buf",
"*",
"goetty",
".",
"ByteBuf",
")",
"{",
"buf",
".",
"WriteByte",
"(",
"'*'",
")",
"\n",
"if",
"len"... | // WriteScorePairArray write score-member pair array resp | [
"WriteScorePairArray",
"write",
"score",
"-",
"member",
"pair",
"array",
"resp"
] | 8db0d25ac2019c322508640bf56de7219332f94c | https://github.com/fagongzi/goetty/blob/8db0d25ac2019c322508640bf56de7219332f94c/protocol/redis/reply.go#L115-L138 |
140,301 | fagongzi/goetty | sync_queue.go | Add | func (q *OffsetQueue) Add(item interface{}) uint64 {
q.Lock()
q.end++
q.items = append(q.items, item)
max := q.getMaxOffset0()
q.Unlock()
return max
} | go | func (q *OffsetQueue) Add(item interface{}) uint64 {
q.Lock()
q.end++
q.items = append(q.items, item)
max := q.getMaxOffset0()
q.Unlock()
return max
} | [
"func",
"(",
"q",
"*",
"OffsetQueue",
")",
"Add",
"(",
"item",
"interface",
"{",
"}",
")",
"uint64",
"{",
"q",
".",
"Lock",
"(",
")",
"\n",
"q",
".",
"end",
"++",
"\n",
"q",
".",
"items",
"=",
"append",
"(",
"q",
".",
"items",
",",
"item",
")... | // Add add a item to the queue | [
"Add",
"add",
"a",
"item",
"to",
"the",
"queue"
] | 8db0d25ac2019c322508640bf56de7219332f94c | https://github.com/fagongzi/goetty/blob/8db0d25ac2019c322508640bf56de7219332f94c/sync_queue.go#L34-L41 |
140,302 | fagongzi/goetty | sync_queue.go | Get | func (q *OffsetQueue) Get(offset uint64) ([]interface{}, uint64) {
oldOffset := offset
if offset > 0 {
offset = offset - 1
}
q.Lock()
max := q.getMaxOffset0()
if offset > max {
panic(fmt.Sprintf("bug: error offset %d, end is %d", offset, q.end))
} else if offset < q.start || (oldOffset == 0 && offset == q.s... | go | func (q *OffsetQueue) Get(offset uint64) ([]interface{}, uint64) {
oldOffset := offset
if offset > 0 {
offset = offset - 1
}
q.Lock()
max := q.getMaxOffset0()
if offset > max {
panic(fmt.Sprintf("bug: error offset %d, end is %d", offset, q.end))
} else if offset < q.start || (oldOffset == 0 && offset == q.s... | [
"func",
"(",
"q",
"*",
"OffsetQueue",
")",
"Get",
"(",
"offset",
"uint64",
")",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"uint64",
")",
"{",
"oldOffset",
":=",
"offset",
"\n",
"if",
"offset",
">",
"0",
"{",
"offset",
"=",
"offset",
"-",
"1",
"\... | // Get returns all the items after the offset, and remove all items before this offset | [
"Get",
"returns",
"all",
"the",
"items",
"after",
"the",
"offset",
"and",
"remove",
"all",
"items",
"before",
"this",
"offset"
] | 8db0d25ac2019c322508640bf56de7219332f94c | https://github.com/fagongzi/goetty/blob/8db0d25ac2019c322508640bf56de7219332f94c/sync_queue.go#L44-L79 |
140,303 | fagongzi/goetty | sync_queue.go | GetMaxOffset | func (q *OffsetQueue) GetMaxOffset() uint64 {
q.Lock()
v := q.getMaxOffset0()
q.Unlock()
return v
} | go | func (q *OffsetQueue) GetMaxOffset() uint64 {
q.Lock()
v := q.getMaxOffset0()
q.Unlock()
return v
} | [
"func",
"(",
"q",
"*",
"OffsetQueue",
")",
"GetMaxOffset",
"(",
")",
"uint64",
"{",
"q",
".",
"Lock",
"(",
")",
"\n",
"v",
":=",
"q",
".",
"getMaxOffset0",
"(",
")",
"\n",
"q",
".",
"Unlock",
"(",
")",
"\n",
"return",
"v",
"\n",
"}"
] | // GetMaxOffset returns the max offset in the queue | [
"GetMaxOffset",
"returns",
"the",
"max",
"offset",
"in",
"the",
"queue"
] | 8db0d25ac2019c322508640bf56de7219332f94c | https://github.com/fagongzi/goetty/blob/8db0d25ac2019c322508640bf56de7219332f94c/sync_queue.go#L82-L87 |
140,304 | fagongzi/goetty | codec_sync.go | Encode | func (codec *SyncCodec) Encode(data interface{}, out *ByteBuf) error {
if msg, ok := data.(*notifyRaw); ok {
out.WriteByte(cmdNotifyRaw)
out.WriteByteBuf(msg.buf)
releaseNotifyRaw(msg)
return nil
} else if msg, ok := data.(*notify); ok {
out.WriteByte(cmdNotify)
out.WriteUint64(msg.offset)
releaseNotify... | go | func (codec *SyncCodec) Encode(data interface{}, out *ByteBuf) error {
if msg, ok := data.(*notifyRaw); ok {
out.WriteByte(cmdNotifyRaw)
out.WriteByteBuf(msg.buf)
releaseNotifyRaw(msg)
return nil
} else if msg, ok := data.(*notify); ok {
out.WriteByte(cmdNotify)
out.WriteUint64(msg.offset)
releaseNotify... | [
"func",
"(",
"codec",
"*",
"SyncCodec",
")",
"Encode",
"(",
"data",
"interface",
"{",
"}",
",",
"out",
"*",
"ByteBuf",
")",
"error",
"{",
"if",
"msg",
",",
"ok",
":=",
"data",
".",
"(",
"*",
"notifyRaw",
")",
";",
"ok",
"{",
"out",
".",
"WriteByt... | // Encode encode sync protocol | [
"Encode",
"encode",
"sync",
"protocol"
] | 8db0d25ac2019c322508640bf56de7219332f94c | https://github.com/fagongzi/goetty/blob/8db0d25ac2019c322508640bf56de7219332f94c/codec_sync.go#L143-L173 |
140,305 | aaasen/kapok | stats/readability.go | Sentences | func Sentences(text string) []string {
sentences := sentenceRegex.Split(text, -1)
if sentences[len(sentences)-1] == "" {
return sentences[0 : len(sentences)-1]
}
return sentences
} | go | func Sentences(text string) []string {
sentences := sentenceRegex.Split(text, -1)
if sentences[len(sentences)-1] == "" {
return sentences[0 : len(sentences)-1]
}
return sentences
} | [
"func",
"Sentences",
"(",
"text",
"string",
")",
"[",
"]",
"string",
"{",
"sentences",
":=",
"sentenceRegex",
".",
"Split",
"(",
"text",
",",
"-",
"1",
")",
"\n\n",
"if",
"sentences",
"[",
"len",
"(",
"sentences",
")",
"-",
"1",
"]",
"==",
"\"",
"\... | // Sentences returns a slice of the sentences in a given string. | [
"Sentences",
"returns",
"a",
"slice",
"of",
"the",
"sentences",
"in",
"a",
"given",
"string",
"."
] | b3a454001825c4e26fe21fac61f214c1a6c284ed | https://github.com/aaasen/kapok/blob/b3a454001825c4e26fe21fac61f214c1a6c284ed/stats/readability.go#L21-L29 |
140,306 | aaasen/kapok | stats/readability.go | SyllableCount | func SyllableCount(word string) int {
if len(word) <= 3 {
return 1
}
word = endingRegex.ReplaceAllString(word, "")
word = staringYRegex.ReplaceAllString(word, "")
return len(vowelRegex.FindAllString(word, -1))
} | go | func SyllableCount(word string) int {
if len(word) <= 3 {
return 1
}
word = endingRegex.ReplaceAllString(word, "")
word = staringYRegex.ReplaceAllString(word, "")
return len(vowelRegex.FindAllString(word, -1))
} | [
"func",
"SyllableCount",
"(",
"word",
"string",
")",
"int",
"{",
"if",
"len",
"(",
"word",
")",
"<=",
"3",
"{",
"return",
"1",
"\n",
"}",
"\n\n",
"word",
"=",
"endingRegex",
".",
"ReplaceAllString",
"(",
"word",
",",
"\"",
"\"",
")",
"\n",
"word",
... | // SyllableCount returns the number of syllables in a given string.
// Dipthongs are not taken into account. | [
"SyllableCount",
"returns",
"the",
"number",
"of",
"syllables",
"in",
"a",
"given",
"string",
".",
"Dipthongs",
"are",
"not",
"taken",
"into",
"account",
"."
] | b3a454001825c4e26fe21fac61f214c1a6c284ed | https://github.com/aaasen/kapok/blob/b3a454001825c4e26fe21fac61f214c1a6c284ed/stats/readability.go#L33-L42 |
140,307 | aaasen/kapok | parse/page.go | NewPageFromXML | func NewPageFromXML(text []byte) (*Page, error) {
page := &Page{}
err := page.getTitle(text)
if err != nil {
return nil, err
}
page.getLinks(text)
return page, nil
} | go | func NewPageFromXML(text []byte) (*Page, error) {
page := &Page{}
err := page.getTitle(text)
if err != nil {
return nil, err
}
page.getLinks(text)
return page, nil
} | [
"func",
"NewPageFromXML",
"(",
"text",
"[",
"]",
"byte",
")",
"(",
"*",
"Page",
",",
"error",
")",
"{",
"page",
":=",
"&",
"Page",
"{",
"}",
"\n\n",
"err",
":=",
"page",
".",
"getTitle",
"(",
"text",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
... | // NewPageFromXML creates a Page object from XML. | [
"NewPageFromXML",
"creates",
"a",
"Page",
"object",
"from",
"XML",
"."
] | b3a454001825c4e26fe21fac61f214c1a6c284ed | https://github.com/aaasen/kapok/blob/b3a454001825c4e26fe21fac61f214c1a6c284ed/parse/page.go#L24-L36 |
140,308 | aaasen/kapok | parse/page.go | getTitle | func (page *Page) getTitle(text []byte) error {
startTag := []byte("<title>")
startIndex := bytes.Index(text, startTag)
endTag := []byte("</title>")
endIndex := bytes.Index(text, endTag)
if startIndex != -1 && endIndex != -1 {
title := text[startIndex+len(startTag) : endIndex]
if len(title) < 1 || !isTitle(... | go | func (page *Page) getTitle(text []byte) error {
startTag := []byte("<title>")
startIndex := bytes.Index(text, startTag)
endTag := []byte("</title>")
endIndex := bytes.Index(text, endTag)
if startIndex != -1 && endIndex != -1 {
title := text[startIndex+len(startTag) : endIndex]
if len(title) < 1 || !isTitle(... | [
"func",
"(",
"page",
"*",
"Page",
")",
"getTitle",
"(",
"text",
"[",
"]",
"byte",
")",
"error",
"{",
"startTag",
":=",
"[",
"]",
"byte",
"(",
"\"",
"\"",
")",
"\n",
"startIndex",
":=",
"bytes",
".",
"Index",
"(",
"text",
",",
"startTag",
")",
"\n... | // getTitle parses the title from an XML representation of a Wikipedia page.
// In the event of an error or malformed XML, it will return ErrTitleNotFound. | [
"getTitle",
"parses",
"the",
"title",
"from",
"an",
"XML",
"representation",
"of",
"a",
"Wikipedia",
"page",
".",
"In",
"the",
"event",
"of",
"an",
"error",
"or",
"malformed",
"XML",
"it",
"will",
"return",
"ErrTitleNotFound",
"."
] | b3a454001825c4e26fe21fac61f214c1a6c284ed | https://github.com/aaasen/kapok/blob/b3a454001825c4e26fe21fac61f214c1a6c284ed/parse/page.go#L82-L102 |
140,309 | aaasen/kapok | parse/parse.go | Parse | func (parser *Parser) Parse(reader io.Reader, pages chan<- *Page) {
rawPages := make(chan []byte)
go parser.getRawPages(reader, rawPages)
go parser.getPages(rawPages, pages)
} | go | func (parser *Parser) Parse(reader io.Reader, pages chan<- *Page) {
rawPages := make(chan []byte)
go parser.getRawPages(reader, rawPages)
go parser.getPages(rawPages, pages)
} | [
"func",
"(",
"parser",
"*",
"Parser",
")",
"Parse",
"(",
"reader",
"io",
".",
"Reader",
",",
"pages",
"chan",
"<-",
"*",
"Page",
")",
"{",
"rawPages",
":=",
"make",
"(",
"chan",
"[",
"]",
"byte",
")",
"\n\n",
"go",
"parser",
".",
"getRawPages",
"("... | // Parse parses given reader as XML and dumps Page objects into the given channel.
// Parse will fill the Page's Title, Links, and Categories.
//
// When the reader is empty, Parse will close its output channel.
//
// Parse will throw away malformed input instead of exiting and reporting it. | [
"Parse",
"parses",
"given",
"reader",
"as",
"XML",
"and",
"dumps",
"Page",
"objects",
"into",
"the",
"given",
"channel",
".",
"Parse",
"will",
"fill",
"the",
"Page",
"s",
"Title",
"Links",
"and",
"Categories",
".",
"When",
"the",
"reader",
"is",
"empty",
... | b3a454001825c4e26fe21fac61f214c1a6c284ed | https://github.com/aaasen/kapok/blob/b3a454001825c4e26fe21fac61f214c1a6c284ed/parse/parse.go#L28-L33 |
140,310 | aaasen/kapok | parse/parse.go | getRawPages | func (parser *Parser) getRawPages(rawReader io.Reader, pages chan<- []byte) {
reader := bufio.NewReader(rawReader)
buffer := make([]byte, 0)
inPage := false
eof := false
for !eof {
text, err := reader.ReadBytes('>')
parser.BytesProcessed += int64(len(text))
if err != nil {
if err == io.EOF {
eof =... | go | func (parser *Parser) getRawPages(rawReader io.Reader, pages chan<- []byte) {
reader := bufio.NewReader(rawReader)
buffer := make([]byte, 0)
inPage := false
eof := false
for !eof {
text, err := reader.ReadBytes('>')
parser.BytesProcessed += int64(len(text))
if err != nil {
if err == io.EOF {
eof =... | [
"func",
"(",
"parser",
"*",
"Parser",
")",
"getRawPages",
"(",
"rawReader",
"io",
".",
"Reader",
",",
"pages",
"chan",
"<-",
"[",
"]",
"byte",
")",
"{",
"reader",
":=",
"bufio",
".",
"NewReader",
"(",
"rawReader",
")",
"\n\n",
"buffer",
":=",
"make",
... | // getRawPages creates full pages from a reader that can then be parsed with an XML parser. | [
"getRawPages",
"creates",
"full",
"pages",
"from",
"a",
"reader",
"that",
"can",
"then",
"be",
"parsed",
"with",
"an",
"XML",
"parser",
"."
] | b3a454001825c4e26fe21fac61f214c1a6c284ed | https://github.com/aaasen/kapok/blob/b3a454001825c4e26fe21fac61f214c1a6c284ed/parse/parse.go#L36-L80 |
140,311 | aaasen/kapok | parse/parse.go | getPages | func (parser *Parser) getPages(rawPages <-chan []byte, pages chan<- *Page) {
for {
select {
case rawPage, ok := <-rawPages:
if !ok {
close(pages)
return
}
page, err := NewPageFromXML(rawPage)
if err == nil {
pages <- page
}
}
}
} | go | func (parser *Parser) getPages(rawPages <-chan []byte, pages chan<- *Page) {
for {
select {
case rawPage, ok := <-rawPages:
if !ok {
close(pages)
return
}
page, err := NewPageFromXML(rawPage)
if err == nil {
pages <- page
}
}
}
} | [
"func",
"(",
"parser",
"*",
"Parser",
")",
"getPages",
"(",
"rawPages",
"<-",
"chan",
"[",
"]",
"byte",
",",
"pages",
"chan",
"<-",
"*",
"Page",
")",
"{",
"for",
"{",
"select",
"{",
"case",
"rawPage",
",",
"ok",
":=",
"<-",
"rawPages",
":",
"if",
... | // GetPages parses a complete XML page into a page object. | [
"GetPages",
"parses",
"a",
"complete",
"XML",
"page",
"into",
"a",
"page",
"object",
"."
] | b3a454001825c4e26fe21fac61f214c1a6c284ed | https://github.com/aaasen/kapok/blob/b3a454001825c4e26fe21fac61f214c1a6c284ed/parse/parse.go#L83-L99 |
140,312 | VerbalExpressions/GoVerbalExpressions | helpers.go | Replace | func (v *VerbalExpression) Replace(src string, dst string) string {
return v.Regex().ReplaceAllString(src, dst)
} | go | func (v *VerbalExpression) Replace(src string, dst string) string {
return v.Regex().ReplaceAllString(src, dst)
} | [
"func",
"(",
"v",
"*",
"VerbalExpression",
")",
"Replace",
"(",
"src",
"string",
",",
"dst",
"string",
")",
"string",
"{",
"return",
"v",
".",
"Regex",
"(",
")",
".",
"ReplaceAllString",
"(",
"src",
",",
"dst",
")",
"\n",
"}"
] | // Replace alias to regexp.ReplaceAllString. It replace the found expression from
// string src by string dst | [
"Replace",
"alias",
"to",
"regexp",
".",
"ReplaceAllString",
".",
"It",
"replace",
"the",
"found",
"expression",
"from",
"string",
"src",
"by",
"string",
"dst"
] | 9cfb19cb04c9f48489be15cbacac3d3af9d7706a | https://github.com/VerbalExpressions/GoVerbalExpressions/blob/9cfb19cb04c9f48489be15cbacac3d3af9d7706a/helpers.go#L12-L14 |
140,313 | VerbalExpressions/GoVerbalExpressions | verbalexpressions.go | tostring | func tostring(i interface{}) string {
var r string
switch x := i.(type) {
case string:
r = x
case uint64:
r = strconv.FormatUint(x, 10)
case int64:
r = strconv.FormatInt(x, 10)
case uint:
r = strconv.FormatUint(uint64(x), 10)
case int:
r = strconv.FormatInt(int64(x), 10)
default:
log.Panicf("Could n... | go | func tostring(i interface{}) string {
var r string
switch x := i.(type) {
case string:
r = x
case uint64:
r = strconv.FormatUint(x, 10)
case int64:
r = strconv.FormatInt(x, 10)
case uint:
r = strconv.FormatUint(uint64(x), 10)
case int:
r = strconv.FormatInt(int64(x), 10)
default:
log.Panicf("Could n... | [
"func",
"tostring",
"(",
"i",
"interface",
"{",
"}",
")",
"string",
"{",
"var",
"r",
"string",
"\n",
"switch",
"x",
":=",
"i",
".",
"(",
"type",
")",
"{",
"case",
"string",
":",
"r",
"=",
"x",
"\n",
"case",
"uint64",
":",
"r",
"=",
"strconv",
"... | // utility function to return only strings | [
"utility",
"function",
"to",
"return",
"only",
"strings"
] | 9cfb19cb04c9f48489be15cbacac3d3af9d7706a | https://github.com/VerbalExpressions/GoVerbalExpressions/blob/9cfb19cb04c9f48489be15cbacac3d3af9d7706a/verbalexpressions.go#L41-L58 |
140,314 | VerbalExpressions/GoVerbalExpressions | verbalexpressions.go | addmodifier | func (v *VerbalExpression) addmodifier(f Flag) *VerbalExpression {
v.compiled = false //reinit previous regexp compilation
v.flags |= f
return v
} | go | func (v *VerbalExpression) addmodifier(f Flag) *VerbalExpression {
v.compiled = false //reinit previous regexp compilation
v.flags |= f
return v
} | [
"func",
"(",
"v",
"*",
"VerbalExpression",
")",
"addmodifier",
"(",
"f",
"Flag",
")",
"*",
"VerbalExpression",
"{",
"v",
".",
"compiled",
"=",
"false",
"//reinit previous regexp compilation",
"\n",
"v",
".",
"flags",
"|=",
"f",
"\n",
"return",
"v",
"\n",
"... | // append a modifier | [
"append",
"a",
"modifier"
] | 9cfb19cb04c9f48489be15cbacac3d3af9d7706a | https://github.com/VerbalExpressions/GoVerbalExpressions/blob/9cfb19cb04c9f48489be15cbacac3d3af9d7706a/verbalexpressions.go#L73-L77 |
140,315 | VerbalExpressions/GoVerbalExpressions | verbalexpressions.go | removemodifier | func (v *VerbalExpression) removemodifier(f Flag) *VerbalExpression {
v.compiled = false //reinit previous regexp compilation
v.flags &= ^f
return v
} | go | func (v *VerbalExpression) removemodifier(f Flag) *VerbalExpression {
v.compiled = false //reinit previous regexp compilation
v.flags &= ^f
return v
} | [
"func",
"(",
"v",
"*",
"VerbalExpression",
")",
"removemodifier",
"(",
"f",
"Flag",
")",
"*",
"VerbalExpression",
"{",
"v",
".",
"compiled",
"=",
"false",
"//reinit previous regexp compilation",
"\n",
"v",
".",
"flags",
"&=",
"^",
"f",
"\n",
"return",
"v",
... | // remove a modifier | [
"remove",
"a",
"modifier"
] | 9cfb19cb04c9f48489be15cbacac3d3af9d7706a | https://github.com/VerbalExpressions/GoVerbalExpressions/blob/9cfb19cb04c9f48489be15cbacac3d3af9d7706a/verbalexpressions.go#L80-L84 |
140,316 | VerbalExpressions/GoVerbalExpressions | verbalexpressions.go | getFlags | func (v *VerbalExpression) getFlags() string {
flags := "misU" // warning, follow Flag const order
result := []rune{}
for i, flag := range flags {
if v.flags&(1<<uint(i)) != 0 {
result = append(result, flag)
}
}
return string(result)
} | go | func (v *VerbalExpression) getFlags() string {
flags := "misU" // warning, follow Flag const order
result := []rune{}
for i, flag := range flags {
if v.flags&(1<<uint(i)) != 0 {
result = append(result, flag)
}
}
return string(result)
} | [
"func",
"(",
"v",
"*",
"VerbalExpression",
")",
"getFlags",
"(",
")",
"string",
"{",
"flags",
":=",
"\"",
"\"",
"// warning, follow Flag const order",
"\n",
"result",
":=",
"[",
"]",
"rune",
"{",
"}",
"\n\n",
"for",
"i",
",",
"flag",
":=",
"range",
"flag... | // append modifiers that are activated | [
"append",
"modifiers",
"that",
"are",
"activated"
] | 9cfb19cb04c9f48489be15cbacac3d3af9d7706a | https://github.com/VerbalExpressions/GoVerbalExpressions/blob/9cfb19cb04c9f48489be15cbacac3d3af9d7706a/verbalexpressions.go#L87-L98 |
140,317 | VerbalExpressions/GoVerbalExpressions | verbalexpressions.go | add | func (v *VerbalExpression) add(s string) *VerbalExpression {
v.compiled = false //reinit previous regexp compilation
v.expression += s
return v
} | go | func (v *VerbalExpression) add(s string) *VerbalExpression {
v.compiled = false //reinit previous regexp compilation
v.expression += s
return v
} | [
"func",
"(",
"v",
"*",
"VerbalExpression",
")",
"add",
"(",
"s",
"string",
")",
"*",
"VerbalExpression",
"{",
"v",
".",
"compiled",
"=",
"false",
"//reinit previous regexp compilation",
"\n",
"v",
".",
"expression",
"+=",
"s",
"\n",
"return",
"v",
"\n",
"}... | // add method, append expresions to the internal string that will be parsed | [
"add",
"method",
"append",
"expresions",
"to",
"the",
"internal",
"string",
"that",
"will",
"be",
"parsed"
] | 9cfb19cb04c9f48489be15cbacac3d3af9d7706a | https://github.com/VerbalExpressions/GoVerbalExpressions/blob/9cfb19cb04c9f48489be15cbacac3d3af9d7706a/verbalexpressions.go#L101-L105 |
140,318 | VerbalExpressions/GoVerbalExpressions | verbalexpressions.go | EndCapture | func (v *VerbalExpression) EndCapture() *VerbalExpression {
v.suffixes = strings.Replace(v.suffixes, ")", "", 1)
return v.add(")")
} | go | func (v *VerbalExpression) EndCapture() *VerbalExpression {
v.suffixes = strings.Replace(v.suffixes, ")", "", 1)
return v.add(")")
} | [
"func",
"(",
"v",
"*",
"VerbalExpression",
")",
"EndCapture",
"(",
")",
"*",
"VerbalExpression",
"{",
"v",
".",
"suffixes",
"=",
"strings",
".",
"Replace",
"(",
"v",
".",
"suffixes",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"1",
")",
"\n",
"return",
... | // Stop capturing expresions parts | [
"Stop",
"capturing",
"expresions",
"parts"
] | 9cfb19cb04c9f48489be15cbacac3d3af9d7706a | https://github.com/VerbalExpressions/GoVerbalExpressions/blob/9cfb19cb04c9f48489be15cbacac3d3af9d7706a/verbalexpressions.go#L114-L117 |
140,319 | VerbalExpressions/GoVerbalExpressions | verbalexpressions.go | AnythingBut | func (v *VerbalExpression) AnythingBut(s string) *VerbalExpression {
return v.add(`(?:[^` + quote(s) + `]*)`)
} | go | func (v *VerbalExpression) AnythingBut(s string) *VerbalExpression {
return v.add(`(?:[^` + quote(s) + `]*)`)
} | [
"func",
"(",
"v",
"*",
"VerbalExpression",
")",
"AnythingBut",
"(",
"s",
"string",
")",
"*",
"VerbalExpression",
"{",
"return",
"v",
".",
"add",
"(",
"`(?:[^`",
"+",
"quote",
"(",
"s",
")",
"+",
"`]*)`",
")",
"\n",
"}"
] | // AnythingBut will match anything excpeting the given string. | [
"AnythingBut",
"will",
"match",
"anything",
"excpeting",
"the",
"given",
"string",
"."
] | 9cfb19cb04c9f48489be15cbacac3d3af9d7706a | https://github.com/VerbalExpressions/GoVerbalExpressions/blob/9cfb19cb04c9f48489be15cbacac3d3af9d7706a/verbalexpressions.go#L125-L127 |
140,320 | VerbalExpressions/GoVerbalExpressions | verbalexpressions.go | SomethingBut | func (v *VerbalExpression) SomethingBut(s string) *VerbalExpression {
return v.add(`(?:[^` + quote(s) + `]+)`)
} | go | func (v *VerbalExpression) SomethingBut(s string) *VerbalExpression {
return v.add(`(?:[^` + quote(s) + `]+)`)
} | [
"func",
"(",
"v",
"*",
"VerbalExpression",
")",
"SomethingBut",
"(",
"s",
"string",
")",
"*",
"VerbalExpression",
"{",
"return",
"v",
".",
"add",
"(",
"`(?:[^`",
"+",
"quote",
"(",
"s",
")",
"+",
"`]+)`",
")",
"\n",
"}"
] | // Same as Something but excepting chars given in string "s" | [
"Same",
"as",
"Something",
"but",
"excepting",
"chars",
"given",
"in",
"string",
"s"
] | 9cfb19cb04c9f48489be15cbacac3d3af9d7706a | https://github.com/VerbalExpressions/GoVerbalExpressions/blob/9cfb19cb04c9f48489be15cbacac3d3af9d7706a/verbalexpressions.go#L135-L137 |
140,321 | VerbalExpressions/GoVerbalExpressions | verbalexpressions.go | Maybe | func (v *VerbalExpression) Maybe(s string) *VerbalExpression {
return v.add(`(?:` + quote(s) + `)?`)
} | go | func (v *VerbalExpression) Maybe(s string) *VerbalExpression {
return v.add(`(?:` + quote(s) + `)?`)
} | [
"func",
"(",
"v",
"*",
"VerbalExpression",
")",
"Maybe",
"(",
"s",
"string",
")",
"*",
"VerbalExpression",
"{",
"return",
"v",
".",
"add",
"(",
"`(?:`",
"+",
"quote",
"(",
"s",
")",
"+",
"`)?`",
")",
"\n",
"}"
] | // Maybe will search string zero on more times | [
"Maybe",
"will",
"search",
"string",
"zero",
"on",
"more",
"times"
] | 9cfb19cb04c9f48489be15cbacac3d3af9d7706a | https://github.com/VerbalExpressions/GoVerbalExpressions/blob/9cfb19cb04c9f48489be15cbacac3d3af9d7706a/verbalexpressions.go#L149-L151 |
140,322 | VerbalExpressions/GoVerbalExpressions | verbalexpressions.go | Any | func (v *VerbalExpression) Any(s string) *VerbalExpression {
return v.add(`(?:[` + quote(s) + `])`)
} | go | func (v *VerbalExpression) Any(s string) *VerbalExpression {
return v.add(`(?:[` + quote(s) + `])`)
} | [
"func",
"(",
"v",
"*",
"VerbalExpression",
")",
"Any",
"(",
"s",
"string",
")",
"*",
"VerbalExpression",
"{",
"return",
"v",
".",
"add",
"(",
"`(?:[`",
"+",
"quote",
"(",
"s",
")",
"+",
"`])`",
")",
"\n",
"}"
] | // Any accepts caracters to be matched | [
"Any",
"accepts",
"caracters",
"to",
"be",
"matched"
] | 9cfb19cb04c9f48489be15cbacac3d3af9d7706a | https://github.com/VerbalExpressions/GoVerbalExpressions/blob/9cfb19cb04c9f48489be15cbacac3d3af9d7706a/verbalexpressions.go#L198-L200 |
140,323 | VerbalExpressions/GoVerbalExpressions | verbalexpressions.go | Or | func (v *VerbalExpression) Or(ve *VerbalExpression) *VerbalExpression {
v.parts = append(v.parts, ve.Regex().String()+"|")
return v
} | go | func (v *VerbalExpression) Or(ve *VerbalExpression) *VerbalExpression {
v.parts = append(v.parts, ve.Regex().String()+"|")
return v
} | [
"func",
"(",
"v",
"*",
"VerbalExpression",
")",
"Or",
"(",
"ve",
"*",
"VerbalExpression",
")",
"*",
"VerbalExpression",
"{",
"v",
".",
"parts",
"=",
"append",
"(",
"v",
".",
"parts",
",",
"ve",
".",
"Regex",
"(",
")",
".",
"String",
"(",
")",
"+",
... | // Or, chains an alternative VerbalExpression | [
"Or",
"chains",
"an",
"alternative",
"VerbalExpression"
] | 9cfb19cb04c9f48489be15cbacac3d3af9d7706a | https://github.com/VerbalExpressions/GoVerbalExpressions/blob/9cfb19cb04c9f48489be15cbacac3d3af9d7706a/verbalexpressions.go#L325-L328 |
140,324 | VerbalExpressions/GoVerbalExpressions | verbalexpressions.go | And | func (v *VerbalExpression) And(ve *VerbalExpression) *VerbalExpression {
return v.add("(?:" + ve.Regex().String() + ")")
} | go | func (v *VerbalExpression) And(ve *VerbalExpression) *VerbalExpression {
return v.add("(?:" + ve.Regex().String() + ")")
} | [
"func",
"(",
"v",
"*",
"VerbalExpression",
")",
"And",
"(",
"ve",
"*",
"VerbalExpression",
")",
"*",
"VerbalExpression",
"{",
"return",
"v",
".",
"add",
"(",
"\"",
"\"",
"+",
"ve",
".",
"Regex",
"(",
")",
".",
"String",
"(",
")",
"+",
"\"",
"\"",
... | // Add another VerbalExpression to the current.
// Usefull to concatenate several complex search patterns | [
"Add",
"another",
"VerbalExpression",
"to",
"the",
"current",
".",
"Usefull",
"to",
"concatenate",
"several",
"complex",
"search",
"patterns"
] | 9cfb19cb04c9f48489be15cbacac3d3af9d7706a | https://github.com/VerbalExpressions/GoVerbalExpressions/blob/9cfb19cb04c9f48489be15cbacac3d3af9d7706a/verbalexpressions.go#L332-L334 |
140,325 | VerbalExpressions/GoVerbalExpressions | verbalexpressions.go | WithAnyCase | func (v *VerbalExpression) WithAnyCase(sensitive bool) *VerbalExpression {
if sensitive {
return v.addmodifier(IGNORE_CASE)
}
return v.removemodifier(IGNORE_CASE)
} | go | func (v *VerbalExpression) WithAnyCase(sensitive bool) *VerbalExpression {
if sensitive {
return v.addmodifier(IGNORE_CASE)
}
return v.removemodifier(IGNORE_CASE)
} | [
"func",
"(",
"v",
"*",
"VerbalExpression",
")",
"WithAnyCase",
"(",
"sensitive",
"bool",
")",
"*",
"VerbalExpression",
"{",
"if",
"sensitive",
"{",
"return",
"v",
".",
"addmodifier",
"(",
"IGNORE_CASE",
")",
"\n",
"}",
"\n",
"return",
"v",
".",
"removemodi... | // WithAnyCase asks verbalexpressions to match with or without case sensitivity | [
"WithAnyCase",
"asks",
"verbalexpressions",
"to",
"match",
"with",
"or",
"without",
"case",
"sensitivity"
] | 9cfb19cb04c9f48489be15cbacac3d3af9d7706a | https://github.com/VerbalExpressions/GoVerbalExpressions/blob/9cfb19cb04c9f48489be15cbacac3d3af9d7706a/verbalexpressions.go#L337-L342 |
140,326 | VerbalExpressions/GoVerbalExpressions | verbalexpressions.go | SearchOneLine | func (v *VerbalExpression) SearchOneLine(oneline bool) *VerbalExpression {
if !oneline {
return v.addmodifier(MULTILINE)
}
return v.removemodifier(MULTILINE)
} | go | func (v *VerbalExpression) SearchOneLine(oneline bool) *VerbalExpression {
if !oneline {
return v.addmodifier(MULTILINE)
}
return v.removemodifier(MULTILINE)
} | [
"func",
"(",
"v",
"*",
"VerbalExpression",
")",
"SearchOneLine",
"(",
"oneline",
"bool",
")",
"*",
"VerbalExpression",
"{",
"if",
"!",
"oneline",
"{",
"return",
"v",
".",
"addmodifier",
"(",
"MULTILINE",
")",
"\n",
"}",
"\n",
"return",
"v",
".",
"removem... | // SearchOneLine deactivates "multiline" mode if online argument is true
// Default is false | [
"SearchOneLine",
"deactivates",
"multiline",
"mode",
"if",
"online",
"argument",
"is",
"true",
"Default",
"is",
"false"
] | 9cfb19cb04c9f48489be15cbacac3d3af9d7706a | https://github.com/VerbalExpressions/GoVerbalExpressions/blob/9cfb19cb04c9f48489be15cbacac3d3af9d7706a/verbalexpressions.go#L346-L351 |
140,327 | VerbalExpressions/GoVerbalExpressions | verbalexpressions.go | MatchAllWithDot | func (v *VerbalExpression) MatchAllWithDot(enable bool) *VerbalExpression {
if enable {
return v.addmodifier(DOTALL)
}
return v.removemodifier(DOTALL)
} | go | func (v *VerbalExpression) MatchAllWithDot(enable bool) *VerbalExpression {
if enable {
return v.addmodifier(DOTALL)
}
return v.removemodifier(DOTALL)
} | [
"func",
"(",
"v",
"*",
"VerbalExpression",
")",
"MatchAllWithDot",
"(",
"enable",
"bool",
")",
"*",
"VerbalExpression",
"{",
"if",
"enable",
"{",
"return",
"v",
".",
"addmodifier",
"(",
"DOTALL",
")",
"\n",
"}",
"\n",
"return",
"v",
".",
"removemodifier",
... | // MatchAllWithDot lets VerbalExpression matching "." for everything including \n, \r, and so on | [
"MatchAllWithDot",
"lets",
"VerbalExpression",
"matching",
".",
"for",
"everything",
"including",
"\\",
"n",
"\\",
"r",
"and",
"so",
"on"
] | 9cfb19cb04c9f48489be15cbacac3d3af9d7706a | https://github.com/VerbalExpressions/GoVerbalExpressions/blob/9cfb19cb04c9f48489be15cbacac3d3af9d7706a/verbalexpressions.go#L354-L359 |
140,328 | VerbalExpressions/GoVerbalExpressions | verbalexpressions.go | Regex | func (v *VerbalExpression) Regex() *regexp.Regexp {
if !v.compiled {
v.regexp = regexp.MustCompile(
strings.Join([]string{
strings.Join(v.parts, ""),
`(?` + v.getFlags() + `)`,
v.prefixes,
v.expression,
v.suffixes}, ""))
v.compiled = true
}
return v.regexp
} | go | func (v *VerbalExpression) Regex() *regexp.Regexp {
if !v.compiled {
v.regexp = regexp.MustCompile(
strings.Join([]string{
strings.Join(v.parts, ""),
`(?` + v.getFlags() + `)`,
v.prefixes,
v.expression,
v.suffixes}, ""))
v.compiled = true
}
return v.regexp
} | [
"func",
"(",
"v",
"*",
"VerbalExpression",
")",
"Regex",
"(",
")",
"*",
"regexp",
".",
"Regexp",
"{",
"if",
"!",
"v",
".",
"compiled",
"{",
"v",
".",
"regexp",
"=",
"regexp",
".",
"MustCompile",
"(",
"strings",
".",
"Join",
"(",
"[",
"]",
"string",... | // Regex returns the regular expression to use to test on string. | [
"Regex",
"returns",
"the",
"regular",
"expression",
"to",
"use",
"to",
"test",
"on",
"string",
"."
] | 9cfb19cb04c9f48489be15cbacac3d3af9d7706a | https://github.com/VerbalExpressions/GoVerbalExpressions/blob/9cfb19cb04c9f48489be15cbacac3d3af9d7706a/verbalexpressions.go#L362-L375 |
140,329 | zenhotels/astranet | route/secondary.go | NewSecondaryLayer | func NewSecondaryLayer(cmp SecondaryCmpFunc) SecondaryLayer {
var synced uint64
return SecondaryLayer{
synced: &synced,
store: NewSecondaryTree(cmp),
offset: uint64(util.RevOffset()),
lock: lockie.NewLockie(),
cmp: cmp,
}
} | go | func NewSecondaryLayer(cmp SecondaryCmpFunc) SecondaryLayer {
var synced uint64
return SecondaryLayer{
synced: &synced,
store: NewSecondaryTree(cmp),
offset: uint64(util.RevOffset()),
lock: lockie.NewLockie(),
cmp: cmp,
}
} | [
"func",
"NewSecondaryLayer",
"(",
"cmp",
"SecondaryCmpFunc",
")",
"SecondaryLayer",
"{",
"var",
"synced",
"uint64",
"\n",
"return",
"SecondaryLayer",
"{",
"synced",
":",
"&",
"synced",
",",
"store",
":",
"NewSecondaryTree",
"(",
"cmp",
")",
",",
"offset",
":",... | // NewSecondaryLayer initializes a new secondary layer handle. | [
"NewSecondaryLayer",
"initializes",
"a",
"new",
"secondary",
"layer",
"handle",
"."
] | d8d973c9a29df370c1d53ba287661fa8e9b37956 | https://github.com/zenhotels/astranet/blob/d8d973c9a29df370c1d53ba287661fa8e9b37956/route/secondary.go#L30-L39 |
140,330 | zenhotels/astranet | route/secondary.go | Put | func (l SecondaryLayer) Put(k RouteInfo, finalizers ...func()) (added int) {
l.lock.Lock()
l.store.Put(k, func(oldV *FinalizerList, exists bool) (newV *FinalizerList, write bool) {
if !exists || oldV == nil {
if len(finalizers) == 0 {
return nil, true
}
oldV = &FinalizerList{}
}
for i := range fina... | go | func (l SecondaryLayer) Put(k RouteInfo, finalizers ...func()) (added int) {
l.lock.Lock()
l.store.Put(k, func(oldV *FinalizerList, exists bool) (newV *FinalizerList, write bool) {
if !exists || oldV == nil {
if len(finalizers) == 0 {
return nil, true
}
oldV = &FinalizerList{}
}
for i := range fina... | [
"func",
"(",
"l",
"SecondaryLayer",
")",
"Put",
"(",
"k",
"RouteInfo",
",",
"finalizers",
"...",
"func",
"(",
")",
")",
"(",
"added",
"int",
")",
"{",
"l",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"l",
".",
"store",
".",
"Put",
"(",
"k",
",",
... | // Put adds finalizers for the key, creating the item if not exists yet. | [
"Put",
"adds",
"finalizers",
"for",
"the",
"key",
"creating",
"the",
"item",
"if",
"not",
"exists",
"yet",
"."
] | d8d973c9a29df370c1d53ba287661fa8e9b37956 | https://github.com/zenhotels/astranet/blob/d8d973c9a29df370c1d53ba287661fa8e9b37956/route/secondary.go#L46-L64 |
140,331 | zenhotels/astranet | route/secondary.go | Seek | func (l SecondaryLayer) Seek(k RouteInfo) (e *SecondaryEnumerator, ok bool) {
l.lock.Lock()
e, ok = l.store.Seek(k)
l.lock.Unlock()
return
} | go | func (l SecondaryLayer) Seek(k RouteInfo) (e *SecondaryEnumerator, ok bool) {
l.lock.Lock()
e, ok = l.store.Seek(k)
l.lock.Unlock()
return
} | [
"func",
"(",
"l",
"SecondaryLayer",
")",
"Seek",
"(",
"k",
"RouteInfo",
")",
"(",
"e",
"*",
"SecondaryEnumerator",
",",
"ok",
"bool",
")",
"{",
"l",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"e",
",",
"ok",
"=",
"l",
".",
"store",
".",
"Seek",
... | // Seek returns an SecondaryEnumerator positioned on a key such that k >= key. | [
"Seek",
"returns",
"an",
"SecondaryEnumerator",
"positioned",
"on",
"a",
"key",
"such",
"that",
"k",
">",
"=",
"key",
"."
] | d8d973c9a29df370c1d53ba287661fa8e9b37956 | https://github.com/zenhotels/astranet/blob/d8d973c9a29df370c1d53ba287661fa8e9b37956/route/secondary.go#L87-L92 |
140,332 | zenhotels/astranet | route/secondary.go | SeekFirst | func (l SecondaryLayer) SeekFirst() (e *SecondaryEnumerator, err error) {
l.lock.Lock()
e, err = l.store.SeekFirst()
l.lock.Unlock()
return
} | go | func (l SecondaryLayer) SeekFirst() (e *SecondaryEnumerator, err error) {
l.lock.Lock()
e, err = l.store.SeekFirst()
l.lock.Unlock()
return
} | [
"func",
"(",
"l",
"SecondaryLayer",
")",
"SeekFirst",
"(",
")",
"(",
"e",
"*",
"SecondaryEnumerator",
",",
"err",
"error",
")",
"{",
"l",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"e",
",",
"err",
"=",
"l",
".",
"store",
".",
"SeekFirst",
"(",
")... | // SeekFirst returns an SecondaryEnumerator positioned on the first key in the tree. | [
"SeekFirst",
"returns",
"an",
"SecondaryEnumerator",
"positioned",
"on",
"the",
"first",
"key",
"in",
"the",
"tree",
"."
] | d8d973c9a29df370c1d53ba287661fa8e9b37956 | https://github.com/zenhotels/astranet/blob/d8d973c9a29df370c1d53ba287661fa8e9b37956/route/secondary.go#L95-L100 |
140,333 | zenhotels/astranet | route/secondary.go | Delete | func (l SecondaryLayer) Delete(k RouteInfo) (ok bool) {
l.lock.Lock()
v, found := l.store.Get(k)
if found {
ok = l.store.Delete(k)
}
l.lock.Unlock()
if found && v != nil {
v.Finalize()
}
return
} | go | func (l SecondaryLayer) Delete(k RouteInfo) (ok bool) {
l.lock.Lock()
v, found := l.store.Get(k)
if found {
ok = l.store.Delete(k)
}
l.lock.Unlock()
if found && v != nil {
v.Finalize()
}
return
} | [
"func",
"(",
"l",
"SecondaryLayer",
")",
"Delete",
"(",
"k",
"RouteInfo",
")",
"(",
"ok",
"bool",
")",
"{",
"l",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"v",
",",
"found",
":=",
"l",
".",
"store",
".",
"Get",
"(",
"k",
")",
"\n",
"if",
"fou... | // Delete removes the key and runs all its finalizers. | [
"Delete",
"removes",
"the",
"key",
"and",
"runs",
"all",
"its",
"finalizers",
"."
] | d8d973c9a29df370c1d53ba287661fa8e9b37956 | https://github.com/zenhotels/astranet/blob/d8d973c9a29df370c1d53ba287661fa8e9b37956/route/secondary.go#L103-L114 |
140,334 | zenhotels/astranet | route/secondary.go | Finalize | func (l SecondaryLayer) Finalize() {
l.lock.Lock()
e, err := l.store.SeekFirst()
if err != io.EOF {
_, v, err := e.Next()
for err != io.EOF {
if v != nil {
v.Finalize()
}
_, v, err = e.Next()
}
e.Close()
}
l.lock.Unlock()
} | go | func (l SecondaryLayer) Finalize() {
l.lock.Lock()
e, err := l.store.SeekFirst()
if err != io.EOF {
_, v, err := e.Next()
for err != io.EOF {
if v != nil {
v.Finalize()
}
_, v, err = e.Next()
}
e.Close()
}
l.lock.Unlock()
} | [
"func",
"(",
"l",
"SecondaryLayer",
")",
"Finalize",
"(",
")",
"{",
"l",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"e",
",",
"err",
":=",
"l",
".",
"store",
".",
"SeekFirst",
"(",
")",
"\n",
"if",
"err",
"!=",
"io",
".",
"EOF",
"{",
"_",
",",... | // Finalize locks the layer and runs finalizers of all the keys
// from this layer. Call this if you're going to drop an entire layer. | [
"Finalize",
"locks",
"the",
"layer",
"and",
"runs",
"finalizers",
"of",
"all",
"the",
"keys",
"from",
"this",
"layer",
".",
"Call",
"this",
"if",
"you",
"re",
"going",
"to",
"drop",
"an",
"entire",
"layer",
"."
] | d8d973c9a29df370c1d53ba287661fa8e9b37956 | https://github.com/zenhotels/astranet/blob/d8d973c9a29df370c1d53ba287661fa8e9b37956/route/secondary.go#L122-L136 |
140,335 | zenhotels/astranet | service/primary_btree.go | Seek | func (t *PrimaryTree) Seek(k string) (e *PrimaryEnumerator, ok bool) {
q := t.r
if q == nil {
e = btEPool1.get(nil, false, 0, k, nil, t, atomic.LoadUint64(&t.ver))
return
}
for {
var i int
if i, ok = t.find(q, k); ok {
switch x := q.(type) {
case *x1:
q = x.x[i+1].ch
continue
case *d1:
... | go | func (t *PrimaryTree) Seek(k string) (e *PrimaryEnumerator, ok bool) {
q := t.r
if q == nil {
e = btEPool1.get(nil, false, 0, k, nil, t, atomic.LoadUint64(&t.ver))
return
}
for {
var i int
if i, ok = t.find(q, k); ok {
switch x := q.(type) {
case *x1:
q = x.x[i+1].ch
continue
case *d1:
... | [
"func",
"(",
"t",
"*",
"PrimaryTree",
")",
"Seek",
"(",
"k",
"string",
")",
"(",
"e",
"*",
"PrimaryEnumerator",
",",
"ok",
"bool",
")",
"{",
"q",
":=",
"t",
".",
"r",
"\n",
"if",
"q",
"==",
"nil",
"{",
"e",
"=",
"btEPool1",
".",
"get",
"(",
"... | // Seek returns an PrimaryEnumerator positioned on an item such that k >= item's key.
// ok reports if k == item.key The PrimaryEnumerator's position is possibly after the
// last item in the tree. | [
"Seek",
"returns",
"an",
"PrimaryEnumerator",
"positioned",
"on",
"an",
"item",
"such",
"that",
"k",
">",
"=",
"item",
"s",
"key",
".",
"ok",
"reports",
"if",
"k",
"==",
"item",
".",
"key",
"The",
"PrimaryEnumerator",
"s",
"position",
"is",
"possibly",
"... | d8d973c9a29df370c1d53ba287661fa8e9b37956 | https://github.com/zenhotels/astranet/blob/d8d973c9a29df370c1d53ba287661fa8e9b37956/service/primary_btree.go#L474-L500 |
140,336 | zenhotels/astranet | service/primary.go | NewPrimaryLayer | func NewPrimaryLayer(cmp1 PrimaryCmpFunc, cmp2 SecondaryCmpFunc) PrimaryLayer {
var synced uint64
return PrimaryLayer{
synced: &synced,
store: NewPrimaryTree(cmp1),
offset: uint64(util.RevOffset()),
lock: lockie.NewLockie(),
cmp1: cmp1,
cmp2: cmp2,
}
} | go | func NewPrimaryLayer(cmp1 PrimaryCmpFunc, cmp2 SecondaryCmpFunc) PrimaryLayer {
var synced uint64
return PrimaryLayer{
synced: &synced,
store: NewPrimaryTree(cmp1),
offset: uint64(util.RevOffset()),
lock: lockie.NewLockie(),
cmp1: cmp1,
cmp2: cmp2,
}
} | [
"func",
"NewPrimaryLayer",
"(",
"cmp1",
"PrimaryCmpFunc",
",",
"cmp2",
"SecondaryCmpFunc",
")",
"PrimaryLayer",
"{",
"var",
"synced",
"uint64",
"\n",
"return",
"PrimaryLayer",
"{",
"synced",
":",
"&",
"synced",
",",
"store",
":",
"NewPrimaryTree",
"(",
"cmp1",
... | // NewPrimaryLayer initializes a new primary layer handle. | [
"NewPrimaryLayer",
"initializes",
"a",
"new",
"primary",
"layer",
"handle",
"."
] | d8d973c9a29df370c1d53ba287661fa8e9b37956 | https://github.com/zenhotels/astranet/blob/d8d973c9a29df370c1d53ba287661fa8e9b37956/service/primary.go#L30-L40 |
140,337 | zenhotels/astranet | service/primary.go | Set | func (l PrimaryLayer) Set(k string, layer SecondaryLayer) {
l.lock.Lock()
l.store.Put(k, func(oldLayer SecondaryLayer, exists bool) (newLayer SecondaryLayer, write bool) {
if exists {
oldLayer.Finalize()
}
return layer, true
})
l.lock.Unlock()
} | go | func (l PrimaryLayer) Set(k string, layer SecondaryLayer) {
l.lock.Lock()
l.store.Put(k, func(oldLayer SecondaryLayer, exists bool) (newLayer SecondaryLayer, write bool) {
if exists {
oldLayer.Finalize()
}
return layer, true
})
l.lock.Unlock()
} | [
"func",
"(",
"l",
"PrimaryLayer",
")",
"Set",
"(",
"k",
"string",
",",
"layer",
"SecondaryLayer",
")",
"{",
"l",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"l",
".",
"store",
".",
"Put",
"(",
"k",
",",
"func",
"(",
"oldLayer",
"SecondaryLayer",
",",... | // Set just adds a secondary layer to the tree, overwriting the previous one.
// Note that this action would trigger the replaced layer finalizers. | [
"Set",
"just",
"adds",
"a",
"secondary",
"layer",
"to",
"the",
"tree",
"overwriting",
"the",
"previous",
"one",
".",
"Note",
"that",
"this",
"action",
"would",
"trigger",
"the",
"replaced",
"layer",
"finalizers",
"."
] | d8d973c9a29df370c1d53ba287661fa8e9b37956 | https://github.com/zenhotels/astranet/blob/d8d973c9a29df370c1d53ba287661fa8e9b37956/service/primary.go#L44-L53 |
140,338 | zenhotels/astranet | service/primary.go | Put | func (l PrimaryLayer) Put(k string, k2 ServiceInfo, finalizers ...func()) {
l.lock.Lock()
l.store.Put(k, func(oldLayer SecondaryLayer, exists bool) (newLayer SecondaryLayer, write bool) {
if !exists {
oldLayer = NewSecondaryLayer(l.cmp2)
}
oldLayer.Put(k2, finalizers...)
return oldLayer, true
})
l.lock.U... | go | func (l PrimaryLayer) Put(k string, k2 ServiceInfo, finalizers ...func()) {
l.lock.Lock()
l.store.Put(k, func(oldLayer SecondaryLayer, exists bool) (newLayer SecondaryLayer, write bool) {
if !exists {
oldLayer = NewSecondaryLayer(l.cmp2)
}
oldLayer.Put(k2, finalizers...)
return oldLayer, true
})
l.lock.U... | [
"func",
"(",
"l",
"PrimaryLayer",
")",
"Put",
"(",
"k",
"string",
",",
"k2",
"ServiceInfo",
",",
"finalizers",
"...",
"func",
"(",
")",
")",
"{",
"l",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"l",
".",
"store",
".",
"Put",
"(",
"k",
",",
"func... | // Put adds keys and callbacks to the secondary layer, which will be created
// if not yet existing. | [
"Put",
"adds",
"keys",
"and",
"callbacks",
"to",
"the",
"secondary",
"layer",
"which",
"will",
"be",
"created",
"if",
"not",
"yet",
"existing",
"."
] | d8d973c9a29df370c1d53ba287661fa8e9b37956 | https://github.com/zenhotels/astranet/blob/d8d973c9a29df370c1d53ba287661fa8e9b37956/service/primary.go#L61-L71 |
140,339 | zenhotels/astranet | service/primary.go | Seek | func (l PrimaryLayer) Seek(k string) (e *PrimaryEnumerator, ok bool) {
l.lock.Lock()
e, ok = l.store.Seek(k)
l.lock.Unlock()
return
} | go | func (l PrimaryLayer) Seek(k string) (e *PrimaryEnumerator, ok bool) {
l.lock.Lock()
e, ok = l.store.Seek(k)
l.lock.Unlock()
return
} | [
"func",
"(",
"l",
"PrimaryLayer",
")",
"Seek",
"(",
"k",
"string",
")",
"(",
"e",
"*",
"PrimaryEnumerator",
",",
"ok",
"bool",
")",
"{",
"l",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"e",
",",
"ok",
"=",
"l",
".",
"store",
".",
"Seek",
"(",
... | // Seek returns an PrimaryEnumerator positioned on a secondary layer such that k >= layer's key. | [
"Seek",
"returns",
"an",
"PrimaryEnumerator",
"positioned",
"on",
"a",
"secondary",
"layer",
"such",
"that",
"k",
">",
"=",
"layer",
"s",
"key",
"."
] | d8d973c9a29df370c1d53ba287661fa8e9b37956 | https://github.com/zenhotels/astranet/blob/d8d973c9a29df370c1d53ba287661fa8e9b37956/service/primary.go#L74-L79 |
140,340 | zenhotels/astranet | service/primary.go | SeekFirst | func (l PrimaryLayer) SeekFirst() (e *PrimaryEnumerator, err error) {
l.lock.Lock()
e, err = l.store.SeekFirst()
l.lock.Unlock()
return
} | go | func (l PrimaryLayer) SeekFirst() (e *PrimaryEnumerator, err error) {
l.lock.Lock()
e, err = l.store.SeekFirst()
l.lock.Unlock()
return
} | [
"func",
"(",
"l",
"PrimaryLayer",
")",
"SeekFirst",
"(",
")",
"(",
"e",
"*",
"PrimaryEnumerator",
",",
"err",
"error",
")",
"{",
"l",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"e",
",",
"err",
"=",
"l",
".",
"store",
".",
"SeekFirst",
"(",
")",
... | // SeekFirst returns an PrimaryEnumerator positioned on the first secondary layer in the tree. | [
"SeekFirst",
"returns",
"an",
"PrimaryEnumerator",
"positioned",
"on",
"the",
"first",
"secondary",
"layer",
"in",
"the",
"tree",
"."
] | d8d973c9a29df370c1d53ba287661fa8e9b37956 | https://github.com/zenhotels/astranet/blob/d8d973c9a29df370c1d53ba287661fa8e9b37956/service/primary.go#L82-L87 |
140,341 | zenhotels/astranet | service/primary.go | Get | func (l PrimaryLayer) Get(k string) (layer SecondaryLayer, ok bool) {
l.lock.Lock()
v, ok := l.store.Get(k)
l.lock.Unlock()
return v, ok
} | go | func (l PrimaryLayer) Get(k string) (layer SecondaryLayer, ok bool) {
l.lock.Lock()
v, ok := l.store.Get(k)
l.lock.Unlock()
return v, ok
} | [
"func",
"(",
"l",
"PrimaryLayer",
")",
"Get",
"(",
"k",
"string",
")",
"(",
"layer",
"SecondaryLayer",
",",
"ok",
"bool",
")",
"{",
"l",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"v",
",",
"ok",
":=",
"l",
".",
"store",
".",
"Get",
"(",
"k",
... | // Get returns the secondary layer associated with the key. | [
"Get",
"returns",
"the",
"secondary",
"layer",
"associated",
"with",
"the",
"key",
"."
] | d8d973c9a29df370c1d53ba287661fa8e9b37956 | https://github.com/zenhotels/astranet/blob/d8d973c9a29df370c1d53ba287661fa8e9b37956/service/primary.go#L126-L131 |
140,342 | mailgun/mailgun-go | ips.go | GetIP | func (mg *MailgunImpl) GetIP(ctx context.Context, ip string) (IPAddress, error) {
r := newHTTPRequest(generatePublicApiUrl(mg, ipsEndpoint) + "/" + ip)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
var resp IPAddress
err := getResponseFromJSON(ctx, r, &resp)
return resp, err
} | go | func (mg *MailgunImpl) GetIP(ctx context.Context, ip string) (IPAddress, error) {
r := newHTTPRequest(generatePublicApiUrl(mg, ipsEndpoint) + "/" + ip)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
var resp IPAddress
err := getResponseFromJSON(ctx, r, &resp)
return resp, err
} | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"GetIP",
"(",
"ctx",
"context",
".",
"Context",
",",
"ip",
"string",
")",
"(",
"IPAddress",
",",
"error",
")",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generatePublicApiUrl",
"(",
"mg",
",",
"ipsEndpoint",
")",
... | // GetIP returns information about the specified IP | [
"GetIP",
"returns",
"information",
"about",
"the",
"specified",
"IP"
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/ips.go#L42-L49 |
140,343 | mailgun/mailgun-go | ips.go | ListDomainIPS | func (mg *MailgunImpl) ListDomainIPS(ctx context.Context) ([]IPAddress, error) {
r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + mg.domain + "/ips")
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
var resp ipAddressListResponse
if err := getResponseFromJSON(ctx, r, &resp)... | go | func (mg *MailgunImpl) ListDomainIPS(ctx context.Context) ([]IPAddress, error) {
r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + mg.domain + "/ips")
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
var resp ipAddressListResponse
if err := getResponseFromJSON(ctx, r, &resp)... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"ListDomainIPS",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"[",
"]",
"IPAddress",
",",
"error",
")",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generatePublicApiUrl",
"(",
"mg",
",",
"domainsEndpoint",
")",
... | // ListDomainIPS returns a list of IPs currently assigned to the specified domain. | [
"ListDomainIPS",
"returns",
"a",
"list",
"of",
"IPs",
"currently",
"assigned",
"to",
"the",
"specified",
"domain",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/ips.go#L52-L66 |
140,344 | mailgun/mailgun-go | ips.go | AddDomainIP | func (mg *MailgunImpl) AddDomainIP(ctx context.Context, ip string) error {
r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + mg.domain + "/ips")
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
payload := newUrlEncodedPayload()
payload.addValue("ip", ip)
_, err := makePostR... | go | func (mg *MailgunImpl) AddDomainIP(ctx context.Context, ip string) error {
r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + mg.domain + "/ips")
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
payload := newUrlEncodedPayload()
payload.addValue("ip", ip)
_, err := makePostR... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"AddDomainIP",
"(",
"ctx",
"context",
".",
"Context",
",",
"ip",
"string",
")",
"error",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generatePublicApiUrl",
"(",
"mg",
",",
"domainsEndpoint",
")",
"+",
"\"",
"\"",
"... | // Assign a dedicated IP to the domain specified. | [
"Assign",
"a",
"dedicated",
"IP",
"to",
"the",
"domain",
"specified",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/ips.go#L69-L78 |
140,345 | mailgun/mailgun-go | ips.go | DeleteDomainIP | func (mg *MailgunImpl) DeleteDomainIP(ctx context.Context, ip string) error {
r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + mg.domain + "/ips/" + ip)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
_, err := makeDeleteRequest(ctx, r)
return err
} | go | func (mg *MailgunImpl) DeleteDomainIP(ctx context.Context, ip string) error {
r := newHTTPRequest(generatePublicApiUrl(mg, domainsEndpoint) + "/" + mg.domain + "/ips/" + ip)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
_, err := makeDeleteRequest(ctx, r)
return err
} | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"DeleteDomainIP",
"(",
"ctx",
"context",
".",
"Context",
",",
"ip",
"string",
")",
"error",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generatePublicApiUrl",
"(",
"mg",
",",
"domainsEndpoint",
")",
"+",
"\"",
"\"",
... | // Unassign an IP from the domain specified. | [
"Unassign",
"an",
"IP",
"from",
"the",
"domain",
"specified",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/ips.go#L81-L87 |
140,346 | mailgun/mailgun-go | credentials.go | CreateCredential | func (mg *MailgunImpl) CreateCredential(ctx context.Context, login, password string) error {
if (login == "") || (password == "") {
return ErrEmptyParam
}
r := newHTTPRequest(generateCredentialsUrl(mg, ""))
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
p := newUrlEncodedPayload()
p.addVal... | go | func (mg *MailgunImpl) CreateCredential(ctx context.Context, login, password string) error {
if (login == "") || (password == "") {
return ErrEmptyParam
}
r := newHTTPRequest(generateCredentialsUrl(mg, ""))
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
p := newUrlEncodedPayload()
p.addVal... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"CreateCredential",
"(",
"ctx",
"context",
".",
"Context",
",",
"login",
",",
"password",
"string",
")",
"error",
"{",
"if",
"(",
"login",
"==",
"\"",
"\"",
")",
"||",
"(",
"password",
"==",
"\"",
"\"",
")"... | // CreateCredential attempts to create associate a new principle with your domain. | [
"CreateCredential",
"attempts",
"to",
"create",
"associate",
"a",
"new",
"principle",
"with",
"your",
"domain",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/credentials.go#L178-L190 |
140,347 | mailgun/mailgun-go | credentials.go | ChangeCredentialPassword | func (mg *MailgunImpl) ChangeCredentialPassword(ctx context.Context, id, password string) error {
if (id == "") || (password == "") {
return ErrEmptyParam
}
r := newHTTPRequest(generateCredentialsUrl(mg, id))
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
p := newUrlEncodedPayload()
p.addV... | go | func (mg *MailgunImpl) ChangeCredentialPassword(ctx context.Context, id, password string) error {
if (id == "") || (password == "") {
return ErrEmptyParam
}
r := newHTTPRequest(generateCredentialsUrl(mg, id))
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
p := newUrlEncodedPayload()
p.addV... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"ChangeCredentialPassword",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
",",
"password",
"string",
")",
"error",
"{",
"if",
"(",
"id",
"==",
"\"",
"\"",
")",
"||",
"(",
"password",
"==",
"\"",
"\"",
"... | // ChangeCredentialPassword attempts to alter the indicated credential's password. | [
"ChangeCredentialPassword",
"attempts",
"to",
"alter",
"the",
"indicated",
"credential",
"s",
"password",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/credentials.go#L193-L204 |
140,348 | mailgun/mailgun-go | credentials.go | DeleteCredential | func (mg *MailgunImpl) DeleteCredential(ctx context.Context, id string) error {
if id == "" {
return ErrEmptyParam
}
r := newHTTPRequest(generateCredentialsUrl(mg, id))
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
_, err := makeDeleteRequest(ctx, r)
return err
} | go | func (mg *MailgunImpl) DeleteCredential(ctx context.Context, id string) error {
if id == "" {
return ErrEmptyParam
}
r := newHTTPRequest(generateCredentialsUrl(mg, id))
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
_, err := makeDeleteRequest(ctx, r)
return err
} | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"DeleteCredential",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"string",
")",
"error",
"{",
"if",
"id",
"==",
"\"",
"\"",
"{",
"return",
"ErrEmptyParam",
"\n",
"}",
"\n",
"r",
":=",
"newHTTPRequest",
"... | // DeleteCredential attempts to remove the indicated principle from the domain. | [
"DeleteCredential",
"attempts",
"to",
"remove",
"the",
"indicated",
"principle",
"from",
"the",
"domain",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/credentials.go#L207-L216 |
140,349 | mailgun/mailgun-go | template_versions.go | AddTemplateVersion | func (mg *MailgunImpl) AddTemplateVersion(ctx context.Context, templateName string, version *TemplateVersion) error {
r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint) + "/" + templateName + "/versions")
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
payload := newUrlEncodedPayload()
... | go | func (mg *MailgunImpl) AddTemplateVersion(ctx context.Context, templateName string, version *TemplateVersion) error {
r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint) + "/" + templateName + "/versions")
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
payload := newUrlEncodedPayload()
... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"AddTemplateVersion",
"(",
"ctx",
"context",
".",
"Context",
",",
"templateName",
"string",
",",
"version",
"*",
"TemplateVersion",
")",
"error",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generateApiUrl",
"(",
"mg",
... | // AddTemplateVersion adds a template version to a template | [
"AddTemplateVersion",
"adds",
"a",
"template",
"version",
"to",
"a",
"template"
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/template_versions.go#L26-L53 |
140,350 | mailgun/mailgun-go | template_versions.go | GetTemplateVersion | func (mg *MailgunImpl) GetTemplateVersion(ctx context.Context, templateName, tag string) (TemplateVersion, error) {
r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint) + "/" + templateName + "/versions/" + tag)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
var resp templateResp
err := ... | go | func (mg *MailgunImpl) GetTemplateVersion(ctx context.Context, templateName, tag string) (TemplateVersion, error) {
r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint) + "/" + templateName + "/versions/" + tag)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
var resp templateResp
err := ... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"GetTemplateVersion",
"(",
"ctx",
"context",
".",
"Context",
",",
"templateName",
",",
"tag",
"string",
")",
"(",
"TemplateVersion",
",",
"error",
")",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generateApiUrl",
"(",
... | // GetTemplateVersion gets a specific version of a template | [
"GetTemplateVersion",
"gets",
"a",
"specific",
"version",
"of",
"a",
"template"
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/template_versions.go#L56-L67 |
140,351 | mailgun/mailgun-go | template_versions.go | UpdateTemplateVersion | func (mg *MailgunImpl) UpdateTemplateVersion(ctx context.Context, templateName string, version *TemplateVersion) error {
r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint) + "/" + templateName + "/versions/" + version.Tag)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
p := newUrlEncoded... | go | func (mg *MailgunImpl) UpdateTemplateVersion(ctx context.Context, templateName string, version *TemplateVersion) error {
r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint) + "/" + templateName + "/versions/" + version.Tag)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
p := newUrlEncoded... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"UpdateTemplateVersion",
"(",
"ctx",
"context",
".",
"Context",
",",
"templateName",
"string",
",",
"version",
"*",
"TemplateVersion",
")",
"error",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generateApiUrl",
"(",
"mg",... | // Update the comment and mark a version of a template active | [
"Update",
"the",
"comment",
"and",
"mark",
"a",
"version",
"of",
"a",
"template",
"active"
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/template_versions.go#L70-L90 |
140,352 | mailgun/mailgun-go | template_versions.go | DeleteTemplateVersion | func (mg *MailgunImpl) DeleteTemplateVersion(ctx context.Context, templateName, tag string) error {
r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint) + "/" + templateName + "/versions/" + tag)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
_, err := makeDeleteRequest(ctx, r)
return err... | go | func (mg *MailgunImpl) DeleteTemplateVersion(ctx context.Context, templateName, tag string) error {
r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint) + "/" + templateName + "/versions/" + tag)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
_, err := makeDeleteRequest(ctx, r)
return err... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"DeleteTemplateVersion",
"(",
"ctx",
"context",
".",
"Context",
",",
"templateName",
",",
"tag",
"string",
")",
"error",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generateApiUrl",
"(",
"mg",
",",
"templatesEndpoint",
... | // Delete a specific version of a template | [
"Delete",
"a",
"specific",
"version",
"of",
"a",
"template"
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/template_versions.go#L93-L99 |
140,353 | mailgun/mailgun-go | template_versions.go | ListTemplateVersions | func (mg *MailgunImpl) ListTemplateVersions(templateName string, opts *ListOptions) *TemplateVersionsIterator {
r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint) + "/" + templateName + "/versions")
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
if opts != nil {
if opts.Limit != 0 {
... | go | func (mg *MailgunImpl) ListTemplateVersions(templateName string, opts *ListOptions) *TemplateVersionsIterator {
r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint) + "/" + templateName + "/versions")
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
if opts != nil {
if opts.Limit != 0 {
... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"ListTemplateVersions",
"(",
"templateName",
"string",
",",
"opts",
"*",
"ListOptions",
")",
"*",
"TemplateVersionsIterator",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generateApiUrl",
"(",
"mg",
",",
"templatesEndpoint",
... | // List all the versions of a specific template | [
"List",
"all",
"the",
"versions",
"of",
"a",
"specific",
"template"
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/template_versions.go#L108-L123 |
140,354 | mailgun/mailgun-go | routes.go | ListRoutes | func (mg *MailgunImpl) ListRoutes(opts *ListOptions) *RoutesIterator {
var limit int
if opts != nil {
limit = opts.Limit
}
if limit == 0 {
limit = 100
}
return &RoutesIterator{
mg: mg,
url: generatePublicApiUrl(mg, routesEndpoint),
routesListResponse: routesListResponse{... | go | func (mg *MailgunImpl) ListRoutes(opts *ListOptions) *RoutesIterator {
var limit int
if opts != nil {
limit = opts.Limit
}
if limit == 0 {
limit = 100
}
return &RoutesIterator{
mg: mg,
url: generatePublicApiUrl(mg, routesEndpoint),
routesListResponse: routesListResponse{... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"ListRoutes",
"(",
"opts",
"*",
"ListOptions",
")",
"*",
"RoutesIterator",
"{",
"var",
"limit",
"int",
"\n",
"if",
"opts",
"!=",
"nil",
"{",
"limit",
"=",
"opts",
".",
"Limit",
"\n",
"}",
"\n\n",
"if",
"lim... | // ListRoutes allows you to iterate through a list of routes returned by the API | [
"ListRoutes",
"allows",
"you",
"to",
"iterate",
"through",
"a",
"list",
"of",
"routes",
"returned",
"by",
"the",
"API"
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/routes.go#L43-L59 |
140,355 | mailgun/mailgun-go | routes.go | CreateRoute | func (mg *MailgunImpl) CreateRoute(ctx context.Context, prototype Route) (_ignored Route, err error) {
r := newHTTPRequest(generatePublicApiUrl(mg, routesEndpoint))
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
p := newUrlEncodedPayload()
p.addValue("priority", strconv.Itoa(prototype.Priority... | go | func (mg *MailgunImpl) CreateRoute(ctx context.Context, prototype Route) (_ignored Route, err error) {
r := newHTTPRequest(generatePublicApiUrl(mg, routesEndpoint))
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
p := newUrlEncodedPayload()
p.addValue("priority", strconv.Itoa(prototype.Priority... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"CreateRoute",
"(",
"ctx",
"context",
".",
"Context",
",",
"prototype",
"Route",
")",
"(",
"_ignored",
"Route",
",",
"err",
"error",
")",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generatePublicApiUrl",
"(",
"mg",
... | // CreateRoute installs a new route for your domain.
// The route structure you provide serves as a template, and
// only a subset of the fields influence the operation.
// See the Route structure definition for more details. | [
"CreateRoute",
"installs",
"a",
"new",
"route",
"for",
"your",
"domain",
".",
"The",
"route",
"structure",
"you",
"provide",
"serves",
"as",
"a",
"template",
"and",
"only",
"a",
"subset",
"of",
"the",
"fields",
"influence",
"the",
"operation",
".",
"See",
... | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/routes.go#L199-L215 |
140,356 | mailgun/mailgun-go | routes.go | DeleteRoute | func (mg *MailgunImpl) DeleteRoute(ctx context.Context, id string) error {
r := newHTTPRequest(generatePublicApiUrl(mg, routesEndpoint) + "/" + id)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
_, err := makeDeleteRequest(ctx, r)
return err
} | go | func (mg *MailgunImpl) DeleteRoute(ctx context.Context, id string) error {
r := newHTTPRequest(generatePublicApiUrl(mg, routesEndpoint) + "/" + id)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
_, err := makeDeleteRequest(ctx, r)
return err
} | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"DeleteRoute",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"string",
")",
"error",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generatePublicApiUrl",
"(",
"mg",
",",
"routesEndpoint",
")",
"+",
"\"",
"\"",
"+... | // DeleteRoute removes the specified route from your domain's configuration.
// To avoid ambiguity, Mailgun identifies the route by unique ID.
// See the Route structure definition and the Mailgun API documentation for more details. | [
"DeleteRoute",
"removes",
"the",
"specified",
"route",
"from",
"your",
"domain",
"s",
"configuration",
".",
"To",
"avoid",
"ambiguity",
"Mailgun",
"identifies",
"the",
"route",
"by",
"unique",
"ID",
".",
"See",
"the",
"Route",
"structure",
"definition",
"and",
... | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/routes.go#L220-L226 |
140,357 | mailgun/mailgun-go | routes.go | GetRoute | func (mg *MailgunImpl) GetRoute(ctx context.Context, id string) (Route, error) {
r := newHTTPRequest(generatePublicApiUrl(mg, routesEndpoint) + "/" + id)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
var envelope struct {
Message string `json:"message"`
*Route `json:"route"`
}
err := ge... | go | func (mg *MailgunImpl) GetRoute(ctx context.Context, id string) (Route, error) {
r := newHTTPRequest(generatePublicApiUrl(mg, routesEndpoint) + "/" + id)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
var envelope struct {
Message string `json:"message"`
*Route `json:"route"`
}
err := ge... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"GetRoute",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"string",
")",
"(",
"Route",
",",
"error",
")",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generatePublicApiUrl",
"(",
"mg",
",",
"routesEndpoint",
")"... | // GetRoute retrieves the complete route definition associated with the unique route ID. | [
"GetRoute",
"retrieves",
"the",
"complete",
"route",
"definition",
"associated",
"with",
"the",
"unique",
"route",
"ID",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/routes.go#L229-L243 |
140,358 | mailgun/mailgun-go | routes.go | UpdateRoute | func (mg *MailgunImpl) UpdateRoute(ctx context.Context, id string, route Route) (Route, error) {
r := newHTTPRequest(generatePublicApiUrl(mg, routesEndpoint) + "/" + id)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
p := newUrlEncodedPayload()
if route.Priority != 0 {
p.addValue("priority",... | go | func (mg *MailgunImpl) UpdateRoute(ctx context.Context, id string, route Route) (Route, error) {
r := newHTTPRequest(generatePublicApiUrl(mg, routesEndpoint) + "/" + id)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
p := newUrlEncodedPayload()
if route.Priority != 0 {
p.addValue("priority",... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"UpdateRoute",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"string",
",",
"route",
"Route",
")",
"(",
"Route",
",",
"error",
")",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generatePublicApiUrl",
"(",
"mg",
... | // UpdateRoute provides an "in-place" update of the specified route.
// Only those route fields which are non-zero or non-empty are updated.
// All other fields remain as-is. | [
"UpdateRoute",
"provides",
"an",
"in",
"-",
"place",
"update",
"of",
"the",
"specified",
"route",
".",
"Only",
"those",
"route",
"fields",
"which",
"are",
"non",
"-",
"zero",
"or",
"non",
"-",
"empty",
"are",
"updated",
".",
"All",
"other",
"fields",
"re... | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/routes.go#L248-L272 |
140,359 | mailgun/mailgun-go | members.go | GetMember | func (mg *MailgunImpl) GetMember(ctx context.Context, s, l string) (Member, error) {
r := newHTTPRequest(generateMemberApiUrl(mg, listsEndpoint, l) + "/" + s)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
response, err := makeGetRequest(ctx, r)
if err != nil {
return Member{}, err
}
var r... | go | func (mg *MailgunImpl) GetMember(ctx context.Context, s, l string) (Member, error) {
r := newHTTPRequest(generateMemberApiUrl(mg, listsEndpoint, l) + "/" + s)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
response, err := makeGetRequest(ctx, r)
if err != nil {
return Member{}, err
}
var r... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"GetMember",
"(",
"ctx",
"context",
".",
"Context",
",",
"s",
",",
"l",
"string",
")",
"(",
"Member",
",",
"error",
")",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generateMemberApiUrl",
"(",
"mg",
",",
"listsEn... | // GetMember returns a complete Member structure for a member of a mailing list,
// given only their subscription e-mail address. | [
"GetMember",
"returns",
"a",
"complete",
"Member",
"structure",
"for",
"a",
"member",
"of",
"a",
"mailing",
"list",
"given",
"only",
"their",
"subscription",
"e",
"-",
"mail",
"address",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/members.go#L160-L171 |
140,360 | mailgun/mailgun-go | members.go | CreateMember | func (mg *MailgunImpl) CreateMember(ctx context.Context, merge bool, addr string, prototype Member) error {
vs, err := json.Marshal(prototype.Vars)
if err != nil {
return err
}
r := newHTTPRequest(generateMemberApiUrl(mg, listsEndpoint, addr))
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())... | go | func (mg *MailgunImpl) CreateMember(ctx context.Context, merge bool, addr string, prototype Member) error {
vs, err := json.Marshal(prototype.Vars)
if err != nil {
return err
}
r := newHTTPRequest(generateMemberApiUrl(mg, listsEndpoint, addr))
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"CreateMember",
"(",
"ctx",
"context",
".",
"Context",
",",
"merge",
"bool",
",",
"addr",
"string",
",",
"prototype",
"Member",
")",
"error",
"{",
"vs",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"prototy... | // CreateMember registers a new member of the indicated mailing list.
// If merge is set to true, then the registration may update an existing Member's settings.
// Otherwise, an error will occur if you attempt to add a member with a duplicate e-mail address. | [
"CreateMember",
"registers",
"a",
"new",
"member",
"of",
"the",
"indicated",
"mailing",
"list",
".",
"If",
"merge",
"is",
"set",
"to",
"true",
"then",
"the",
"registration",
"may",
"update",
"an",
"existing",
"Member",
"s",
"settings",
".",
"Otherwise",
"an"... | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/members.go#L176-L195 |
140,361 | mailgun/mailgun-go | members.go | UpdateMember | func (mg *MailgunImpl) UpdateMember(ctx context.Context, s, l string, prototype Member) (Member, error) {
r := newHTTPRequest(generateMemberApiUrl(mg, listsEndpoint, l) + "/" + s)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
p := newFormDataPayload()
if prototype.Address != "" {
p.addValue... | go | func (mg *MailgunImpl) UpdateMember(ctx context.Context, s, l string, prototype Member) (Member, error) {
r := newHTTPRequest(generateMemberApiUrl(mg, listsEndpoint, l) + "/" + s)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
p := newFormDataPayload()
if prototype.Address != "" {
p.addValue... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"UpdateMember",
"(",
"ctx",
"context",
".",
"Context",
",",
"s",
",",
"l",
"string",
",",
"prototype",
"Member",
")",
"(",
"Member",
",",
"error",
")",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generateMemberApiU... | // UpdateMember lets you change certain details about the indicated mailing list member.
// Address, Name, Vars, and Subscribed fields may be changed. | [
"UpdateMember",
"lets",
"you",
"change",
"certain",
"details",
"about",
"the",
"indicated",
"mailing",
"list",
"member",
".",
"Address",
"Name",
"Vars",
"and",
"Subscribed",
"fields",
"may",
"be",
"changed",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/members.go#L199-L229 |
140,362 | mailgun/mailgun-go | members.go | DeleteMember | func (mg *MailgunImpl) DeleteMember(ctx context.Context, member, addr string) error {
r := newHTTPRequest(generateMemberApiUrl(mg, listsEndpoint, addr) + "/" + member)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
_, err := makeDeleteRequest(ctx, r)
return err
} | go | func (mg *MailgunImpl) DeleteMember(ctx context.Context, member, addr string) error {
r := newHTTPRequest(generateMemberApiUrl(mg, listsEndpoint, addr) + "/" + member)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
_, err := makeDeleteRequest(ctx, r)
return err
} | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"DeleteMember",
"(",
"ctx",
"context",
".",
"Context",
",",
"member",
",",
"addr",
"string",
")",
"error",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generateMemberApiUrl",
"(",
"mg",
",",
"listsEndpoint",
",",
"add... | // DeleteMember removes the member from the list. | [
"DeleteMember",
"removes",
"the",
"member",
"from",
"the",
"list",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/members.go#L232-L238 |
140,363 | mailgun/mailgun-go | mock.go | NewMockServer | func NewMockServer() MockServer {
ms := MockServer{}
// Add all our handlers
r := chi.NewRouter()
r.Route("/v3", func(r chi.Router) {
ms.addIPRoutes(r)
ms.addExportRoutes(r)
ms.addDomainRoutes(r)
ms.addMailingListRoutes(r)
ms.addEventRoutes(r)
ms.addMessagesRoutes(r)
ms.addValidationRoutes(r)
ms.a... | go | func NewMockServer() MockServer {
ms := MockServer{}
// Add all our handlers
r := chi.NewRouter()
r.Route("/v3", func(r chi.Router) {
ms.addIPRoutes(r)
ms.addExportRoutes(r)
ms.addDomainRoutes(r)
ms.addMailingListRoutes(r)
ms.addEventRoutes(r)
ms.addMessagesRoutes(r)
ms.addValidationRoutes(r)
ms.a... | [
"func",
"NewMockServer",
"(",
")",
"MockServer",
"{",
"ms",
":=",
"MockServer",
"{",
"}",
"\n\n",
"// Add all our handlers",
"r",
":=",
"chi",
".",
"NewRouter",
"(",
")",
"\n\n",
"r",
".",
"Route",
"(",
"\"",
"\"",
",",
"func",
"(",
"r",
"chi",
".",
... | // Create a new instance of the mailgun API mock server | [
"Create",
"a",
"new",
"instance",
"of",
"the",
"mailgun",
"API",
"mock",
"server"
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/mock.go#L30-L50 |
140,364 | mailgun/mailgun-go | mock.go | pageOffsets | func pageOffsets(pivotIdx []string, pivotDir, pivotVal string, limit int) (int, int) {
switch pivotDir {
case "first":
if limit < len(pivotIdx) {
return 0, limit
}
return 0, len(pivotIdx)
case "last":
if limit < len(pivotIdx) {
return len(pivotIdx) - limit, len(pivotIdx)
}
return 0, len(pivotIdx)
... | go | func pageOffsets(pivotIdx []string, pivotDir, pivotVal string, limit int) (int, int) {
switch pivotDir {
case "first":
if limit < len(pivotIdx) {
return 0, limit
}
return 0, len(pivotIdx)
case "last":
if limit < len(pivotIdx) {
return len(pivotIdx) - limit, len(pivotIdx)
}
return 0, len(pivotIdx)
... | [
"func",
"pageOffsets",
"(",
"pivotIdx",
"[",
"]",
"string",
",",
"pivotDir",
",",
"pivotVal",
"string",
",",
"limit",
"int",
")",
"(",
"int",
",",
"int",
")",
"{",
"switch",
"pivotDir",
"{",
"case",
"\"",
"\"",
":",
"if",
"limit",
"<",
"len",
"(",
... | // Given the page direction, pivot value and limit, calculate the offsets for the slice | [
"Given",
"the",
"page",
"direction",
"pivot",
"value",
"and",
"limit",
"calculate",
"the",
"offsets",
"for",
"the",
"slice"
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/mock.go#L123-L167 |
140,365 | mailgun/mailgun-go | spam_complaints.go | ListComplaints | func (mg *MailgunImpl) ListComplaints(opts *ListOptions) *ComplaintsIterator {
r := newHTTPRequest(generateApiUrl(mg, complaintsEndpoint))
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
if opts != nil {
if opts.Limit != 0 {
r.addParameter("limit", strconv.Itoa(opts.Limit))
}
}
url, err... | go | func (mg *MailgunImpl) ListComplaints(opts *ListOptions) *ComplaintsIterator {
r := newHTTPRequest(generateApiUrl(mg, complaintsEndpoint))
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
if opts != nil {
if opts.Limit != 0 {
r.addParameter("limit", strconv.Itoa(opts.Limit))
}
}
url, err... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"ListComplaints",
"(",
"opts",
"*",
"ListOptions",
")",
"*",
"ComplaintsIterator",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generateApiUrl",
"(",
"mg",
",",
"complaintsEndpoint",
")",
")",
"\n",
"r",
".",
"setClient... | // ListComplaints returns a set of spam complaints registered against your domain.
// Recipients of your messages can click on a link which sends feedback to Mailgun
// indicating that the message they received is, to them, spam. | [
"ListComplaints",
"returns",
"a",
"set",
"of",
"spam",
"complaints",
"registered",
"against",
"your",
"domain",
".",
"Recipients",
"of",
"your",
"messages",
"can",
"click",
"on",
"a",
"link",
"which",
"sends",
"feedback",
"to",
"Mailgun",
"indicating",
"that",
... | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/spam_complaints.go#L28-L43 |
140,366 | mailgun/mailgun-go | spam_complaints.go | GetComplaint | func (mg *MailgunImpl) GetComplaint(ctx context.Context, address string) (Complaint, error) {
r := newHTTPRequest(generateApiUrl(mg, complaintsEndpoint) + "/" + address)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
var c Complaint
err := getResponseFromJSON(ctx, r, &c)
return c, err
} | go | func (mg *MailgunImpl) GetComplaint(ctx context.Context, address string) (Complaint, error) {
r := newHTTPRequest(generateApiUrl(mg, complaintsEndpoint) + "/" + address)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
var c Complaint
err := getResponseFromJSON(ctx, r, &c)
return c, err
} | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"GetComplaint",
"(",
"ctx",
"context",
".",
"Context",
",",
"address",
"string",
")",
"(",
"Complaint",
",",
"error",
")",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generateApiUrl",
"(",
"mg",
",",
"complaintsEndpo... | // GetComplaint returns a single complaint record filed by a recipient at the email address provided.
// If no complaint exists, the Complaint instance returned will be empty. | [
"GetComplaint",
"returns",
"a",
"single",
"complaint",
"record",
"filed",
"by",
"a",
"recipient",
"at",
"the",
"email",
"address",
"provided",
".",
"If",
"no",
"complaint",
"exists",
"the",
"Complaint",
"instance",
"returned",
"will",
"be",
"empty",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/spam_complaints.go#L144-L152 |
140,367 | mailgun/mailgun-go | mailgun.go | NewMailgun | func NewMailgun(domain, apiKey string) *MailgunImpl {
return &MailgunImpl{
apiBase: APIBase,
domain: domain,
apiKey: apiKey,
client: http.DefaultClient,
}
} | go | func NewMailgun(domain, apiKey string) *MailgunImpl {
return &MailgunImpl{
apiBase: APIBase,
domain: domain,
apiKey: apiKey,
client: http.DefaultClient,
}
} | [
"func",
"NewMailgun",
"(",
"domain",
",",
"apiKey",
"string",
")",
"*",
"MailgunImpl",
"{",
"return",
"&",
"MailgunImpl",
"{",
"apiBase",
":",
"APIBase",
",",
"domain",
":",
"domain",
",",
"apiKey",
":",
"apiKey",
",",
"client",
":",
"http",
".",
"Defaul... | // NewMailGun creates a new client instance. | [
"NewMailGun",
"creates",
"a",
"new",
"client",
"instance",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/mailgun.go#L242-L249 |
140,368 | mailgun/mailgun-go | mailgun.go | NewMailgunFromEnv | func NewMailgunFromEnv() (*MailgunImpl, error) {
apiKey := os.Getenv("MG_API_KEY")
if apiKey == "" {
return nil, errors.New("required environment variable MG_API_KEY not defined")
}
domain := os.Getenv("MG_DOMAIN")
if domain == "" {
return nil, errors.New("required environment variable MG_DOMAIN not defined")
... | go | func NewMailgunFromEnv() (*MailgunImpl, error) {
apiKey := os.Getenv("MG_API_KEY")
if apiKey == "" {
return nil, errors.New("required environment variable MG_API_KEY not defined")
}
domain := os.Getenv("MG_DOMAIN")
if domain == "" {
return nil, errors.New("required environment variable MG_DOMAIN not defined")
... | [
"func",
"NewMailgunFromEnv",
"(",
")",
"(",
"*",
"MailgunImpl",
",",
"error",
")",
"{",
"apiKey",
":=",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
"\n",
"if",
"apiKey",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
... | // NewMailgunFromEnv returns a new Mailgun client using the environment variables
// MG_API_KEY, MG_DOMAIN, and MG_URL | [
"NewMailgunFromEnv",
"returns",
"a",
"new",
"Mailgun",
"client",
"using",
"the",
"environment",
"variables",
"MG_API_KEY",
"MG_DOMAIN",
"and",
"MG_URL"
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/mailgun.go#L253-L271 |
140,369 | mailgun/mailgun-go | mailgun.go | generateApiUrlWithDomain | func generateApiUrlWithDomain(m Mailgun, endpoint, domain string) string {
return fmt.Sprintf("%s/%s/%s", m.APIBase(), domain, endpoint)
} | go | func generateApiUrlWithDomain(m Mailgun, endpoint, domain string) string {
return fmt.Sprintf("%s/%s/%s", m.APIBase(), domain, endpoint)
} | [
"func",
"generateApiUrlWithDomain",
"(",
"m",
"Mailgun",
",",
"endpoint",
",",
"domain",
"string",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"m",
".",
"APIBase",
"(",
")",
",",
"domain",
",",
"endpoint",
")",
"\n",
"}"
... | // generateApiUrlWithDomain renders a URL for an API endpoint using a separate domain and endpoint name. | [
"generateApiUrlWithDomain",
"renders",
"a",
"URL",
"for",
"an",
"API",
"endpoint",
"using",
"a",
"separate",
"domain",
"and",
"endpoint",
"name",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/mailgun.go#L309-L311 |
140,370 | mailgun/mailgun-go | mailgun.go | generateMemberApiUrl | func generateMemberApiUrl(m Mailgun, endpoint, address string) string {
return fmt.Sprintf("%s/%s/%s/members", m.APIBase(), endpoint, address)
} | go | func generateMemberApiUrl(m Mailgun, endpoint, address string) string {
return fmt.Sprintf("%s/%s/%s/members", m.APIBase(), endpoint, address)
} | [
"func",
"generateMemberApiUrl",
"(",
"m",
"Mailgun",
",",
"endpoint",
",",
"address",
"string",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"m",
".",
"APIBase",
"(",
")",
",",
"endpoint",
",",
"address",
")",
"\n",
"}"
] | // generateMemberApiUrl renders a URL relevant for specifying mailing list members.
// The address parameter refers to the mailing list in question. | [
"generateMemberApiUrl",
"renders",
"a",
"URL",
"relevant",
"for",
"specifying",
"mailing",
"list",
"members",
".",
"The",
"address",
"parameter",
"refers",
"to",
"the",
"mailing",
"list",
"in",
"question",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/mailgun.go#L315-L317 |
140,371 | mailgun/mailgun-go | mailgun.go | generateApiUrlWithTarget | func generateApiUrlWithTarget(m Mailgun, endpoint, target string) string {
tail := ""
if target != "" {
tail = fmt.Sprintf("/%s", target)
}
return fmt.Sprintf("%s%s", generateApiUrl(m, endpoint), tail)
} | go | func generateApiUrlWithTarget(m Mailgun, endpoint, target string) string {
tail := ""
if target != "" {
tail = fmt.Sprintf("/%s", target)
}
return fmt.Sprintf("%s%s", generateApiUrl(m, endpoint), tail)
} | [
"func",
"generateApiUrlWithTarget",
"(",
"m",
"Mailgun",
",",
"endpoint",
",",
"target",
"string",
")",
"string",
"{",
"tail",
":=",
"\"",
"\"",
"\n",
"if",
"target",
"!=",
"\"",
"\"",
"{",
"tail",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"t... | // generateApiUrlWithTarget works as generateApiUrl,
// but consumes an additional resource parameter called 'target'. | [
"generateApiUrlWithTarget",
"works",
"as",
"generateApiUrl",
"but",
"consumes",
"an",
"additional",
"resource",
"parameter",
"called",
"target",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/mailgun.go#L321-L327 |
140,372 | mailgun/mailgun-go | mailgun.go | generateDomainApiUrl | func generateDomainApiUrl(m Mailgun, endpoint string) string {
return fmt.Sprintf("%s/domains/%s/%s", m.APIBase(), m.Domain(), endpoint)
} | go | func generateDomainApiUrl(m Mailgun, endpoint string) string {
return fmt.Sprintf("%s/domains/%s/%s", m.APIBase(), m.Domain(), endpoint)
} | [
"func",
"generateDomainApiUrl",
"(",
"m",
"Mailgun",
",",
"endpoint",
"string",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"m",
".",
"APIBase",
"(",
")",
",",
"m",
".",
"Domain",
"(",
")",
",",
"endpoint",
")",
"\n",
... | // generateDomainApiUrl renders a URL as generateApiUrl, but
// addresses a family of functions which have a non-standard URL structure.
// Most URLs consume a domain in the 2nd position, but some endpoints
// require the word "domains" to be there instead. | [
"generateDomainApiUrl",
"renders",
"a",
"URL",
"as",
"generateApiUrl",
"but",
"addresses",
"a",
"family",
"of",
"functions",
"which",
"have",
"a",
"non",
"-",
"standard",
"URL",
"structure",
".",
"Most",
"URLs",
"consume",
"a",
"domain",
"in",
"the",
"2nd",
... | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/mailgun.go#L333-L335 |
140,373 | mailgun/mailgun-go | mailgun.go | generateCredentialsUrl | func generateCredentialsUrl(m Mailgun, id string) string {
tail := ""
if id != "" {
tail = fmt.Sprintf("/%s", id)
}
return generateDomainApiUrl(m, fmt.Sprintf("credentials%s", tail))
// return fmt.Sprintf("%s/domains/%s/credentials%s", apiBase, m.Domain(), tail)
} | go | func generateCredentialsUrl(m Mailgun, id string) string {
tail := ""
if id != "" {
tail = fmt.Sprintf("/%s", id)
}
return generateDomainApiUrl(m, fmt.Sprintf("credentials%s", tail))
// return fmt.Sprintf("%s/domains/%s/credentials%s", apiBase, m.Domain(), tail)
} | [
"func",
"generateCredentialsUrl",
"(",
"m",
"Mailgun",
",",
"id",
"string",
")",
"string",
"{",
"tail",
":=",
"\"",
"\"",
"\n",
"if",
"id",
"!=",
"\"",
"\"",
"{",
"tail",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"id",
")",
"\n",
"}",
"\n... | // generateCredentialsUrl renders a URL as generateDomainApiUrl,
// but focuses on the SMTP credentials family of API functions. | [
"generateCredentialsUrl",
"renders",
"a",
"URL",
"as",
"generateDomainApiUrl",
"but",
"focuses",
"on",
"the",
"SMTP",
"credentials",
"family",
"of",
"API",
"functions",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/mailgun.go#L339-L346 |
140,374 | mailgun/mailgun-go | mailgun.go | generateStoredMessageUrl | func generateStoredMessageUrl(m Mailgun, endpoint, id string) string {
return generateDomainApiUrl(m, fmt.Sprintf("%s/%s", endpoint, id))
// return fmt.Sprintf("%s/domains/%s/%s/%s", apiBase, m.Domain(), endpoint, id)
} | go | func generateStoredMessageUrl(m Mailgun, endpoint, id string) string {
return generateDomainApiUrl(m, fmt.Sprintf("%s/%s", endpoint, id))
// return fmt.Sprintf("%s/domains/%s/%s/%s", apiBase, m.Domain(), endpoint, id)
} | [
"func",
"generateStoredMessageUrl",
"(",
"m",
"Mailgun",
",",
"endpoint",
",",
"id",
"string",
")",
"string",
"{",
"return",
"generateDomainApiUrl",
"(",
"m",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"endpoint",
",",
"id",
")",
")",
"\n",
"// re... | // generateStoredMessageUrl generates the URL needed to acquire a copy of a stored message. | [
"generateStoredMessageUrl",
"generates",
"the",
"URL",
"needed",
"to",
"acquire",
"a",
"copy",
"of",
"a",
"stored",
"message",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/mailgun.go#L349-L352 |
140,375 | mailgun/mailgun-go | mailgun.go | generatePublicApiUrl | func generatePublicApiUrl(m Mailgun, endpoint string) string {
return fmt.Sprintf("%s/%s", m.APIBase(), endpoint)
} | go | func generatePublicApiUrl(m Mailgun, endpoint string) string {
return fmt.Sprintf("%s/%s", m.APIBase(), endpoint)
} | [
"func",
"generatePublicApiUrl",
"(",
"m",
"Mailgun",
",",
"endpoint",
"string",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"m",
".",
"APIBase",
"(",
")",
",",
"endpoint",
")",
"\n",
"}"
] | // generatePublicApiUrl works as generateApiUrl, except that generatePublicApiUrl has no need for the domain. | [
"generatePublicApiUrl",
"works",
"as",
"generateApiUrl",
"except",
"that",
"generatePublicApiUrl",
"has",
"no",
"need",
"for",
"the",
"domain",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/mailgun.go#L355-L357 |
140,376 | mailgun/mailgun-go | mailgun.go | generateParameterizedUrl | func generateParameterizedUrl(m Mailgun, endpoint string, payload payload) (string, error) {
paramBuffer, err := payload.getPayloadBuffer()
if err != nil {
return "", err
}
params := string(paramBuffer.Bytes())
return fmt.Sprintf("%s?%s", generateApiUrl(m, eventsEndpoint), params), nil
} | go | func generateParameterizedUrl(m Mailgun, endpoint string, payload payload) (string, error) {
paramBuffer, err := payload.getPayloadBuffer()
if err != nil {
return "", err
}
params := string(paramBuffer.Bytes())
return fmt.Sprintf("%s?%s", generateApiUrl(m, eventsEndpoint), params), nil
} | [
"func",
"generateParameterizedUrl",
"(",
"m",
"Mailgun",
",",
"endpoint",
"string",
",",
"payload",
"payload",
")",
"(",
"string",
",",
"error",
")",
"{",
"paramBuffer",
",",
"err",
":=",
"payload",
".",
"getPayloadBuffer",
"(",
")",
"\n",
"if",
"err",
"!=... | // generateParameterizedUrl works as generateApiUrl, but supports query parameters. | [
"generateParameterizedUrl",
"works",
"as",
"generateApiUrl",
"but",
"supports",
"query",
"parameters",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/mailgun.go#L360-L367 |
140,377 | mailgun/mailgun-go | mailgun.go | parseMailgunTime | func parseMailgunTime(ts string) (t time.Time, err error) {
t, err = time.Parse("Mon, 2 Jan 2006 15:04:05 MST", ts)
return
} | go | func parseMailgunTime(ts string) (t time.Time, err error) {
t, err = time.Parse("Mon, 2 Jan 2006 15:04:05 MST", ts)
return
} | [
"func",
"parseMailgunTime",
"(",
"ts",
"string",
")",
"(",
"t",
"time",
".",
"Time",
",",
"err",
"error",
")",
"{",
"t",
",",
"err",
"=",
"time",
".",
"Parse",
"(",
"\"",
"\"",
",",
"ts",
")",
"\n",
"return",
"\n",
"}"
] | // parseMailgunTime translates a timestamp as returned by Mailgun into a Go standard timestamp. | [
"parseMailgunTime",
"translates",
"a",
"timestamp",
"as",
"returned",
"by",
"Mailgun",
"into",
"a",
"Go",
"standard",
"timestamp",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/mailgun.go#L370-L373 |
140,378 | mailgun/mailgun-go | parse.go | new_ | func new_(e interface{}) func() Event {
typ := reflect.TypeOf(e)
return func() Event {
return reflect.New(typ).Interface().(Event)
}
} | go | func new_(e interface{}) func() Event {
typ := reflect.TypeOf(e)
return func() Event {
return reflect.New(typ).Interface().(Event)
}
} | [
"func",
"new_",
"(",
"e",
"interface",
"{",
"}",
")",
"func",
"(",
")",
"Event",
"{",
"typ",
":=",
"reflect",
".",
"TypeOf",
"(",
"e",
")",
"\n",
"return",
"func",
"(",
")",
"Event",
"{",
"return",
"reflect",
".",
"New",
"(",
"typ",
")",
".",
"... | // new_ is a universal event "constructor". | [
"new_",
"is",
"a",
"universal",
"event",
"constructor",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/parse.go#L41-L46 |
140,379 | mailgun/mailgun-go | parse.go | ParseEvents | func ParseEvents(raw []events.RawJSON) ([]Event, error) {
var result []Event
for _, value := range raw {
event, err := ParseEvent(value)
if err != nil {
return nil, fmt.Errorf("while parsing event: %s", err)
}
result = append(result, event)
}
return result, nil
} | go | func ParseEvents(raw []events.RawJSON) ([]Event, error) {
var result []Event
for _, value := range raw {
event, err := ParseEvent(value)
if err != nil {
return nil, fmt.Errorf("while parsing event: %s", err)
}
result = append(result, event)
}
return result, nil
} | [
"func",
"ParseEvents",
"(",
"raw",
"[",
"]",
"events",
".",
"RawJSON",
")",
"(",
"[",
"]",
"Event",
",",
"error",
")",
"{",
"var",
"result",
"[",
"]",
"Event",
"\n",
"for",
"_",
",",
"value",
":=",
"range",
"raw",
"{",
"event",
",",
"err",
":=",
... | // Given a slice of events.RawJSON events return a slice of Event for each parsed event | [
"Given",
"a",
"slice",
"of",
"events",
".",
"RawJSON",
"events",
"return",
"a",
"slice",
"of",
"Event",
"for",
"each",
"parsed",
"event"
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/parse.go#L66-L76 |
140,380 | mailgun/mailgun-go | parse.go | ParseEvent | func ParseEvent(raw []byte) (Event, error) {
// Try to recognize the event first.
var e events.EventName
if err := easyjson.Unmarshal(raw, &e); err != nil {
return nil, fmt.Errorf("failed to recognize event: %v", err)
}
// Get the event "constructor" from the map.
newEvent, ok := EventNames[e.Name]
if !ok {
... | go | func ParseEvent(raw []byte) (Event, error) {
// Try to recognize the event first.
var e events.EventName
if err := easyjson.Unmarshal(raw, &e); err != nil {
return nil, fmt.Errorf("failed to recognize event: %v", err)
}
// Get the event "constructor" from the map.
newEvent, ok := EventNames[e.Name]
if !ok {
... | [
"func",
"ParseEvent",
"(",
"raw",
"[",
"]",
"byte",
")",
"(",
"Event",
",",
"error",
")",
"{",
"// Try to recognize the event first.",
"var",
"e",
"events",
".",
"EventName",
"\n",
"if",
"err",
":=",
"easyjson",
".",
"Unmarshal",
"(",
"raw",
",",
"&",
"e... | // Parse converts raw bytes data into an event struct. Can accept events.RawJSON as input | [
"Parse",
"converts",
"raw",
"bytes",
"data",
"into",
"an",
"event",
"struct",
".",
"Can",
"accept",
"events",
".",
"RawJSON",
"as",
"input"
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/parse.go#L79-L99 |
140,381 | mailgun/mailgun-go | unsubscribes.go | ListUnsubscribes | func (mg *MailgunImpl) ListUnsubscribes(opts *ListOptions) *UnsubscribesIterator {
r := newHTTPRequest(generateApiUrl(mg, unsubscribesEndpoint))
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
if opts != nil {
if opts.Limit != 0 {
r.addParameter("limit", strconv.Itoa(opts.Limit))
}
}
ur... | go | func (mg *MailgunImpl) ListUnsubscribes(opts *ListOptions) *UnsubscribesIterator {
r := newHTTPRequest(generateApiUrl(mg, unsubscribesEndpoint))
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
if opts != nil {
if opts.Limit != 0 {
r.addParameter("limit", strconv.Itoa(opts.Limit))
}
}
ur... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"ListUnsubscribes",
"(",
"opts",
"*",
"ListOptions",
")",
"*",
"UnsubscribesIterator",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generateApiUrl",
"(",
"mg",
",",
"unsubscribesEndpoint",
")",
")",
"\n",
"r",
".",
"set... | // Fetches the list of unsubscribes | [
"Fetches",
"the",
"list",
"of",
"unsubscribes"
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/unsubscribes.go#L21-L36 |
140,382 | mailgun/mailgun-go | unsubscribes.go | GetUnsubscribe | func (mg *MailgunImpl) GetUnsubscribe(ctx context.Context, address string) (Unsubscribe, error) {
r := newHTTPRequest(generateApiUrlWithTarget(mg, unsubscribesEndpoint, address))
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
envelope := Unsubscribe{}
err := getResponseFromJSON(ctx, r, &envel... | go | func (mg *MailgunImpl) GetUnsubscribe(ctx context.Context, address string) (Unsubscribe, error) {
r := newHTTPRequest(generateApiUrlWithTarget(mg, unsubscribesEndpoint, address))
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
envelope := Unsubscribe{}
err := getResponseFromJSON(ctx, r, &envel... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"GetUnsubscribe",
"(",
"ctx",
"context",
".",
"Context",
",",
"address",
"string",
")",
"(",
"Unsubscribe",
",",
"error",
")",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generateApiUrlWithTarget",
"(",
"mg",
",",
"u... | // Retreives a single unsubscribe record. Can be used to check if a given address is present in the list of unsubscribed users. | [
"Retreives",
"a",
"single",
"unsubscribe",
"record",
".",
"Can",
"be",
"used",
"to",
"check",
"if",
"a",
"given",
"address",
"is",
"present",
"in",
"the",
"list",
"of",
"unsubscribed",
"users",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/unsubscribes.go#L136-L145 |
140,383 | mailgun/mailgun-go | unsubscribes.go | CreateUnsubscribe | func (mg *MailgunImpl) CreateUnsubscribe(ctx context.Context, address, tag string) error {
r := newHTTPRequest(generateApiUrl(mg, unsubscribesEndpoint))
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
p := newUrlEncodedPayload()
p.addValue("address", address)
p.addValue("tag", tag)
_, err := ... | go | func (mg *MailgunImpl) CreateUnsubscribe(ctx context.Context, address, tag string) error {
r := newHTTPRequest(generateApiUrl(mg, unsubscribesEndpoint))
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
p := newUrlEncodedPayload()
p.addValue("address", address)
p.addValue("tag", tag)
_, err := ... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"CreateUnsubscribe",
"(",
"ctx",
"context",
".",
"Context",
",",
"address",
",",
"tag",
"string",
")",
"error",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generateApiUrl",
"(",
"mg",
",",
"unsubscribesEndpoint",
")",
... | // Unsubscribe adds an e-mail address to the domain's unsubscription table. | [
"Unsubscribe",
"adds",
"an",
"e",
"-",
"mail",
"address",
"to",
"the",
"domain",
"s",
"unsubscription",
"table",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/unsubscribes.go#L148-L157 |
140,384 | mailgun/mailgun-go | tags.go | DeleteTag | func (mg *MailgunImpl) DeleteTag(ctx context.Context, tag string) error {
r := newHTTPRequest(generateApiUrl(mg, tagsEndpoint) + "/" + tag)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
_, err := makeDeleteRequest(ctx, r)
return err
} | go | func (mg *MailgunImpl) DeleteTag(ctx context.Context, tag string) error {
r := newHTTPRequest(generateApiUrl(mg, tagsEndpoint) + "/" + tag)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
_, err := makeDeleteRequest(ctx, r)
return err
} | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"DeleteTag",
"(",
"ctx",
"context",
".",
"Context",
",",
"tag",
"string",
")",
"error",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generateApiUrl",
"(",
"mg",
",",
"tagsEndpoint",
")",
"+",
"\"",
"\"",
"+",
"tag... | // DeleteTag removes all counters for a particular tag, including the tag itself. | [
"DeleteTag",
"removes",
"all",
"counters",
"for",
"a",
"particular",
"tag",
"including",
"the",
"tag",
"itself",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/tags.go#L30-L36 |
140,385 | mailgun/mailgun-go | tags.go | GetTag | func (mg *MailgunImpl) GetTag(ctx context.Context, tag string) (Tag, error) {
r := newHTTPRequest(generateApiUrl(mg, tagsEndpoint) + "/" + tag)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
var tagItem Tag
return tagItem, getResponseFromJSON(ctx, r, &tagItem)
} | go | func (mg *MailgunImpl) GetTag(ctx context.Context, tag string) (Tag, error) {
r := newHTTPRequest(generateApiUrl(mg, tagsEndpoint) + "/" + tag)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
var tagItem Tag
return tagItem, getResponseFromJSON(ctx, r, &tagItem)
} | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"GetTag",
"(",
"ctx",
"context",
".",
"Context",
",",
"tag",
"string",
")",
"(",
"Tag",
",",
"error",
")",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generateApiUrl",
"(",
"mg",
",",
"tagsEndpoint",
")",
"+",
... | // GetTag retrieves metadata about the tag from the api | [
"GetTag",
"retrieves",
"metadata",
"about",
"the",
"tag",
"from",
"the",
"api"
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/tags.go#L39-L45 |
140,386 | mailgun/mailgun-go | tags.go | Next | func (ti *TagIterator) Next(ctx context.Context, items *[]Tag) bool {
if ti.err != nil {
return false
}
if !canFetchPage(ti.Paging.Next) {
return false
}
ti.err = ti.fetch(ctx, ti.Paging.Next)
if ti.err != nil {
return false
}
*items = ti.Items
if len(ti.Items) == 0 {
return false
}
return true
} | go | func (ti *TagIterator) Next(ctx context.Context, items *[]Tag) bool {
if ti.err != nil {
return false
}
if !canFetchPage(ti.Paging.Next) {
return false
}
ti.err = ti.fetch(ctx, ti.Paging.Next)
if ti.err != nil {
return false
}
*items = ti.Items
if len(ti.Items) == 0 {
return false
}
return true
} | [
"func",
"(",
"ti",
"*",
"TagIterator",
")",
"Next",
"(",
"ctx",
"context",
".",
"Context",
",",
"items",
"*",
"[",
"]",
"Tag",
")",
"bool",
"{",
"if",
"ti",
".",
"err",
"!=",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"if",
"!",
"canFetchP... | // Next returns the next page in the list of tags | [
"Next",
"returns",
"the",
"next",
"page",
"in",
"the",
"list",
"of",
"tags"
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/tags.go#L84-L102 |
140,387 | mailgun/mailgun-go | tags.go | First | func (ti *TagIterator) First(ctx context.Context, items *[]Tag) bool {
if ti.err != nil {
return false
}
ti.err = ti.fetch(ctx, ti.Paging.First)
if ti.err != nil {
return false
}
*items = ti.Items
return true
} | go | func (ti *TagIterator) First(ctx context.Context, items *[]Tag) bool {
if ti.err != nil {
return false
}
ti.err = ti.fetch(ctx, ti.Paging.First)
if ti.err != nil {
return false
}
*items = ti.Items
return true
} | [
"func",
"(",
"ti",
"*",
"TagIterator",
")",
"First",
"(",
"ctx",
"context",
".",
"Context",
",",
"items",
"*",
"[",
"]",
"Tag",
")",
"bool",
"{",
"if",
"ti",
".",
"err",
"!=",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"ti",
".",
"err",
"=... | // First returns the first page in the list of tags | [
"First",
"returns",
"the",
"first",
"page",
"in",
"the",
"list",
"of",
"tags"
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/tags.go#L130-L140 |
140,388 | mailgun/mailgun-go | mailing_lists.go | ListMailingLists | func (mg *MailgunImpl) ListMailingLists(opts *ListOptions) *ListsIterator {
r := newHTTPRequest(generatePublicApiUrl(mg, listsEndpoint) + "/pages")
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
if opts != nil {
if opts.Limit != 0 {
r.addParameter("limit", strconv.Itoa(opts.Limit))
}
}
... | go | func (mg *MailgunImpl) ListMailingLists(opts *ListOptions) *ListsIterator {
r := newHTTPRequest(generatePublicApiUrl(mg, listsEndpoint) + "/pages")
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
if opts != nil {
if opts.Limit != 0 {
r.addParameter("limit", strconv.Itoa(opts.Limit))
}
}
... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"ListMailingLists",
"(",
"opts",
"*",
"ListOptions",
")",
"*",
"ListsIterator",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generatePublicApiUrl",
"(",
"mg",
",",
"listsEndpoint",
")",
"+",
"\"",
"\"",
")",
"\n",
"r"... | // ListMailingLists returns the specified set of mailing lists administered by your account. | [
"ListMailingLists",
"returns",
"the",
"specified",
"set",
"of",
"mailing",
"lists",
"administered",
"by",
"your",
"account",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/mailing_lists.go#L53-L68 |
140,389 | mailgun/mailgun-go | mailing_lists.go | DeleteMailingList | func (mg *MailgunImpl) DeleteMailingList(ctx context.Context, addr string) error {
r := newHTTPRequest(generatePublicApiUrl(mg, listsEndpoint) + "/" + addr)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
_, err := makeDeleteRequest(ctx, r)
return err
} | go | func (mg *MailgunImpl) DeleteMailingList(ctx context.Context, addr string) error {
r := newHTTPRequest(generatePublicApiUrl(mg, listsEndpoint) + "/" + addr)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
_, err := makeDeleteRequest(ctx, r)
return err
} | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"DeleteMailingList",
"(",
"ctx",
"context",
".",
"Context",
",",
"addr",
"string",
")",
"error",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generatePublicApiUrl",
"(",
"mg",
",",
"listsEndpoint",
")",
"+",
"\"",
"\"... | // DeleteMailingList removes all current members of the list, then removes the list itself.
// Attempts to send e-mail to the list will fail subsequent to this call. | [
"DeleteMailingList",
"removes",
"all",
"current",
"members",
"of",
"the",
"list",
"then",
"removes",
"the",
"list",
"itself",
".",
"Attempts",
"to",
"send",
"e",
"-",
"mail",
"to",
"the",
"list",
"will",
"fail",
"subsequent",
"to",
"this",
"call",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/mailing_lists.go#L194-L200 |
140,390 | mailgun/mailgun-go | mailing_lists.go | GetMailingList | func (mg *MailgunImpl) GetMailingList(ctx context.Context, addr string) (MailingList, error) {
r := newHTTPRequest(generatePublicApiUrl(mg, listsEndpoint) + "/" + addr)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
response, err := makeGetRequest(ctx, r)
if err != nil {
return MailingList{}... | go | func (mg *MailgunImpl) GetMailingList(ctx context.Context, addr string) (MailingList, error) {
r := newHTTPRequest(generatePublicApiUrl(mg, listsEndpoint) + "/" + addr)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
response, err := makeGetRequest(ctx, r)
if err != nil {
return MailingList{}... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"GetMailingList",
"(",
"ctx",
"context",
".",
"Context",
",",
"addr",
"string",
")",
"(",
"MailingList",
",",
"error",
")",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generatePublicApiUrl",
"(",
"mg",
",",
"listsEnd... | // GetMailingList allows your application to recover the complete List structure
// representing a mailing list, so long as you have its e-mail address. | [
"GetMailingList",
"allows",
"your",
"application",
"to",
"recover",
"the",
"complete",
"List",
"structure",
"representing",
"a",
"mailing",
"list",
"so",
"long",
"as",
"you",
"have",
"its",
"e",
"-",
"mail",
"address",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/mailing_lists.go#L204-L216 |
140,391 | mailgun/mailgun-go | mailing_lists.go | UpdateMailingList | func (mg *MailgunImpl) UpdateMailingList(ctx context.Context, addr string, prototype MailingList) (MailingList, error) {
r := newHTTPRequest(generatePublicApiUrl(mg, listsEndpoint) + "/" + addr)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
p := newUrlEncodedPayload()
if prototype.Address != ... | go | func (mg *MailgunImpl) UpdateMailingList(ctx context.Context, addr string, prototype MailingList) (MailingList, error) {
r := newHTTPRequest(generatePublicApiUrl(mg, listsEndpoint) + "/" + addr)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
p := newUrlEncodedPayload()
if prototype.Address != ... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"UpdateMailingList",
"(",
"ctx",
"context",
".",
"Context",
",",
"addr",
"string",
",",
"prototype",
"MailingList",
")",
"(",
"MailingList",
",",
"error",
")",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generatePublic... | // UpdateMailingList allows you to change various attributes of a list.
// Address, Name, Description, and AccessLevel are all optional;
// only those fields which are set in the prototype will change.
//
// Be careful! If changing the address of a mailing list,
// e-mail sent to the old address will not succeed.
// M... | [
"UpdateMailingList",
"allows",
"you",
"to",
"change",
"various",
"attributes",
"of",
"a",
"list",
".",
"Address",
"Name",
"Description",
"and",
"AccessLevel",
"are",
"all",
"optional",
";",
"only",
"those",
"fields",
"which",
"are",
"set",
"in",
"the",
"protot... | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/mailing_lists.go#L225-L249 |
140,392 | mailgun/mailgun-go | stats.go | GetStats | func (mg *MailgunImpl) GetStats(ctx context.Context, events []string, opts *GetStatOptions) ([]Stats, error) {
r := newHTTPRequest(generateApiUrl(mg, statsTotalEndpoint))
if opts != nil {
if !opts.Start.IsZero() {
r.addParameter("start", opts.Start.Format(iso8601date))
}
if !opts.End.IsZero() {
r.addPara... | go | func (mg *MailgunImpl) GetStats(ctx context.Context, events []string, opts *GetStatOptions) ([]Stats, error) {
r := newHTTPRequest(generateApiUrl(mg, statsTotalEndpoint))
if opts != nil {
if !opts.Start.IsZero() {
r.addParameter("start", opts.Start.Format(iso8601date))
}
if !opts.End.IsZero() {
r.addPara... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"GetStats",
"(",
"ctx",
"context",
".",
"Context",
",",
"events",
"[",
"]",
"string",
",",
"opts",
"*",
"GetStatOptions",
")",
"(",
"[",
"]",
"Stats",
",",
"error",
")",
"{",
"r",
":=",
"newHTTPRequest",
"(... | // GetStats returns total stats for a given domain for the specified time period | [
"GetStats",
"returns",
"total",
"stats",
"for",
"a",
"given",
"domain",
"for",
"the",
"specified",
"time",
"period"
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/stats.go#L89-L121 |
140,393 | mailgun/mailgun-go | events.go | ListEvents | func (mg *MailgunImpl) ListEvents(opts *ListEventOptions) *EventIterator {
req := newHTTPRequest(generateApiUrl(mg, eventsEndpoint))
if opts != nil {
if opts.Limit > 0 {
req.addParameter("limit", fmt.Sprintf("%d", opts.Limit))
}
if opts.Compact {
req.addParameter("pretty", "no")
}
if opts.ForceAscendi... | go | func (mg *MailgunImpl) ListEvents(opts *ListEventOptions) *EventIterator {
req := newHTTPRequest(generateApiUrl(mg, eventsEndpoint))
if opts != nil {
if opts.Limit > 0 {
req.addParameter("limit", fmt.Sprintf("%d", opts.Limit))
}
if opts.Compact {
req.addParameter("pretty", "no")
}
if opts.ForceAscendi... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"ListEvents",
"(",
"opts",
"*",
"ListEventOptions",
")",
"*",
"EventIterator",
"{",
"req",
":=",
"newHTTPRequest",
"(",
"generateApiUrl",
"(",
"mg",
",",
"eventsEndpoint",
")",
")",
"\n",
"if",
"opts",
"!=",
"nil... | // Create an new iterator to fetch a page of events from the events api | [
"Create",
"an",
"new",
"iterator",
"to",
"fetch",
"a",
"page",
"of",
"events",
"from",
"the",
"events",
"api"
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/events.go#L39-L71 |
140,394 | mailgun/mailgun-go | recipients.go | UnmarshalText | func (r *Recipient) UnmarshalText(text []byte) error {
s := string(text)
if s[len(s)-1:] != ">" {
*r = Recipient{Email: s}
return nil
}
i := strings.Index(s, "<")
// at least 1 char followed by a space
if i < 2 {
return fmt.Errorf("malformed recipient string '%s'", s)
}
*r = Recipient{
Name: strings.T... | go | func (r *Recipient) UnmarshalText(text []byte) error {
s := string(text)
if s[len(s)-1:] != ">" {
*r = Recipient{Email: s}
return nil
}
i := strings.Index(s, "<")
// at least 1 char followed by a space
if i < 2 {
return fmt.Errorf("malformed recipient string '%s'", s)
}
*r = Recipient{
Name: strings.T... | [
"func",
"(",
"r",
"*",
"Recipient",
")",
"UnmarshalText",
"(",
"text",
"[",
"]",
"byte",
")",
"error",
"{",
"s",
":=",
"string",
"(",
"text",
")",
"\n",
"if",
"s",
"[",
"len",
"(",
"s",
")",
"-",
"1",
":",
"]",
"!=",
"\"",
"\"",
"{",
"*",
"... | // UnmarshalText satisfies TextUnmarshaler | [
"UnmarshalText",
"satisfies",
"TextUnmarshaler"
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/recipients.go#L24-L42 |
140,395 | mailgun/mailgun-go | bounces.go | GetBounce | func (mg *MailgunImpl) GetBounce(ctx context.Context, address string) (Bounce, error) {
r := newHTTPRequest(generateApiUrl(mg, bouncesEndpoint) + "/" + address)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
var response Bounce
err := getResponseFromJSON(ctx, r, &response)
return response, e... | go | func (mg *MailgunImpl) GetBounce(ctx context.Context, address string) (Bounce, error) {
r := newHTTPRequest(generateApiUrl(mg, bouncesEndpoint) + "/" + address)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
var response Bounce
err := getResponseFromJSON(ctx, r, &response)
return response, e... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"GetBounce",
"(",
"ctx",
"context",
".",
"Context",
",",
"address",
"string",
")",
"(",
"Bounce",
",",
"error",
")",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generateApiUrl",
"(",
"mg",
",",
"bouncesEndpoint",
"... | // GetBounce retrieves a single bounce record, if any exist, for the given recipient address. | [
"GetBounce",
"retrieves",
"a",
"single",
"bounce",
"record",
"if",
"any",
"exist",
"for",
"the",
"given",
"recipient",
"address",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/bounces.go#L152-L160 |
140,396 | mailgun/mailgun-go | bounces.go | DeleteBounce | func (mg *MailgunImpl) DeleteBounce(ctx context.Context, address string) error {
r := newHTTPRequest(generateApiUrl(mg, bouncesEndpoint) + "/" + address)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
_, err := makeDeleteRequest(ctx, r)
return err
} | go | func (mg *MailgunImpl) DeleteBounce(ctx context.Context, address string) error {
r := newHTTPRequest(generateApiUrl(mg, bouncesEndpoint) + "/" + address)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
_, err := makeDeleteRequest(ctx, r)
return err
} | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"DeleteBounce",
"(",
"ctx",
"context",
".",
"Context",
",",
"address",
"string",
")",
"error",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generateApiUrl",
"(",
"mg",
",",
"bouncesEndpoint",
")",
"+",
"\"",
"\"",
"... | // DeleteBounce removes all bounces associted with the provided e-mail address. | [
"DeleteBounce",
"removes",
"all",
"bounces",
"associted",
"with",
"the",
"provided",
"e",
"-",
"mail",
"address",
"."
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/bounces.go#L196-L202 |
140,397 | mailgun/mailgun-go | template.go | CreateTemplate | func (mg *MailgunImpl) CreateTemplate(ctx context.Context, template *Template) error {
r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint))
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
payload := newUrlEncodedPayload()
if template.Name != "" {
payload.addValue("name", template.Name... | go | func (mg *MailgunImpl) CreateTemplate(ctx context.Context, template *Template) error {
r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint))
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
payload := newUrlEncodedPayload()
if template.Name != "" {
payload.addValue("name", template.Name... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"CreateTemplate",
"(",
"ctx",
"context",
".",
"Context",
",",
"template",
"*",
"Template",
")",
"error",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generateApiUrl",
"(",
"mg",
",",
"templatesEndpoint",
")",
")",
"\n... | // Create a new template which can be used to attach template versions to | [
"Create",
"a",
"new",
"template",
"which",
"can",
"be",
"used",
"to",
"attach",
"template",
"versions",
"to"
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/template.go#L36-L66 |
140,398 | mailgun/mailgun-go | template.go | GetTemplate | func (mg *MailgunImpl) GetTemplate(ctx context.Context, name string) (Template, error) {
r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint) + "/" + name)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
r.addParameter("active", "yes")
var resp templateResp
err := getResponseFromJSON(ctx... | go | func (mg *MailgunImpl) GetTemplate(ctx context.Context, name string) (Template, error) {
r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint) + "/" + name)
r.setClient(mg.Client())
r.setBasicAuth(basicAuthUser, mg.APIKey())
r.addParameter("active", "yes")
var resp templateResp
err := getResponseFromJSON(ctx... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"GetTemplate",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"string",
")",
"(",
"Template",
",",
"error",
")",
"{",
"r",
":=",
"newHTTPRequest",
"(",
"generateApiUrl",
"(",
"mg",
",",
"templatesEndpoint",
... | // GetTemplate gets a template given the template name | [
"GetTemplate",
"gets",
"a",
"template",
"given",
"the",
"template",
"name"
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/template.go#L69-L81 |
140,399 | mailgun/mailgun-go | template.go | UpdateTemplate | func (mg *MailgunImpl) UpdateTemplate(ctx context.Context, template *Template) error {
if template.Name == "" {
return errors.New("UpdateTemplate() Template.Name cannot be empty")
}
r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint) + "/" + template.Name)
r.setClient(mg.Client())
r.setBasicAuth(basicAuth... | go | func (mg *MailgunImpl) UpdateTemplate(ctx context.Context, template *Template) error {
if template.Name == "" {
return errors.New("UpdateTemplate() Template.Name cannot be empty")
}
r := newHTTPRequest(generateApiUrl(mg, templatesEndpoint) + "/" + template.Name)
r.setClient(mg.Client())
r.setBasicAuth(basicAuth... | [
"func",
"(",
"mg",
"*",
"MailgunImpl",
")",
"UpdateTemplate",
"(",
"ctx",
"context",
".",
"Context",
",",
"template",
"*",
"Template",
")",
"error",
"{",
"if",
"template",
".",
"Name",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
... | // Update the name and description of a template | [
"Update",
"the",
"name",
"and",
"description",
"of",
"a",
"template"
] | df421608b66e7dd4c03112d5bb01525c51f344a2 | https://github.com/mailgun/mailgun-go/blob/df421608b66e7dd4c03112d5bb01525c51f344a2/template.go#L84-L108 |
Subsets and Splits
SQL Console for google/code_x_glue_ct_code_to_text
This query implements a thoughtful three-tier curation strategy to build a balanced safety dataset, categorizing code by destructive operations, safe I/O operations, and pure computational negatives with subsampling—revealing important patterns about how destructive intent manifests in Python code for model safety research.
SQL Console for google/code_x_glue_ct_code_to_text
This query performs meaningful classification of Python code samples into safety-relevant tiers based on destructive operations, I/O patterns, and pure computation, which could be valuable for building safety classifiers or curating training data, though the output itself is a filtered/ranked dataset rather than revealing novel statistical insights.