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 list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
142,700 | enceve/crypto | pad/pad.go | overhead | func overhead(blocksize int, src []byte) int {
return blocksize - (len(src) % blocksize)
} | go | func overhead(blocksize int, src []byte) int {
return blocksize - (len(src) % blocksize)
} | [
"func",
"overhead",
"(",
"blocksize",
"int",
",",
"src",
"[",
"]",
"byte",
")",
"int",
"{",
"return",
"blocksize",
"-",
"(",
"len",
"(",
"src",
")",
"%",
"blocksize",
")",
"\n",
"}"
] | // Returns the overhead for a given slice with a
// specific block size. | [
"Returns",
"the",
"overhead",
"for",
"a",
"given",
"slice",
"with",
"a",
"specific",
"block",
"size",
"."
] | 34d48bb938155e3b408f014835ee1f6e3b4c2672 | https://github.com/enceve/crypto/blob/34d48bb938155e3b408f014835ee1f6e3b4c2672/pad/pad.go#L83-L85 |
142,701 | enceve/crypto | hc128/hc128.go | NewCipher | func NewCipher(nonce, key *[16]byte) cipher.Stream {
c := new(streamCipher)
initialize(nonce, key, &(c.p), &(c.q))
return c
} | go | func NewCipher(nonce, key *[16]byte) cipher.Stream {
c := new(streamCipher)
initialize(nonce, key, &(c.p), &(c.q))
return c
} | [
"func",
"NewCipher",
"(",
"nonce",
",",
"key",
"*",
"[",
"16",
"]",
"byte",
")",
"cipher",
".",
"Stream",
"{",
"c",
":=",
"new",
"(",
"streamCipher",
")",
"\n",
"initialize",
"(",
"nonce",
",",
"key",
",",
"&",
"(",
"c",
".",
"p",
")",
",",
"&"... | // NewCipher returns a new cipher.Stream implementing the
// HC-128 cipher with the given key and nonce. | [
"NewCipher",
"returns",
"a",
"new",
"cipher",
".",
"Stream",
"implementing",
"the",
"HC",
"-",
"128",
"cipher",
"with",
"the",
"given",
"key",
"and",
"nonce",
"."
] | 34d48bb938155e3b408f014835ee1f6e3b4c2672 | https://github.com/enceve/crypto/blob/34d48bb938155e3b408f014835ee1f6e3b4c2672/hc128/hc128.go#L18-L22 |
142,702 | enceve/crypto | skein/skein.go | New512 | func New512(key []byte) hash.Hash {
s := new(hashFunc)
if len(key) > 0 {
s.initialize(BlockSize, &Config{Key: key})
} else {
copy(s.hVal[:8], iv512[:])
s.hValCpy = s.hVal
s.hashsize = BlockSize
s.tweak[0] = 0
s.tweak[1] = CfgMessage<<56 | FirstBlock
}
return s
} | go | func New512(key []byte) hash.Hash {
s := new(hashFunc)
if len(key) > 0 {
s.initialize(BlockSize, &Config{Key: key})
} else {
copy(s.hVal[:8], iv512[:])
s.hValCpy = s.hVal
s.hashsize = BlockSize
s.tweak[0] = 0
s.tweak[1] = CfgMessage<<56 | FirstBlock
}
return s
} | [
"func",
"New512",
"(",
"key",
"[",
"]",
"byte",
")",
"hash",
".",
"Hash",
"{",
"s",
":=",
"new",
"(",
"hashFunc",
")",
"\n\n",
"if",
"len",
"(",
"key",
")",
">",
"0",
"{",
"s",
".",
"initialize",
"(",
"BlockSize",
",",
"&",
"Config",
"{",
"Key"... | // New512 returns a hash.Hash computing the Skein512 512 bit checksum.
// The key is optional and turns the hash into a MAC. | [
"New512",
"returns",
"a",
"hash",
".",
"Hash",
"computing",
"the",
"Skein512",
"512",
"bit",
"checksum",
".",
"The",
"key",
"is",
"optional",
"and",
"turns",
"the",
"hash",
"into",
"a",
"MAC",
"."
] | 34d48bb938155e3b408f014835ee1f6e3b4c2672 | https://github.com/enceve/crypto/blob/34d48bb938155e3b408f014835ee1f6e3b4c2672/skein/skein.go#L159-L173 |
142,703 | enceve/crypto | skein/skein.go | New256 | func New256(key []byte) hash.Hash {
s := new(hashFunc)
if len(key) > 0 {
s.initialize(32, &Config{Key: key})
} else {
copy(s.hVal[:8], iv256[:])
s.hValCpy = s.hVal
s.hashsize = 32
s.tweak[0] = 0
s.tweak[1] = CfgMessage<<56 | FirstBlock
}
return s
} | go | func New256(key []byte) hash.Hash {
s := new(hashFunc)
if len(key) > 0 {
s.initialize(32, &Config{Key: key})
} else {
copy(s.hVal[:8], iv256[:])
s.hValCpy = s.hVal
s.hashsize = 32
s.tweak[0] = 0
s.tweak[1] = CfgMessage<<56 | FirstBlock
}
return s
} | [
"func",
"New256",
"(",
"key",
"[",
"]",
"byte",
")",
"hash",
".",
"Hash",
"{",
"s",
":=",
"new",
"(",
"hashFunc",
")",
"\n\n",
"if",
"len",
"(",
"key",
")",
">",
"0",
"{",
"s",
".",
"initialize",
"(",
"32",
",",
"&",
"Config",
"{",
"Key",
":"... | // New256 returns a hash.Hash computing the Skein512 256 bit checksum.
// The key is optional and turns the hash into a MAC. | [
"New256",
"returns",
"a",
"hash",
".",
"Hash",
"computing",
"the",
"Skein512",
"256",
"bit",
"checksum",
".",
"The",
"key",
"is",
"optional",
"and",
"turns",
"the",
"hash",
"into",
"a",
"MAC",
"."
] | 34d48bb938155e3b408f014835ee1f6e3b4c2672 | https://github.com/enceve/crypto/blob/34d48bb938155e3b408f014835ee1f6e3b4c2672/skein/skein.go#L177-L191 |
142,704 | enceve/crypto | blake2/blake2b/blake2b.go | Configure | func Configure(hVal *[8]uint64, hashsize int, conf *Config) error {
if hashsize <= 0 || hashsize > Size {
return errors.New("illegal hash size " + strconv.Itoa(hashsize))
}
var key, salt, personal []byte
if conf != nil {
key = conf.Key
salt = conf.Salt
personal = conf.Personal
}
if k := len(key); k > Siz... | go | func Configure(hVal *[8]uint64, hashsize int, conf *Config) error {
if hashsize <= 0 || hashsize > Size {
return errors.New("illegal hash size " + strconv.Itoa(hashsize))
}
var key, salt, personal []byte
if conf != nil {
key = conf.Key
salt = conf.Salt
personal = conf.Personal
}
if k := len(key); k > Siz... | [
"func",
"Configure",
"(",
"hVal",
"*",
"[",
"8",
"]",
"uint64",
",",
"hashsize",
"int",
",",
"conf",
"*",
"Config",
")",
"error",
"{",
"if",
"hashsize",
"<=",
"0",
"||",
"hashsize",
">",
"Size",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",... | // Configure takes the hash size and the BLAKE2b configuration and
// computes the 8 64-bit chain values. The conf is optional and can be nil,
// or must be a valid configuraton struct - otherwise a non-nil error is returned. | [
"Configure",
"takes",
"the",
"hash",
"size",
"and",
"the",
"BLAKE2b",
"configuration",
"and",
"computes",
"the",
"8",
"64",
"-",
"bit",
"chain",
"values",
".",
"The",
"conf",
"is",
"optional",
"and",
"can",
"be",
"nil",
"or",
"must",
"be",
"a",
"valid",
... | 34d48bb938155e3b408f014835ee1f6e3b4c2672 | https://github.com/enceve/crypto/blob/34d48bb938155e3b408f014835ee1f6e3b4c2672/blake2/blake2b/blake2b.go#L41-L81 |
142,705 | enceve/crypto | chacha20/chachaPoly1305.go | NewChaCha20Poly1305 | func NewChaCha20Poly1305(key *[32]byte) cipher.AEAD {
c := &aead{tagsize: TagSize}
c.key = *key
return c
} | go | func NewChaCha20Poly1305(key *[32]byte) cipher.AEAD {
c := &aead{tagsize: TagSize}
c.key = *key
return c
} | [
"func",
"NewChaCha20Poly1305",
"(",
"key",
"*",
"[",
"32",
"]",
"byte",
")",
"cipher",
".",
"AEAD",
"{",
"c",
":=",
"&",
"aead",
"{",
"tagsize",
":",
"TagSize",
"}",
"\n",
"c",
".",
"key",
"=",
"*",
"key",
"\n",
"return",
"c",
"\n",
"}"
] | // NewChaCha20Poly1305 returns a cipher.AEAD implementing the
// ChaCha20Poly1305 construction specified in RFC 7539 with a
// 128 bit auth. tag. | [
"NewChaCha20Poly1305",
"returns",
"a",
"cipher",
".",
"AEAD",
"implementing",
"the",
"ChaCha20Poly1305",
"construction",
"specified",
"in",
"RFC",
"7539",
"with",
"a",
"128",
"bit",
"auth",
".",
"tag",
"."
] | 34d48bb938155e3b408f014835ee1f6e3b4c2672 | https://github.com/enceve/crypto/blob/34d48bb938155e3b408f014835ee1f6e3b4c2672/chacha20/chachaPoly1305.go#L22-L26 |
142,706 | enceve/crypto | chacha20/chachaPoly1305.go | NewChaCha20Poly1305WithTagSize | func NewChaCha20Poly1305WithTagSize(key *[32]byte, tagsize int) (cipher.AEAD, error) {
if tagsize < 1 || tagsize > TagSize {
return nil, errors.New("tag size must be between 1 and 16")
}
c := &aead{tagsize: tagsize}
c.key = *key
return c, nil
} | go | func NewChaCha20Poly1305WithTagSize(key *[32]byte, tagsize int) (cipher.AEAD, error) {
if tagsize < 1 || tagsize > TagSize {
return nil, errors.New("tag size must be between 1 and 16")
}
c := &aead{tagsize: tagsize}
c.key = *key
return c, nil
} | [
"func",
"NewChaCha20Poly1305WithTagSize",
"(",
"key",
"*",
"[",
"32",
"]",
"byte",
",",
"tagsize",
"int",
")",
"(",
"cipher",
".",
"AEAD",
",",
"error",
")",
"{",
"if",
"tagsize",
"<",
"1",
"||",
"tagsize",
">",
"TagSize",
"{",
"return",
"nil",
",",
... | // NewChaCha20Poly1305WithTagSize returns a cipher.AEAD implementing the
// ChaCha20Poly1305 construction specified in RFC 7539 with arbitrary tag size.
// The tagsize must be between 1 and the TagSize constant. | [
"NewChaCha20Poly1305WithTagSize",
"returns",
"a",
"cipher",
".",
"AEAD",
"implementing",
"the",
"ChaCha20Poly1305",
"construction",
"specified",
"in",
"RFC",
"7539",
"with",
"arbitrary",
"tag",
"size",
".",
"The",
"tagsize",
"must",
"be",
"between",
"1",
"and",
"t... | 34d48bb938155e3b408f014835ee1f6e3b4c2672 | https://github.com/enceve/crypto/blob/34d48bb938155e3b408f014835ee1f6e3b4c2672/chacha20/chachaPoly1305.go#L31-L38 |
142,707 | enceve/crypto | chacha20/chachaPoly1305.go | authenticate | func authenticate(out *[TagSize]byte, ciphertext, additionalData []byte, key *[32]byte) {
ctLen := uint64(len(ciphertext))
adLen := uint64(len(additionalData))
padAD, padCT := adLen%16, ctLen%16
var buf [16]byte
buf[0] = byte(adLen)
buf[1] = byte(adLen >> 8)
buf[2] = byte(adLen >> 16)
buf[3] = byte(adLen >> 24... | go | func authenticate(out *[TagSize]byte, ciphertext, additionalData []byte, key *[32]byte) {
ctLen := uint64(len(ciphertext))
adLen := uint64(len(additionalData))
padAD, padCT := adLen%16, ctLen%16
var buf [16]byte
buf[0] = byte(adLen)
buf[1] = byte(adLen >> 8)
buf[2] = byte(adLen >> 16)
buf[3] = byte(adLen >> 24... | [
"func",
"authenticate",
"(",
"out",
"*",
"[",
"TagSize",
"]",
"byte",
",",
"ciphertext",
",",
"additionalData",
"[",
"]",
"byte",
",",
"key",
"*",
"[",
"32",
"]",
"byte",
")",
"{",
"ctLen",
":=",
"uint64",
"(",
"len",
"(",
"ciphertext",
")",
")",
"... | // authenticate calculates the poly1305 tag from
// the given ciphertext and additional data. | [
"authenticate",
"calculates",
"the",
"poly1305",
"tag",
"from",
"the",
"given",
"ciphertext",
"and",
"additional",
"data",
"."
] | 34d48bb938155e3b408f014835ee1f6e3b4c2672 | https://github.com/enceve/crypto/blob/34d48bb938155e3b408f014835ee1f6e3b4c2672/chacha20/chachaPoly1305.go#L109-L143 |
142,708 | enceve/crypto | skein/threefish/threefish.go | IncrementTweak | func IncrementTweak(tweak *[3]uint64, ctr uint64) {
t0 := tweak[0]
tweak[0] += ctr
if tweak[0] < t0 {
t1 := tweak[1]
tweak[1] = (t1 + 1) & 0x00000000FFFFFFFF
}
} | go | func IncrementTweak(tweak *[3]uint64, ctr uint64) {
t0 := tweak[0]
tweak[0] += ctr
if tweak[0] < t0 {
t1 := tweak[1]
tweak[1] = (t1 + 1) & 0x00000000FFFFFFFF
}
} | [
"func",
"IncrementTweak",
"(",
"tweak",
"*",
"[",
"3",
"]",
"uint64",
",",
"ctr",
"uint64",
")",
"{",
"t0",
":=",
"tweak",
"[",
"0",
"]",
"\n",
"tweak",
"[",
"0",
"]",
"+=",
"ctr",
"\n",
"if",
"tweak",
"[",
"0",
"]",
"<",
"t0",
"{",
"t1",
":=... | // Increment the tweak by the ctr argument.
// Skein can consume messages up to 2^96 -1 bytes. | [
"Increment",
"the",
"tweak",
"by",
"the",
"ctr",
"argument",
".",
"Skein",
"can",
"consume",
"messages",
"up",
"to",
"2^96",
"-",
"1",
"bytes",
"."
] | 34d48bb938155e3b408f014835ee1f6e3b4c2672 | https://github.com/enceve/crypto/blob/34d48bb938155e3b408f014835ee1f6e3b4c2672/skein/threefish/threefish.go#L54-L61 |
142,709 | enceve/crypto | serpent/sbox_ref.go | linear | func linear(v0, v1, v2, v3 *uint32) {
t0 := ((*v0 << 13) | (*v0 >> (32 - 13)))
t2 := ((*v2 << 3) | (*v2 >> (32 - 3)))
t1 := *v1 ^ t0 ^ t2
t3 := *v3 ^ t2 ^ (t0 << 3)
*v1 = (t1 << 1) | (t1 >> (32 - 1))
*v3 = (t3 << 7) | (t3 >> (32 - 7))
t0 ^= *v1 ^ *v3
t2 ^= *v3 ^ (*v1 << 7)
*v0 = (t0 << 5) | (t0 >> (32 - 5))
*... | go | func linear(v0, v1, v2, v3 *uint32) {
t0 := ((*v0 << 13) | (*v0 >> (32 - 13)))
t2 := ((*v2 << 3) | (*v2 >> (32 - 3)))
t1 := *v1 ^ t0 ^ t2
t3 := *v3 ^ t2 ^ (t0 << 3)
*v1 = (t1 << 1) | (t1 >> (32 - 1))
*v3 = (t3 << 7) | (t3 >> (32 - 7))
t0 ^= *v1 ^ *v3
t2 ^= *v3 ^ (*v1 << 7)
*v0 = (t0 << 5) | (t0 >> (32 - 5))
*... | [
"func",
"linear",
"(",
"v0",
",",
"v1",
",",
"v2",
",",
"v3",
"*",
"uint32",
")",
"{",
"t0",
":=",
"(",
"(",
"*",
"v0",
"<<",
"13",
")",
"|",
"(",
"*",
"v0",
">>",
"(",
"32",
"-",
"13",
")",
")",
")",
"\n",
"t2",
":=",
"(",
"(",
"*",
... | // The linear transformation of serpent
// This version, tries not to minimize the
// number of registers, but maximize parallism. | [
"The",
"linear",
"transformation",
"of",
"serpent",
"This",
"version",
"tries",
"not",
"to",
"minimize",
"the",
"number",
"of",
"registers",
"but",
"maximize",
"parallism",
"."
] | 34d48bb938155e3b408f014835ee1f6e3b4c2672 | https://github.com/enceve/crypto/blob/34d48bb938155e3b408f014835ee1f6e3b4c2672/serpent/sbox_ref.go#L11-L22 |
142,710 | enceve/crypto | blake2/blake2s/blake2s.go | ExtractHash | func ExtractHash(out *[Size]byte, hVal *[8]uint32, ctr *[2]uint32, block *[BlockSize]byte, off int) {
diff := uint32(BlockSize - off)
if ctr[0] < diff {
ctr[1]--
}
ctr[0] -= diff
for i := off; i < BlockSize; i++ {
block[i] = 0
}
Core(hVal, ctr, FinalFlag, block[:])
j := 0
for _, s := range hVal {
out[... | go | func ExtractHash(out *[Size]byte, hVal *[8]uint32, ctr *[2]uint32, block *[BlockSize]byte, off int) {
diff := uint32(BlockSize - off)
if ctr[0] < diff {
ctr[1]--
}
ctr[0] -= diff
for i := off; i < BlockSize; i++ {
block[i] = 0
}
Core(hVal, ctr, FinalFlag, block[:])
j := 0
for _, s := range hVal {
out[... | [
"func",
"ExtractHash",
"(",
"out",
"*",
"[",
"Size",
"]",
"byte",
",",
"hVal",
"*",
"[",
"8",
"]",
"uint32",
",",
"ctr",
"*",
"[",
"2",
"]",
"uint32",
",",
"block",
"*",
"[",
"BlockSize",
"]",
"byte",
",",
"off",
"int",
")",
"{",
"diff",
":=",
... | // ExtractHash takes the 8 32-bit chain values, the 64-bit counter, the 64 byte block
// and a block-offset and extracts the checksum to out. | [
"ExtractHash",
"takes",
"the",
"8",
"32",
"-",
"bit",
"chain",
"values",
"the",
"64",
"-",
"bit",
"counter",
"the",
"64",
"byte",
"block",
"and",
"a",
"block",
"-",
"offset",
"and",
"extracts",
"the",
"checksum",
"to",
"out",
"."
] | 34d48bb938155e3b408f014835ee1f6e3b4c2672 | https://github.com/enceve/crypto/blob/34d48bb938155e3b408f014835ee1f6e3b4c2672/blake2/blake2s/blake2s.go#L118-L139 |
142,711 | enceve/crypto | serpent/sbox_386.go | sb0Inv | func sb0Inv(r0, r1, r2, r3 *uint32) {
*r2 = ^*r2
r4 := *r1
*r1 |= *r0
r4 = ^r4
*r1 ^= *r2
*r2 |= r4
*r1 ^= *r3
*r0 ^= r4
*r2 ^= *r0
*r0 &= *r3
r4 ^= *r0
*r0 |= *r1
*r0 ^= *r2
*r3 ^= r4
*r2 ^= *r1
*r3 ^= *r0
*r3 ^= *r1
*r2 &= *r3
r4 ^= *r2
//return *r0, r4, *r1, *r3
*r2 = *r1
*r1 = r4
} | go | func sb0Inv(r0, r1, r2, r3 *uint32) {
*r2 = ^*r2
r4 := *r1
*r1 |= *r0
r4 = ^r4
*r1 ^= *r2
*r2 |= r4
*r1 ^= *r3
*r0 ^= r4
*r2 ^= *r0
*r0 &= *r3
r4 ^= *r0
*r0 |= *r1
*r0 ^= *r2
*r3 ^= r4
*r2 ^= *r1
*r3 ^= *r0
*r3 ^= *r1
*r2 &= *r3
r4 ^= *r2
//return *r0, r4, *r1, *r3
*r2 = *r1
*r1 = r4
} | [
"func",
"sb0Inv",
"(",
"r0",
",",
"r1",
",",
"r2",
",",
"r3",
"*",
"uint32",
")",
"{",
"*",
"r2",
"=",
"^",
"*",
"r2",
"\n",
"r4",
":=",
"*",
"r1",
"\n",
"*",
"r1",
"|=",
"*",
"r0",
"\n",
"r4",
"=",
"^",
"r4",
"\n",
"*",
"r1",
"^=",
"*"... | // Inverse S-Box 0 | [
"Inverse",
"S",
"-",
"Box",
"0"
] | 34d48bb938155e3b408f014835ee1f6e3b4c2672 | https://github.com/enceve/crypto/blob/34d48bb938155e3b408f014835ee1f6e3b4c2672/serpent/sbox_386.go#L74-L97 |
142,712 | enceve/crypto | serpent/sbox_386.go | sb1 | func sb1(r0, r1, r2, r3 *uint32) {
*r0 = ^*r0
*r2 = ^*r2
r4 := *r0
*r0 &= *r1
*r2 ^= *r0
*r0 |= *r3
*r3 ^= *r2
*r1 ^= *r0
*r0 ^= r4
r4 |= *r1
*r1 ^= *r3
*r2 |= *r0
*r2 &= r4
*r0 ^= *r1
*r1 &= *r2
*r1 ^= *r0
*r0 &= *r2
*r0 ^= r4
// return *r2, *r0, *r3, *r1
r4 = *r0
*r0 = *r2
*r2 = *r3
*r3 = *r1
... | go | func sb1(r0, r1, r2, r3 *uint32) {
*r0 = ^*r0
*r2 = ^*r2
r4 := *r0
*r0 &= *r1
*r2 ^= *r0
*r0 |= *r3
*r3 ^= *r2
*r1 ^= *r0
*r0 ^= r4
r4 |= *r1
*r1 ^= *r3
*r2 |= *r0
*r2 &= r4
*r0 ^= *r1
*r1 &= *r2
*r1 ^= *r0
*r0 &= *r2
*r0 ^= r4
// return *r2, *r0, *r3, *r1
r4 = *r0
*r0 = *r2
*r2 = *r3
*r3 = *r1
... | [
"func",
"sb1",
"(",
"r0",
",",
"r1",
",",
"r2",
",",
"r3",
"*",
"uint32",
")",
"{",
"*",
"r0",
"=",
"^",
"*",
"r0",
"\n",
"*",
"r2",
"=",
"^",
"*",
"r2",
"\n",
"r4",
":=",
"*",
"r0",
"\n",
"*",
"r0",
"&=",
"*",
"r1",
"\n",
"*",
"r2",
... | // S-Box 1 | [
"S",
"-",
"Box",
"1"
] | 34d48bb938155e3b408f014835ee1f6e3b4c2672 | https://github.com/enceve/crypto/blob/34d48bb938155e3b408f014835ee1f6e3b4c2672/serpent/sbox_386.go#L100-L125 |
142,713 | enceve/crypto | serpent/sbox_386.go | sb4Inv | func sb4Inv(r0, r1, r2, r3 *uint32) {
r4 := *r2
*r2 &= *r3
*r2 ^= *r1
*r1 |= *r3
*r1 &= *r0
r4 ^= *r2
r4 ^= *r1
*r1 &= *r2
*r0 = ^*r0
*r3 ^= r4
*r1 ^= *r3
*r3 &= *r0
*r3 ^= *r2
*r0 ^= *r1
*r2 &= *r0
*r3 ^= *r0
*r2 ^= r4
*r2 |= *r3
*r3 ^= *r0
*r2 ^= *r1
//return *r0, *r3, *r2, r4
*r1 = *r3
*r3 = r... | go | func sb4Inv(r0, r1, r2, r3 *uint32) {
r4 := *r2
*r2 &= *r3
*r2 ^= *r1
*r1 |= *r3
*r1 &= *r0
r4 ^= *r2
r4 ^= *r1
*r1 &= *r2
*r0 = ^*r0
*r3 ^= r4
*r1 ^= *r3
*r3 &= *r0
*r3 ^= *r2
*r0 ^= *r1
*r2 &= *r0
*r3 ^= *r0
*r2 ^= r4
*r2 |= *r3
*r3 ^= *r0
*r2 ^= *r1
//return *r0, *r3, *r2, r4
*r1 = *r3
*r3 = r... | [
"func",
"sb4Inv",
"(",
"r0",
",",
"r1",
",",
"r2",
",",
"r3",
"*",
"uint32",
")",
"{",
"r4",
":=",
"*",
"r2",
"\n",
"*",
"r2",
"&=",
"*",
"r3",
"\n",
"*",
"r2",
"^=",
"*",
"r1",
"\n",
"*",
"r1",
"|=",
"*",
"r3",
"\n",
"*",
"r1",
"&=",
"... | // Inverse S-Box 4 | [
"Inverse",
"S",
"-",
"Box",
"4"
] | 34d48bb938155e3b408f014835ee1f6e3b4c2672 | https://github.com/enceve/crypto/blob/34d48bb938155e3b408f014835ee1f6e3b4c2672/serpent/sbox_386.go#L291-L315 |
142,714 | enceve/crypto | serpent/sbox_386.go | sb5 | func sb5(r0, r1, r2, r3 *uint32) {
*r0 ^= *r1
*r1 ^= *r3
*r3 = ^*r3
r4 := *r1
*r1 &= *r0
*r2 ^= *r3
*r1 ^= *r2
*r2 |= r4
r4 ^= *r3
*r3 &= *r1
*r3 ^= *r0
r4 ^= *r1
r4 ^= *r2
*r2 ^= *r0
*r0 &= *r3
*r2 = ^*r2
*r0 ^= r4
r4 |= *r3
*r2 ^= r4
//return *r1, *r3, *r0, *r2
r4 = *r0
*r0 = *r1
*r1 = *r3
*r3... | go | func sb5(r0, r1, r2, r3 *uint32) {
*r0 ^= *r1
*r1 ^= *r3
*r3 = ^*r3
r4 := *r1
*r1 &= *r0
*r2 ^= *r3
*r1 ^= *r2
*r2 |= r4
r4 ^= *r3
*r3 &= *r1
*r3 ^= *r0
r4 ^= *r1
r4 ^= *r2
*r2 ^= *r0
*r0 &= *r3
*r2 = ^*r2
*r0 ^= r4
r4 |= *r3
*r2 ^= r4
//return *r1, *r3, *r0, *r2
r4 = *r0
*r0 = *r1
*r1 = *r3
*r3... | [
"func",
"sb5",
"(",
"r0",
",",
"r1",
",",
"r2",
",",
"r3",
"*",
"uint32",
")",
"{",
"*",
"r0",
"^=",
"*",
"r1",
"\n",
"*",
"r1",
"^=",
"*",
"r3",
"\n",
"*",
"r3",
"=",
"^",
"*",
"r3",
"\n",
"r4",
":=",
"*",
"r1",
"\n",
"*",
"r1",
"&=",
... | // S-Box 5 | [
"S",
"-",
"Box",
"5"
] | 34d48bb938155e3b408f014835ee1f6e3b4c2672 | https://github.com/enceve/crypto/blob/34d48bb938155e3b408f014835ee1f6e3b4c2672/serpent/sbox_386.go#L318-L344 |
142,715 | enceve/crypto | serpent/sbox_386.go | sb6 | func sb6(r0, r1, r2, r3 *uint32) {
*r2 = ^*r2
r4 := *r3
*r3 &= *r0
*r0 ^= r4
*r3 ^= *r2
*r2 |= r4
*r1 ^= *r3
*r2 ^= *r0
*r0 |= *r1
*r2 ^= *r1
r4 ^= *r0
*r0 |= *r3
*r0 ^= *r2
r4 ^= *r3
r4 ^= *r0
*r3 = ^*r3
*r2 &= r4
*r2 ^= *r3
//return *r0, *r1, r4, *r2
*r3 = *r2
*r2 = r4
} | go | func sb6(r0, r1, r2, r3 *uint32) {
*r2 = ^*r2
r4 := *r3
*r3 &= *r0
*r0 ^= r4
*r3 ^= *r2
*r2 |= r4
*r1 ^= *r3
*r2 ^= *r0
*r0 |= *r1
*r2 ^= *r1
r4 ^= *r0
*r0 |= *r3
*r0 ^= *r2
r4 ^= *r3
r4 ^= *r0
*r3 = ^*r3
*r2 &= r4
*r2 ^= *r3
//return *r0, *r1, r4, *r2
*r3 = *r2
*r2 = r4
} | [
"func",
"sb6",
"(",
"r0",
",",
"r1",
",",
"r2",
",",
"r3",
"*",
"uint32",
")",
"{",
"*",
"r2",
"=",
"^",
"*",
"r2",
"\n",
"r4",
":=",
"*",
"r3",
"\n",
"*",
"r3",
"&=",
"*",
"r0",
"\n",
"*",
"r0",
"^=",
"r4",
"\n",
"*",
"r3",
"^=",
"*",
... | // S-Box 6 | [
"S",
"-",
"Box",
"6"
] | 34d48bb938155e3b408f014835ee1f6e3b4c2672 | https://github.com/enceve/crypto/blob/34d48bb938155e3b408f014835ee1f6e3b4c2672/serpent/sbox_386.go#L376-L398 |
142,716 | enceve/crypto | serpent/sbox_386.go | sb6Inv | func sb6Inv(r0, r1, r2, r3 *uint32) {
*r0 ^= *r2
r4 := *r2
*r2 &= *r0
r4 ^= *r3
*r2 = ^*r2
*r3 ^= *r1
*r2 ^= *r3
r4 |= *r0
*r0 ^= *r2
*r3 ^= r4
r4 ^= *r1
*r1 &= *r3
*r1 ^= *r0
*r0 ^= *r3
*r0 |= *r2
*r3 ^= *r1
r4 ^= *r0
// return *r1, *r2, r4, *r3
*r0 = *r1
*r1 = *r2
*r2 = r4
} | go | func sb6Inv(r0, r1, r2, r3 *uint32) {
*r0 ^= *r2
r4 := *r2
*r2 &= *r0
r4 ^= *r3
*r2 = ^*r2
*r3 ^= *r1
*r2 ^= *r3
r4 |= *r0
*r0 ^= *r2
*r3 ^= r4
r4 ^= *r1
*r1 &= *r3
*r1 ^= *r0
*r0 ^= *r3
*r0 |= *r2
*r3 ^= *r1
r4 ^= *r0
// return *r1, *r2, r4, *r3
*r0 = *r1
*r1 = *r2
*r2 = r4
} | [
"func",
"sb6Inv",
"(",
"r0",
",",
"r1",
",",
"r2",
",",
"r3",
"*",
"uint32",
")",
"{",
"*",
"r0",
"^=",
"*",
"r2",
"\n",
"r4",
":=",
"*",
"r2",
"\n",
"*",
"r2",
"&=",
"*",
"r0",
"\n",
"r4",
"^=",
"*",
"r3",
"\n",
"*",
"r2",
"=",
"^",
"*... | // Inverse S-Box 6 | [
"Inverse",
"S",
"-",
"Box",
"6"
] | 34d48bb938155e3b408f014835ee1f6e3b4c2672 | https://github.com/enceve/crypto/blob/34d48bb938155e3b408f014835ee1f6e3b4c2672/serpent/sbox_386.go#L401-L423 |
142,717 | enceve/crypto | serpent/sbox_386.go | sb7 | func sb7(r0, r1, r2, r3 *uint32) {
r4 := *r1
*r1 |= *r2
*r1 ^= *r3
r4 ^= *r2
*r2 ^= *r1
*r3 |= r4
*r3 &= *r0
r4 ^= *r2
*r3 ^= *r1
*r1 |= r4
*r1 ^= *r0
*r0 |= r4
*r0 ^= *r2
*r1 ^= r4
*r2 ^= *r1
*r1 &= *r0
*r1 ^= r4
*r2 = ^*r2
*r2 |= *r0
r4 ^= *r2
// return r4, *r3, *r1, *r0
*r2 = *r1
*r1 = *r3
*r... | go | func sb7(r0, r1, r2, r3 *uint32) {
r4 := *r1
*r1 |= *r2
*r1 ^= *r3
r4 ^= *r2
*r2 ^= *r1
*r3 |= r4
*r3 &= *r0
r4 ^= *r2
*r3 ^= *r1
*r1 |= r4
*r1 ^= *r0
*r0 |= r4
*r0 ^= *r2
*r1 ^= r4
*r2 ^= *r1
*r1 &= *r0
*r1 ^= r4
*r2 = ^*r2
*r2 |= *r0
r4 ^= *r2
// return r4, *r3, *r1, *r0
*r2 = *r1
*r1 = *r3
*r... | [
"func",
"sb7",
"(",
"r0",
",",
"r1",
",",
"r2",
",",
"r3",
"*",
"uint32",
")",
"{",
"r4",
":=",
"*",
"r1",
"\n",
"*",
"r1",
"|=",
"*",
"r2",
"\n",
"*",
"r1",
"^=",
"*",
"r3",
"\n",
"r4",
"^=",
"*",
"r2",
"\n",
"*",
"r2",
"^=",
"*",
"r1"... | // S-Box 7 | [
"S",
"-",
"Box",
"7"
] | 34d48bb938155e3b408f014835ee1f6e3b4c2672 | https://github.com/enceve/crypto/blob/34d48bb938155e3b408f014835ee1f6e3b4c2672/serpent/sbox_386.go#L426-L452 |
142,718 | enceve/crypto | serpent/sbox_386.go | sb7Inv | func sb7Inv(r0, r1, r2, r3 *uint32) {
r4 := *r2
*r2 ^= *r0
*r0 &= *r3
r4 |= *r3
*r2 = ^*r2
*r3 ^= *r1
*r1 |= *r0
*r0 ^= *r2
*r2 &= r4
*r3 &= r4
*r1 ^= *r2
*r2 ^= *r0
*r0 |= *r2
r4 ^= *r1
*r0 ^= *r3
*r3 ^= r4
r4 |= *r0
*r3 ^= *r2
r4 ^= *r2
// return *r3, *r0, *r1, r4
*r2 = *r1
*r1 = *r0
*r0 = *r3
... | go | func sb7Inv(r0, r1, r2, r3 *uint32) {
r4 := *r2
*r2 ^= *r0
*r0 &= *r3
r4 |= *r3
*r2 = ^*r2
*r3 ^= *r1
*r1 |= *r0
*r0 ^= *r2
*r2 &= r4
*r3 &= r4
*r1 ^= *r2
*r2 ^= *r0
*r0 |= *r2
r4 ^= *r1
*r0 ^= *r3
*r3 ^= r4
r4 |= *r0
*r3 ^= *r2
r4 ^= *r2
// return *r3, *r0, *r1, r4
*r2 = *r1
*r1 = *r0
*r0 = *r3
... | [
"func",
"sb7Inv",
"(",
"r0",
",",
"r1",
",",
"r2",
",",
"r3",
"*",
"uint32",
")",
"{",
"r4",
":=",
"*",
"r2",
"\n",
"*",
"r2",
"^=",
"*",
"r0",
"\n",
"*",
"r0",
"&=",
"*",
"r3",
"\n",
"r4",
"|=",
"*",
"r3",
"\n",
"*",
"r2",
"=",
"^",
"*... | // Inverse S-Box 7 | [
"Inverse",
"S",
"-",
"Box",
"7"
] | 34d48bb938155e3b408f014835ee1f6e3b4c2672 | https://github.com/enceve/crypto/blob/34d48bb938155e3b408f014835ee1f6e3b4c2672/serpent/sbox_386.go#L455-L480 |
142,719 | enceve/crypto | poly1305/poly1305.go | Write | func (p *Hash) Write(msg []byte) (int, error) {
if p.done {
return 0, writeAfterSumErr
}
n := len(msg)
if p.off > 0 {
dif := TagSize - p.off
if n > dif {
p.off += copy(p.buf[p.off:], msg[:dif])
msg = msg[dif:]
core(p.buf[:], msgBlock, &(p.h), &(p.r))
p.off = 0
} else {
p.off += copy(p.buf[p.... | go | func (p *Hash) Write(msg []byte) (int, error) {
if p.done {
return 0, writeAfterSumErr
}
n := len(msg)
if p.off > 0 {
dif := TagSize - p.off
if n > dif {
p.off += copy(p.buf[p.off:], msg[:dif])
msg = msg[dif:]
core(p.buf[:], msgBlock, &(p.h), &(p.r))
p.off = 0
} else {
p.off += copy(p.buf[p.... | [
"func",
"(",
"p",
"*",
"Hash",
")",
"Write",
"(",
"msg",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"if",
"p",
".",
"done",
"{",
"return",
"0",
",",
"writeAfterSumErr",
"\n",
"}",
"\n",
"n",
":=",
"len",
"(",
"msg",
")",
"\n\n... | // Write adds more data to the running Poly1305 hash.
// This function returns an non-nil error, if a call
// to Write happens after the hash's Sum function was
// called. So it's not possible to compute the checksum
// and than add more data. | [
"Write",
"adds",
"more",
"data",
"to",
"the",
"running",
"Poly1305",
"hash",
".",
"This",
"function",
"returns",
"an",
"non",
"-",
"nil",
"error",
"if",
"a",
"call",
"to",
"Write",
"happens",
"after",
"the",
"hash",
"s",
"Sum",
"function",
"was",
"called... | 34d48bb938155e3b408f014835ee1f6e3b4c2672 | https://github.com/enceve/crypto/blob/34d48bb938155e3b408f014835ee1f6e3b4c2672/poly1305/poly1305.go#L68-L97 |
142,720 | enceve/crypto | poly1305/poly1305.go | Sum | func (p *Hash) Sum(out *[TagSize]byte) {
h, r := p.h, p.r
pad := p.pad
if p.off > 0 {
var buf [TagSize]byte
copy(buf[:], p.buf[:p.off])
buf[p.off] = 1 // invariant: p.off < TagSize
core(buf[:], finalBlock, &h, &r)
}
finalize(out, &h, &pad)
p.done = true
} | go | func (p *Hash) Sum(out *[TagSize]byte) {
h, r := p.h, p.r
pad := p.pad
if p.off > 0 {
var buf [TagSize]byte
copy(buf[:], p.buf[:p.off])
buf[p.off] = 1 // invariant: p.off < TagSize
core(buf[:], finalBlock, &h, &r)
}
finalize(out, &h, &pad)
p.done = true
} | [
"func",
"(",
"p",
"*",
"Hash",
")",
"Sum",
"(",
"out",
"*",
"[",
"TagSize",
"]",
"byte",
")",
"{",
"h",
",",
"r",
":=",
"p",
".",
"h",
",",
"p",
".",
"r",
"\n",
"pad",
":=",
"p",
".",
"pad",
"\n\n",
"if",
"p",
".",
"off",
">",
"0",
"{",... | // Sum computes the Poly1305 checksum of the prevouisly
// processed data and writes it to out. It is legal to
// call this function more than one time. | [
"Sum",
"computes",
"the",
"Poly1305",
"checksum",
"of",
"the",
"prevouisly",
"processed",
"data",
"and",
"writes",
"it",
"to",
"out",
".",
"It",
"is",
"legal",
"to",
"call",
"this",
"function",
"more",
"than",
"one",
"time",
"."
] | 34d48bb938155e3b408f014835ee1f6e3b4c2672 | https://github.com/enceve/crypto/blob/34d48bb938155e3b408f014835ee1f6e3b4c2672/poly1305/poly1305.go#L102-L116 |
142,721 | enceve/crypto | poly1305/sum.go | Sum | func Sum(out *[TagSize]byte, msg []byte, key *[32]byte) {
poly.Sum(out, msg, key)
} | go | func Sum(out *[TagSize]byte, msg []byte, key *[32]byte) {
poly.Sum(out, msg, key)
} | [
"func",
"Sum",
"(",
"out",
"*",
"[",
"TagSize",
"]",
"byte",
",",
"msg",
"[",
"]",
"byte",
",",
"key",
"*",
"[",
"32",
"]",
"byte",
")",
"{",
"poly",
".",
"Sum",
"(",
"out",
",",
"msg",
",",
"key",
")",
"\n",
"}"
] | // Sum generates an authenticator for msg using a one-time key and puts the
// 16-byte result into out. Authenticating two different messages with the same
// key allows an attacker to forge messages at will. | [
"Sum",
"generates",
"an",
"authenticator",
"for",
"msg",
"using",
"a",
"one",
"-",
"time",
"key",
"and",
"puts",
"the",
"16",
"-",
"byte",
"result",
"into",
"out",
".",
"Authenticating",
"two",
"different",
"messages",
"with",
"the",
"same",
"key",
"allows... | 34d48bb938155e3b408f014835ee1f6e3b4c2672 | https://github.com/enceve/crypto/blob/34d48bb938155e3b408f014835ee1f6e3b4c2672/poly1305/sum.go#L11-L13 |
142,722 | enceve/crypto | chacha20/chacha/chacha.go | SetCounter | func (c *Cipher) SetCounter(ctr uint32) {
c.state[48] = byte(ctr)
c.state[49] = byte(ctr >> 8)
c.state[50] = byte(ctr >> 16)
c.state[51] = byte(ctr >> 24)
c.off = 0
} | go | func (c *Cipher) SetCounter(ctr uint32) {
c.state[48] = byte(ctr)
c.state[49] = byte(ctr >> 8)
c.state[50] = byte(ctr >> 16)
c.state[51] = byte(ctr >> 24)
c.off = 0
} | [
"func",
"(",
"c",
"*",
"Cipher",
")",
"SetCounter",
"(",
"ctr",
"uint32",
")",
"{",
"c",
".",
"state",
"[",
"48",
"]",
"=",
"byte",
"(",
"ctr",
")",
"\n",
"c",
".",
"state",
"[",
"49",
"]",
"=",
"byte",
"(",
"ctr",
">>",
"8",
")",
"\n",
"c"... | // Sets the counter of the cipher.
// Notice that this function skips the unused
// keystream of the current 64 byte block. | [
"Sets",
"the",
"counter",
"of",
"the",
"cipher",
".",
"Notice",
"that",
"this",
"function",
"skips",
"the",
"unused",
"keystream",
"of",
"the",
"current",
"64",
"byte",
"block",
"."
] | 34d48bb938155e3b408f014835ee1f6e3b4c2672 | https://github.com/enceve/crypto/blob/34d48bb938155e3b408f014835ee1f6e3b4c2672/chacha20/chacha/chacha.go#L26-L32 |
142,723 | technoweenie/multipartstreamer | multipartstreamer.go | New | func New() (m *MultipartStreamer) {
m = &MultipartStreamer{bodyBuffer: new(bytes.Buffer)}
m.bodyWriter = multipart.NewWriter(m.bodyBuffer)
boundary := m.bodyWriter.Boundary()
m.ContentType = "multipart/form-data; boundary=" + boundary
closeBoundary := fmt.Sprintf("\r\n--%s--\r\n", boundary)
m.closeBuffer = byte... | go | func New() (m *MultipartStreamer) {
m = &MultipartStreamer{bodyBuffer: new(bytes.Buffer)}
m.bodyWriter = multipart.NewWriter(m.bodyBuffer)
boundary := m.bodyWriter.Boundary()
m.ContentType = "multipart/form-data; boundary=" + boundary
closeBoundary := fmt.Sprintf("\r\n--%s--\r\n", boundary)
m.closeBuffer = byte... | [
"func",
"New",
"(",
")",
"(",
"m",
"*",
"MultipartStreamer",
")",
"{",
"m",
"=",
"&",
"MultipartStreamer",
"{",
"bodyBuffer",
":",
"new",
"(",
"bytes",
".",
"Buffer",
")",
"}",
"\n\n",
"m",
".",
"bodyWriter",
"=",
"multipart",
".",
"NewWriter",
"(",
... | // New initializes a new MultipartStreamer. | [
"New",
"initializes",
"a",
"new",
"MultipartStreamer",
"."
] | a90a01d73ae432e2611d178c18367fbaa13e0154 | https://github.com/technoweenie/multipartstreamer/blob/a90a01d73ae432e2611d178c18367fbaa13e0154/multipartstreamer.go#L29-L40 |
142,724 | technoweenie/multipartstreamer | multipartstreamer.go | WriteFields | func (m *MultipartStreamer) WriteFields(fields map[string]string) error {
var err error
for key, value := range fields {
err = m.bodyWriter.WriteField(key, value)
if err != nil {
return err
}
}
return nil
} | go | func (m *MultipartStreamer) WriteFields(fields map[string]string) error {
var err error
for key, value := range fields {
err = m.bodyWriter.WriteField(key, value)
if err != nil {
return err
}
}
return nil
} | [
"func",
"(",
"m",
"*",
"MultipartStreamer",
")",
"WriteFields",
"(",
"fields",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"var",
"err",
"error",
"\n\n",
"for",
"key",
",",
"value",
":=",
"range",
"fields",
"{",
"err",
"=",
"m",
".",
"bod... | // WriteFields writes multiple form fields to the multipart.Writer. | [
"WriteFields",
"writes",
"multiple",
"form",
"fields",
"to",
"the",
"multipart",
".",
"Writer",
"."
] | a90a01d73ae432e2611d178c18367fbaa13e0154 | https://github.com/technoweenie/multipartstreamer/blob/a90a01d73ae432e2611d178c18367fbaa13e0154/multipartstreamer.go#L43-L54 |
142,725 | technoweenie/multipartstreamer | multipartstreamer.go | WriteReader | func (m *MultipartStreamer) WriteReader(key, filename string, size int64, reader io.Reader) (err error) {
m.reader = reader
m.contentLength = size
_, err = m.bodyWriter.CreateFormFile(key, filename)
return
} | go | func (m *MultipartStreamer) WriteReader(key, filename string, size int64, reader io.Reader) (err error) {
m.reader = reader
m.contentLength = size
_, err = m.bodyWriter.CreateFormFile(key, filename)
return
} | [
"func",
"(",
"m",
"*",
"MultipartStreamer",
")",
"WriteReader",
"(",
"key",
",",
"filename",
"string",
",",
"size",
"int64",
",",
"reader",
"io",
".",
"Reader",
")",
"(",
"err",
"error",
")",
"{",
"m",
".",
"reader",
"=",
"reader",
"\n",
"m",
".",
... | // WriteReader adds an io.Reader to get the content of a file. The reader is
// not accessed until the multipart.Reader is copied to some output writer. | [
"WriteReader",
"adds",
"an",
"io",
".",
"Reader",
"to",
"get",
"the",
"content",
"of",
"a",
"file",
".",
"The",
"reader",
"is",
"not",
"accessed",
"until",
"the",
"multipart",
".",
"Reader",
"is",
"copied",
"to",
"some",
"output",
"writer",
"."
] | a90a01d73ae432e2611d178c18367fbaa13e0154 | https://github.com/technoweenie/multipartstreamer/blob/a90a01d73ae432e2611d178c18367fbaa13e0154/multipartstreamer.go#L58-L64 |
142,726 | technoweenie/multipartstreamer | multipartstreamer.go | WriteFile | func (m *MultipartStreamer) WriteFile(key, filename string) error {
fh, err := os.Open(filename)
if err != nil {
return err
}
stat, err := fh.Stat()
if err != nil {
return err
}
return m.WriteReader(key, filepath.Base(filename), stat.Size(), fh)
} | go | func (m *MultipartStreamer) WriteFile(key, filename string) error {
fh, err := os.Open(filename)
if err != nil {
return err
}
stat, err := fh.Stat()
if err != nil {
return err
}
return m.WriteReader(key, filepath.Base(filename), stat.Size(), fh)
} | [
"func",
"(",
"m",
"*",
"MultipartStreamer",
")",
"WriteFile",
"(",
"key",
",",
"filename",
"string",
")",
"error",
"{",
"fh",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}"... | // WriteFile is a shortcut for adding a local file as an io.Reader. | [
"WriteFile",
"is",
"a",
"shortcut",
"for",
"adding",
"a",
"local",
"file",
"as",
"an",
"io",
".",
"Reader",
"."
] | a90a01d73ae432e2611d178c18367fbaa13e0154 | https://github.com/technoweenie/multipartstreamer/blob/a90a01d73ae432e2611d178c18367fbaa13e0154/multipartstreamer.go#L67-L79 |
142,727 | technoweenie/multipartstreamer | multipartstreamer.go | SetupRequest | func (m *MultipartStreamer) SetupRequest(req *http.Request) {
req.Body = m.GetReader()
req.Header.Add("Content-Type", m.ContentType)
req.ContentLength = m.Len()
} | go | func (m *MultipartStreamer) SetupRequest(req *http.Request) {
req.Body = m.GetReader()
req.Header.Add("Content-Type", m.ContentType)
req.ContentLength = m.Len()
} | [
"func",
"(",
"m",
"*",
"MultipartStreamer",
")",
"SetupRequest",
"(",
"req",
"*",
"http",
".",
"Request",
")",
"{",
"req",
".",
"Body",
"=",
"m",
".",
"GetReader",
"(",
")",
"\n",
"req",
".",
"Header",
".",
"Add",
"(",
"\"",
"\"",
",",
"m",
".",
... | // SetupRequest sets up the http.Request body, and some crucial HTTP headers. | [
"SetupRequest",
"sets",
"up",
"the",
"http",
".",
"Request",
"body",
"and",
"some",
"crucial",
"HTTP",
"headers",
"."
] | a90a01d73ae432e2611d178c18367fbaa13e0154 | https://github.com/technoweenie/multipartstreamer/blob/a90a01d73ae432e2611d178c18367fbaa13e0154/multipartstreamer.go#L82-L86 |
142,728 | technoweenie/multipartstreamer | multipartstreamer.go | Len | func (m *MultipartStreamer) Len() int64 {
return m.contentLength + int64(m.bodyBuffer.Len()) + int64(m.closeBuffer.Len())
} | go | func (m *MultipartStreamer) Len() int64 {
return m.contentLength + int64(m.bodyBuffer.Len()) + int64(m.closeBuffer.Len())
} | [
"func",
"(",
"m",
"*",
"MultipartStreamer",
")",
"Len",
"(",
")",
"int64",
"{",
"return",
"m",
".",
"contentLength",
"+",
"int64",
"(",
"m",
".",
"bodyBuffer",
".",
"Len",
"(",
")",
")",
"+",
"int64",
"(",
"m",
".",
"closeBuffer",
".",
"Len",
"(",
... | // Len calculates the byte size of the multipart content. | [
"Len",
"calculates",
"the",
"byte",
"size",
"of",
"the",
"multipart",
"content",
"."
] | a90a01d73ae432e2611d178c18367fbaa13e0154 | https://github.com/technoweenie/multipartstreamer/blob/a90a01d73ae432e2611d178c18367fbaa13e0154/multipartstreamer.go#L93-L95 |
142,729 | technoweenie/multipartstreamer | multipartstreamer.go | GetReader | func (m *MultipartStreamer) GetReader() io.ReadCloser {
reader := io.MultiReader(m.bodyBuffer, m.reader, m.closeBuffer)
return ioutil.NopCloser(reader)
} | go | func (m *MultipartStreamer) GetReader() io.ReadCloser {
reader := io.MultiReader(m.bodyBuffer, m.reader, m.closeBuffer)
return ioutil.NopCloser(reader)
} | [
"func",
"(",
"m",
"*",
"MultipartStreamer",
")",
"GetReader",
"(",
")",
"io",
".",
"ReadCloser",
"{",
"reader",
":=",
"io",
".",
"MultiReader",
"(",
"m",
".",
"bodyBuffer",
",",
"m",
".",
"reader",
",",
"m",
".",
"closeBuffer",
")",
"\n",
"return",
"... | // GetReader gets an io.ReadCloser for passing to an http.Request. | [
"GetReader",
"gets",
"an",
"io",
".",
"ReadCloser",
"for",
"passing",
"to",
"an",
"http",
".",
"Request",
"."
] | a90a01d73ae432e2611d178c18367fbaa13e0154 | https://github.com/technoweenie/multipartstreamer/blob/a90a01d73ae432e2611d178c18367fbaa13e0154/multipartstreamer.go#L98-L101 |
142,730 | dukex/mixpanel | mixpanel.go | NewFromClient | func NewFromClient(c *http.Client, token, apiURL string) Mixpanel {
if apiURL == "" {
apiURL = "https://api.mixpanel.com"
}
return &mixpanel{
Client: c,
Token: token,
ApiURL: apiURL,
}
} | go | func NewFromClient(c *http.Client, token, apiURL string) Mixpanel {
if apiURL == "" {
apiURL = "https://api.mixpanel.com"
}
return &mixpanel{
Client: c,
Token: token,
ApiURL: apiURL,
}
} | [
"func",
"NewFromClient",
"(",
"c",
"*",
"http",
".",
"Client",
",",
"token",
",",
"apiURL",
"string",
")",
"Mixpanel",
"{",
"if",
"apiURL",
"==",
"\"",
"\"",
"{",
"apiURL",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"return",
"&",
"mixpanel",
"{",
"Client",... | // Creates a client instance using the specified client instance. This is useful
// when using a proxy. | [
"Creates",
"a",
"client",
"instance",
"using",
"the",
"specified",
"client",
"instance",
".",
"This",
"is",
"useful",
"when",
"using",
"a",
"proxy",
"."
] | f8d5594f958e8c61402a0e56e24fc7b1f6e51889 | https://github.com/dukex/mixpanel/blob/f8d5594f958e8c61402a0e56e24fc7b1f6e51889/mixpanel.go#L201-L211 |
142,731 | dukex/mixpanel | mock.go | people | func (m *Mock) people(distinctId string) *MockPeople {
p := m.People[distinctId]
if p == nil {
p = &MockPeople{
Properties: map[string]interface{}{},
}
m.People[distinctId] = p
}
return p
} | go | func (m *Mock) people(distinctId string) *MockPeople {
p := m.People[distinctId]
if p == nil {
p = &MockPeople{
Properties: map[string]interface{}{},
}
m.People[distinctId] = p
}
return p
} | [
"func",
"(",
"m",
"*",
"Mock",
")",
"people",
"(",
"distinctId",
"string",
")",
"*",
"MockPeople",
"{",
"p",
":=",
"m",
".",
"People",
"[",
"distinctId",
"]",
"\n",
"if",
"p",
"==",
"nil",
"{",
"p",
"=",
"&",
"MockPeople",
"{",
"Properties",
":",
... | // Identifies a user. The user will be added to the People map. | [
"Identifies",
"a",
"user",
".",
"The",
"user",
"will",
"be",
"added",
"to",
"the",
"People",
"map",
"."
] | f8d5594f958e8c61402a0e56e24fc7b1f6e51889 | https://github.com/dukex/mixpanel/blob/f8d5594f958e8c61402a0e56e24fc7b1f6e51889/mock.go#L30-L40 |
142,732 | naoina/go-stringutil | strings.go | ToUpperCamelCase | func ToUpperCamelCase(s string) string {
if s == "" {
return ""
}
upper := true
start := 0
result := make([]byte, 0, len(s))
var runeBuf [utf8.UTFMax]byte
var initialism []byte
for _, c := range s {
if c == '_' {
upper = true
candidate := string(result[start:])
initialism = initialism[:0]
for _,... | go | func ToUpperCamelCase(s string) string {
if s == "" {
return ""
}
upper := true
start := 0
result := make([]byte, 0, len(s))
var runeBuf [utf8.UTFMax]byte
var initialism []byte
for _, c := range s {
if c == '_' {
upper = true
candidate := string(result[start:])
initialism = initialism[:0]
for _,... | [
"func",
"ToUpperCamelCase",
"(",
"s",
"string",
")",
"string",
"{",
"if",
"s",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"upper",
":=",
"true",
"\n",
"start",
":=",
"0",
"\n",
"result",
":=",
"make",
"(",
"[",
"]",
"byte",
","... | // ToUpperCamelCase returns a copy of the string s with all Unicode letters mapped to their camel case.
// It will convert to upper case previous letter of '_' and first letter, and remove letter of '_'. | [
"ToUpperCamelCase",
"returns",
"a",
"copy",
"of",
"the",
"string",
"s",
"with",
"all",
"Unicode",
"letters",
"mapped",
"to",
"their",
"camel",
"case",
".",
"It",
"will",
"convert",
"to",
"upper",
"case",
"previous",
"letter",
"of",
"_",
"and",
"first",
"le... | 6b638e95a32d0c1131db0e7fe83775cbea4a0d0b | https://github.com/naoina/go-stringutil/blob/6b638e95a32d0c1131db0e7fe83775cbea4a0d0b/strings.go#L60-L119 |
142,733 | naoina/go-stringutil | strings.go | ToUpperCamelCaseASCII | func ToUpperCamelCaseASCII(s string) string {
if s == "" {
return ""
}
upper := true
start := 0
result := make([]byte, 0, len(s))
var initialism []byte
for i := 0; i < len(s); i++ {
c := s[i]
if c == '_' {
upper = true
candidate := result[start:]
initialism = initialism[:0]
for _, b := range ca... | go | func ToUpperCamelCaseASCII(s string) string {
if s == "" {
return ""
}
upper := true
start := 0
result := make([]byte, 0, len(s))
var initialism []byte
for i := 0; i < len(s); i++ {
c := s[i]
if c == '_' {
upper = true
candidate := result[start:]
initialism = initialism[:0]
for _, b := range ca... | [
"func",
"ToUpperCamelCaseASCII",
"(",
"s",
"string",
")",
"string",
"{",
"if",
"s",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"upper",
":=",
"true",
"\n",
"start",
":=",
"0",
"\n",
"result",
":=",
"make",
"(",
"[",
"]",
"byte",
... | // ToUpperCamelCaseASCII is similar to ToUpperCamelCase, but optimized for
// only the ASCII characters.
// ToUpperCamelCaseASCII is faster than ToUpperCamelCase, but doesn't work if
// contains non-ASCII characters. | [
"ToUpperCamelCaseASCII",
"is",
"similar",
"to",
"ToUpperCamelCase",
"but",
"optimized",
"for",
"only",
"the",
"ASCII",
"characters",
".",
"ToUpperCamelCaseASCII",
"is",
"faster",
"than",
"ToUpperCamelCase",
"but",
"doesn",
"t",
"work",
"if",
"contains",
"non",
"-",
... | 6b638e95a32d0c1131db0e7fe83775cbea4a0d0b | https://github.com/naoina/go-stringutil/blob/6b638e95a32d0c1131db0e7fe83775cbea4a0d0b/strings.go#L125-L164 |
142,734 | naoina/go-stringutil | strings.go | ToSnakeCase | func ToSnakeCase(s string) string {
if s == "" {
return ""
}
result := make([]byte, 0, len(s))
var runeBuf [utf8.UTFMax]byte
var j, skipCount int
for i, c := range s {
if i < skipCount {
continue
}
if unicode.IsUpper(c) {
if i != 0 {
result = append(result, '_')
}
next := nextIndex(j, len(... | go | func ToSnakeCase(s string) string {
if s == "" {
return ""
}
result := make([]byte, 0, len(s))
var runeBuf [utf8.UTFMax]byte
var j, skipCount int
for i, c := range s {
if i < skipCount {
continue
}
if unicode.IsUpper(c) {
if i != 0 {
result = append(result, '_')
}
next := nextIndex(j, len(... | [
"func",
"ToSnakeCase",
"(",
"s",
"string",
")",
"string",
"{",
"if",
"s",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"result",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"0",
",",
"len",
"(",
"s",
")",
")",
"\n",
"var",
"run... | // ToSnakeCase returns a copy of the string s with all Unicode letters mapped to their snake case.
// It will insert letter of '_' at position of previous letter of uppercase and all
// letters convert to lower case.
// ToSnakeCase does not insert '_' letter into a common initialism word like ID, URL and so on. | [
"ToSnakeCase",
"returns",
"a",
"copy",
"of",
"the",
"string",
"s",
"with",
"all",
"Unicode",
"letters",
"mapped",
"to",
"their",
"snake",
"case",
".",
"It",
"will",
"insert",
"letter",
"of",
"_",
"at",
"position",
"of",
"previous",
"letter",
"of",
"upperca... | 6b638e95a32d0c1131db0e7fe83775cbea4a0d0b | https://github.com/naoina/go-stringutil/blob/6b638e95a32d0c1131db0e7fe83775cbea4a0d0b/strings.go#L170-L209 |
142,735 | naoina/go-stringutil | strings.go | ToSnakeCaseASCII | func ToSnakeCaseASCII(s string) string {
if s == "" {
return ""
}
result := make([]byte, 0, len(s))
for i := 0; i < len(s); i++ {
c := s[i]
if isUpperASCII(c) {
if i != 0 {
result = append(result, '_')
}
if k := i + shortestLen - 1; k < len(s) && isUpperASCII(s[k]) {
if length := commonInitia... | go | func ToSnakeCaseASCII(s string) string {
if s == "" {
return ""
}
result := make([]byte, 0, len(s))
for i := 0; i < len(s); i++ {
c := s[i]
if isUpperASCII(c) {
if i != 0 {
result = append(result, '_')
}
if k := i + shortestLen - 1; k < len(s) && isUpperASCII(s[k]) {
if length := commonInitia... | [
"func",
"ToSnakeCaseASCII",
"(",
"s",
"string",
")",
"string",
"{",
"if",
"s",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"result",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"0",
",",
"len",
"(",
"s",
")",
")",
"\n",
"for",
... | // ToSnakeCaseASCII is similar to ToSnakeCase, but optimized for only the ASCII
// characters.
// ToSnakeCaseASCII is faster than ToSnakeCase, but doesn't work correctly if
// contains non-ASCII characters. | [
"ToSnakeCaseASCII",
"is",
"similar",
"to",
"ToSnakeCase",
"but",
"optimized",
"for",
"only",
"the",
"ASCII",
"characters",
".",
"ToSnakeCaseASCII",
"is",
"faster",
"than",
"ToSnakeCase",
"but",
"doesn",
"t",
"work",
"correctly",
"if",
"contains",
"non",
"-",
"AS... | 6b638e95a32d0c1131db0e7fe83775cbea4a0d0b | https://github.com/naoina/go-stringutil/blob/6b638e95a32d0c1131db0e7fe83775cbea4a0d0b/strings.go#L215-L239 |
142,736 | naoina/go-stringutil | strings.go | AddCommonInitialism | func AddCommonInitialism(ss ...string) {
mu.Lock()
defer mu.Unlock()
for _, s := range ss {
commonInitialismMap[s] = struct{}{}
}
commonInitialisms = keys(commonInitialismMap)
commonInitialism = mustDoubleArray(newDoubleArray(commonInitialisms))
longestLen = longestLength(commonInitialisms)
shortestLen = shor... | go | func AddCommonInitialism(ss ...string) {
mu.Lock()
defer mu.Unlock()
for _, s := range ss {
commonInitialismMap[s] = struct{}{}
}
commonInitialisms = keys(commonInitialismMap)
commonInitialism = mustDoubleArray(newDoubleArray(commonInitialisms))
longestLen = longestLength(commonInitialisms)
shortestLen = shor... | [
"func",
"AddCommonInitialism",
"(",
"ss",
"...",
"string",
")",
"{",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"for",
"_",
",",
"s",
":=",
"range",
"ss",
"{",
"commonInitialismMap",
"[",
"s",
"]",
"=",
"struct... | // AddCommonInitialism adds ss to list of common initialisms. | [
"AddCommonInitialism",
"adds",
"ss",
"to",
"list",
"of",
"common",
"initialisms",
"."
] | 6b638e95a32d0c1131db0e7fe83775cbea4a0d0b | https://github.com/naoina/go-stringutil/blob/6b638e95a32d0c1131db0e7fe83775cbea4a0d0b/strings.go#L242-L252 |
142,737 | naoina/go-stringutil | da.go | findBase | func (da *doubleArray) findBase(siblings []sibling, start int, usedBase map[int]struct{}) (base int) {
for idx, firstChar := start+1, siblings[0].c; ; idx = da.findEmptyIndex(idx + 1) {
base = da.nextIndex(idx, firstChar)
if _, used := usedBase[base]; used {
continue
}
i := 0
for ; i < len(siblings); i++ ... | go | func (da *doubleArray) findBase(siblings []sibling, start int, usedBase map[int]struct{}) (base int) {
for idx, firstChar := start+1, siblings[0].c; ; idx = da.findEmptyIndex(idx + 1) {
base = da.nextIndex(idx, firstChar)
if _, used := usedBase[base]; used {
continue
}
i := 0
for ; i < len(siblings); i++ ... | [
"func",
"(",
"da",
"*",
"doubleArray",
")",
"findBase",
"(",
"siblings",
"[",
"]",
"sibling",
",",
"start",
"int",
",",
"usedBase",
"map",
"[",
"int",
"]",
"struct",
"{",
"}",
")",
"(",
"base",
"int",
")",
"{",
"for",
"idx",
",",
"firstChar",
":=",... | // findBase returns good BASE. | [
"findBase",
"returns",
"good",
"BASE",
"."
] | 6b638e95a32d0c1131db0e7fe83775cbea4a0d0b | https://github.com/naoina/go-stringutil/blob/6b638e95a32d0c1131db0e7fe83775cbea4a0d0b/da.go#L146-L168 |
142,738 | xtgo/set | apply.go | Pivots | func Pivots(sizes ...int) []int {
n := 0
for i, l := range sizes {
n += l
sizes[i] = n
}
return sizes
} | go | func Pivots(sizes ...int) []int {
n := 0
for i, l := range sizes {
n += l
sizes[i] = n
}
return sizes
} | [
"func",
"Pivots",
"(",
"sizes",
"...",
"int",
")",
"[",
"]",
"int",
"{",
"n",
":=",
"0",
"\n",
"for",
"i",
",",
"l",
":=",
"range",
"sizes",
"{",
"n",
"+=",
"l",
"\n",
"sizes",
"[",
"i",
"]",
"=",
"n",
"\n",
"}",
"\n",
"return",
"sizes",
"\... | // Pivots transforms set-relative sizes into data-absolute pivots. Pivots is
// mostly only useful in conjunction with Apply. The sizes slice sizes may
// be modified by the call. | [
"Pivots",
"transforms",
"set",
"-",
"relative",
"sizes",
"into",
"data",
"-",
"absolute",
"pivots",
".",
"Pivots",
"is",
"mostly",
"only",
"useful",
"in",
"conjunction",
"with",
"Apply",
".",
"The",
"sizes",
"slice",
"sizes",
"may",
"be",
"modified",
"by",
... | 708d80f4a27458f99f8ca12bd0e638c6ee65627f | https://github.com/xtgo/set/blob/708d80f4a27458f99f8ca12bd0e638c6ee65627f/apply.go#L12-L19 |
142,739 | xtgo/set | helpers.go | Ints | func Ints(data []int) []int {
sort.Ints(data)
n := Uniq(sort.IntSlice(data))
return data[:n]
} | go | func Ints(data []int) []int {
sort.Ints(data)
n := Uniq(sort.IntSlice(data))
return data[:n]
} | [
"func",
"Ints",
"(",
"data",
"[",
"]",
"int",
")",
"[",
"]",
"int",
"{",
"sort",
".",
"Ints",
"(",
"data",
")",
"\n",
"n",
":=",
"Uniq",
"(",
"sort",
".",
"IntSlice",
"(",
"data",
")",
")",
"\n",
"return",
"data",
"[",
":",
"n",
"]",
"\n",
... | // Ints sorts and deduplicates a slice of ints in place, returning the
// resulting set. | [
"Ints",
"sorts",
"and",
"deduplicates",
"a",
"slice",
"of",
"ints",
"in",
"place",
"returning",
"the",
"resulting",
"set",
"."
] | 708d80f4a27458f99f8ca12bd0e638c6ee65627f | https://github.com/xtgo/set/blob/708d80f4a27458f99f8ca12bd0e638c6ee65627f/helpers.go#L11-L15 |
142,740 | xtgo/set | helpers.go | Float64s | func Float64s(data []float64) []float64 {
sort.Float64s(data)
n := Uniq(sort.Float64Slice(data))
return data[:n]
} | go | func Float64s(data []float64) []float64 {
sort.Float64s(data)
n := Uniq(sort.Float64Slice(data))
return data[:n]
} | [
"func",
"Float64s",
"(",
"data",
"[",
"]",
"float64",
")",
"[",
"]",
"float64",
"{",
"sort",
".",
"Float64s",
"(",
"data",
")",
"\n",
"n",
":=",
"Uniq",
"(",
"sort",
".",
"Float64Slice",
"(",
"data",
")",
")",
"\n",
"return",
"data",
"[",
":",
"n... | // Float64s sorts and deduplicates a slice of float64s in place, returning
// the resulting set. | [
"Float64s",
"sorts",
"and",
"deduplicates",
"a",
"slice",
"of",
"float64s",
"in",
"place",
"returning",
"the",
"resulting",
"set",
"."
] | 708d80f4a27458f99f8ca12bd0e638c6ee65627f | https://github.com/xtgo/set/blob/708d80f4a27458f99f8ca12bd0e638c6ee65627f/helpers.go#L19-L23 |
142,741 | xtgo/set | helpers.go | Strings | func Strings(data []string) []string {
sort.Strings(data)
n := Uniq(sort.StringSlice(data))
return data[:n]
} | go | func Strings(data []string) []string {
sort.Strings(data)
n := Uniq(sort.StringSlice(data))
return data[:n]
} | [
"func",
"Strings",
"(",
"data",
"[",
"]",
"string",
")",
"[",
"]",
"string",
"{",
"sort",
".",
"Strings",
"(",
"data",
")",
"\n",
"n",
":=",
"Uniq",
"(",
"sort",
".",
"StringSlice",
"(",
"data",
")",
")",
"\n",
"return",
"data",
"[",
":",
"n",
... | // Strings sorts and deduplicates a slice of strings in place, returning
// the resulting set. | [
"Strings",
"sorts",
"and",
"deduplicates",
"a",
"slice",
"of",
"strings",
"in",
"place",
"returning",
"the",
"resulting",
"set",
"."
] | 708d80f4a27458f99f8ca12bd0e638c6ee65627f | https://github.com/xtgo/set/blob/708d80f4a27458f99f8ca12bd0e638c6ee65627f/helpers.go#L27-L31 |
142,742 | xtgo/set | helpers.go | IntsDo | func IntsDo(op Op, s []int, t ...int) []int {
data := sort.IntSlice(append(s, t...))
n := op(data, len(s))
return data[:n]
} | go | func IntsDo(op Op, s []int, t ...int) []int {
data := sort.IntSlice(append(s, t...))
n := op(data, len(s))
return data[:n]
} | [
"func",
"IntsDo",
"(",
"op",
"Op",
",",
"s",
"[",
"]",
"int",
",",
"t",
"...",
"int",
")",
"[",
"]",
"int",
"{",
"data",
":=",
"sort",
".",
"IntSlice",
"(",
"append",
"(",
"s",
",",
"t",
"...",
")",
")",
"\n",
"n",
":=",
"op",
"(",
"data",
... | // IntsDo applies op to the int sets, s and t, returning the result.
// s and t must already be individually sorted and free of duplicates. | [
"IntsDo",
"applies",
"op",
"to",
"the",
"int",
"sets",
"s",
"and",
"t",
"returning",
"the",
"result",
".",
"s",
"and",
"t",
"must",
"already",
"be",
"individually",
"sorted",
"and",
"free",
"of",
"duplicates",
"."
] | 708d80f4a27458f99f8ca12bd0e638c6ee65627f | https://github.com/xtgo/set/blob/708d80f4a27458f99f8ca12bd0e638c6ee65627f/helpers.go#L35-L39 |
142,743 | xtgo/set | helpers.go | Float64sDo | func Float64sDo(op Op, s []float64, t ...float64) []float64 {
data := sort.Float64Slice(append(s, t...))
n := op(data, len(s))
return data[:n]
} | go | func Float64sDo(op Op, s []float64, t ...float64) []float64 {
data := sort.Float64Slice(append(s, t...))
n := op(data, len(s))
return data[:n]
} | [
"func",
"Float64sDo",
"(",
"op",
"Op",
",",
"s",
"[",
"]",
"float64",
",",
"t",
"...",
"float64",
")",
"[",
"]",
"float64",
"{",
"data",
":=",
"sort",
".",
"Float64Slice",
"(",
"append",
"(",
"s",
",",
"t",
"...",
")",
")",
"\n",
"n",
":=",
"op... | // Float64sDo applies op to the float64 sets, s and t, returning the result.
// s and t must already be individually sorted and free of duplicates. | [
"Float64sDo",
"applies",
"op",
"to",
"the",
"float64",
"sets",
"s",
"and",
"t",
"returning",
"the",
"result",
".",
"s",
"and",
"t",
"must",
"already",
"be",
"individually",
"sorted",
"and",
"free",
"of",
"duplicates",
"."
] | 708d80f4a27458f99f8ca12bd0e638c6ee65627f | https://github.com/xtgo/set/blob/708d80f4a27458f99f8ca12bd0e638c6ee65627f/helpers.go#L43-L47 |
142,744 | xtgo/set | helpers.go | StringsDo | func StringsDo(op Op, s []string, t ...string) []string {
data := sort.StringSlice(append(s, t...))
n := op(data, len(s))
return data[:n]
} | go | func StringsDo(op Op, s []string, t ...string) []string {
data := sort.StringSlice(append(s, t...))
n := op(data, len(s))
return data[:n]
} | [
"func",
"StringsDo",
"(",
"op",
"Op",
",",
"s",
"[",
"]",
"string",
",",
"t",
"...",
"string",
")",
"[",
"]",
"string",
"{",
"data",
":=",
"sort",
".",
"StringSlice",
"(",
"append",
"(",
"s",
",",
"t",
"...",
")",
")",
"\n",
"n",
":=",
"op",
... | // StringsDo applies op to the string sets, s and t, returning the result.
// s and t must already be individually sorted and free of duplicates. | [
"StringsDo",
"applies",
"op",
"to",
"the",
"string",
"sets",
"s",
"and",
"t",
"returning",
"the",
"result",
".",
"s",
"and",
"t",
"must",
"already",
"be",
"individually",
"sorted",
"and",
"free",
"of",
"duplicates",
"."
] | 708d80f4a27458f99f8ca12bd0e638c6ee65627f | https://github.com/xtgo/set/blob/708d80f4a27458f99f8ca12bd0e638c6ee65627f/helpers.go#L51-L55 |
142,745 | xtgo/set | helpers.go | IntsChk | func IntsChk(cmp Cmp, s []int, t ...int) bool {
data := sort.IntSlice(append(s, t...))
return cmp(data, len(s))
} | go | func IntsChk(cmp Cmp, s []int, t ...int) bool {
data := sort.IntSlice(append(s, t...))
return cmp(data, len(s))
} | [
"func",
"IntsChk",
"(",
"cmp",
"Cmp",
",",
"s",
"[",
"]",
"int",
",",
"t",
"...",
"int",
")",
"bool",
"{",
"data",
":=",
"sort",
".",
"IntSlice",
"(",
"append",
"(",
"s",
",",
"t",
"...",
")",
")",
"\n",
"return",
"cmp",
"(",
"data",
",",
"le... | // IntsChk compares s and t according to cmp. | [
"IntsChk",
"compares",
"s",
"and",
"t",
"according",
"to",
"cmp",
"."
] | 708d80f4a27458f99f8ca12bd0e638c6ee65627f | https://github.com/xtgo/set/blob/708d80f4a27458f99f8ca12bd0e638c6ee65627f/helpers.go#L58-L61 |
142,746 | xtgo/set | helpers.go | Float64sChk | func Float64sChk(cmp Cmp, s []float64, t ...float64) bool {
data := sort.Float64Slice(append(s, t...))
return cmp(data, len(s))
} | go | func Float64sChk(cmp Cmp, s []float64, t ...float64) bool {
data := sort.Float64Slice(append(s, t...))
return cmp(data, len(s))
} | [
"func",
"Float64sChk",
"(",
"cmp",
"Cmp",
",",
"s",
"[",
"]",
"float64",
",",
"t",
"...",
"float64",
")",
"bool",
"{",
"data",
":=",
"sort",
".",
"Float64Slice",
"(",
"append",
"(",
"s",
",",
"t",
"...",
")",
")",
"\n",
"return",
"cmp",
"(",
"dat... | // Float64sChk compares s and t according to cmp. | [
"Float64sChk",
"compares",
"s",
"and",
"t",
"according",
"to",
"cmp",
"."
] | 708d80f4a27458f99f8ca12bd0e638c6ee65627f | https://github.com/xtgo/set/blob/708d80f4a27458f99f8ca12bd0e638c6ee65627f/helpers.go#L64-L67 |
142,747 | xtgo/set | helpers.go | StringsChk | func StringsChk(cmp Cmp, s []string, t ...string) bool {
data := sort.StringSlice(append(s, t...))
return cmp(data, len(s))
} | go | func StringsChk(cmp Cmp, s []string, t ...string) bool {
data := sort.StringSlice(append(s, t...))
return cmp(data, len(s))
} | [
"func",
"StringsChk",
"(",
"cmp",
"Cmp",
",",
"s",
"[",
"]",
"string",
",",
"t",
"...",
"string",
")",
"bool",
"{",
"data",
":=",
"sort",
".",
"StringSlice",
"(",
"append",
"(",
"s",
",",
"t",
"...",
")",
")",
"\n",
"return",
"cmp",
"(",
"data",
... | // StringsChk compares s and t according to cmp. | [
"StringsChk",
"compares",
"s",
"and",
"t",
"according",
"to",
"cmp",
"."
] | 708d80f4a27458f99f8ca12bd0e638c6ee65627f | https://github.com/xtgo/set/blob/708d80f4a27458f99f8ca12bd0e638c6ee65627f/helpers.go#L70-L73 |
142,748 | tedsuo/ifrit | ginkgomon/ginkgomon.go | New | func New(config Config) *Runner {
return &Runner{
Name: config.Name,
Command: config.Command,
AnsiColorCode: config.AnsiColorCode,
StartCheck: config.StartCheck,
StartCheckTimeout: config.StartCheckTimeout,
Cleanup: config.Cleanup,
sessionReady: make(chan ... | go | func New(config Config) *Runner {
return &Runner{
Name: config.Name,
Command: config.Command,
AnsiColorCode: config.AnsiColorCode,
StartCheck: config.StartCheck,
StartCheckTimeout: config.StartCheckTimeout,
Cleanup: config.Cleanup,
sessionReady: make(chan ... | [
"func",
"New",
"(",
"config",
"Config",
")",
"*",
"Runner",
"{",
"return",
"&",
"Runner",
"{",
"Name",
":",
"config",
".",
"Name",
",",
"Command",
":",
"config",
".",
"Command",
",",
"AnsiColorCode",
":",
"config",
".",
"AnsiColorCode",
",",
"StartCheck"... | // New creates a ginkgomon Runner from a config object. Runners must be created
// with New to properly initialize their internal state. | [
"New",
"creates",
"a",
"ginkgomon",
"Runner",
"from",
"a",
"config",
"object",
".",
"Runners",
"must",
"be",
"created",
"with",
"New",
"to",
"properly",
"initialize",
"their",
"internal",
"state",
"."
] | bea94bb476ccecfbd31b12ed493a971bdb8c904b | https://github.com/tedsuo/ifrit/blob/bea94bb476ccecfbd31b12ed493a971bdb8c904b/ginkgomon/ginkgomon.go#L52-L62 |
142,749 | tedsuo/ifrit | ginkgomon/ginkgomon.go | ExitCode | func (r *Runner) ExitCode() int {
if r.sessionReady == nil {
ginkgo.Fail(fmt.Sprintf("ginkgomon.Runner '%s' improperly created without using New", r.Name))
}
<-r.sessionReady
return r.session.ExitCode()
} | go | func (r *Runner) ExitCode() int {
if r.sessionReady == nil {
ginkgo.Fail(fmt.Sprintf("ginkgomon.Runner '%s' improperly created without using New", r.Name))
}
<-r.sessionReady
return r.session.ExitCode()
} | [
"func",
"(",
"r",
"*",
"Runner",
")",
"ExitCode",
"(",
")",
"int",
"{",
"if",
"r",
".",
"sessionReady",
"==",
"nil",
"{",
"ginkgo",
".",
"Fail",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"r",
".",
"Name",
")",
")",
"\n",
"}",
"\n",
"<... | // ExitCode returns the exit code of the process, or -1 if the process has not
// exited. It can be used with the gexec.Exit matcher. | [
"ExitCode",
"returns",
"the",
"exit",
"code",
"of",
"the",
"process",
"or",
"-",
"1",
"if",
"the",
"process",
"has",
"not",
"exited",
".",
"It",
"can",
"be",
"used",
"with",
"the",
"gexec",
".",
"Exit",
"matcher",
"."
] | bea94bb476ccecfbd31b12ed493a971bdb8c904b | https://github.com/tedsuo/ifrit/blob/bea94bb476ccecfbd31b12ed493a971bdb8c904b/ginkgomon/ginkgomon.go#L66-L72 |
142,750 | tedsuo/ifrit | ginkgomon/ginkgomon.go | Buffer | func (r *Runner) Buffer() *gbytes.Buffer {
if r.sessionReady == nil {
ginkgo.Fail(fmt.Sprintf("ginkgomon.Runner '%s' improperly created without using New", r.Name))
}
<-r.sessionReady
return r.session.Buffer()
} | go | func (r *Runner) Buffer() *gbytes.Buffer {
if r.sessionReady == nil {
ginkgo.Fail(fmt.Sprintf("ginkgomon.Runner '%s' improperly created without using New", r.Name))
}
<-r.sessionReady
return r.session.Buffer()
} | [
"func",
"(",
"r",
"*",
"Runner",
")",
"Buffer",
"(",
")",
"*",
"gbytes",
".",
"Buffer",
"{",
"if",
"r",
".",
"sessionReady",
"==",
"nil",
"{",
"ginkgo",
".",
"Fail",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"r",
".",
"Name",
")",
")",
... | // Buffer returns a gbytes.Buffer, for use with the gbytes.Say matcher. | [
"Buffer",
"returns",
"a",
"gbytes",
".",
"Buffer",
"for",
"use",
"with",
"the",
"gbytes",
".",
"Say",
"matcher",
"."
] | bea94bb476ccecfbd31b12ed493a971bdb8c904b | https://github.com/tedsuo/ifrit/blob/bea94bb476ccecfbd31b12ed493a971bdb8c904b/ginkgomon/ginkgomon.go#L75-L81 |
142,751 | tedsuo/ifrit | grpc_server/server.go | NewGRPCServer | func NewGRPCServer(listenAddress string, tlsConfig *tls.Config, handler, serverRegistrar interface{}) ifrit.Runner {
return &grpcServerRunner{
listenAddress: listenAddress,
handler: handler,
serverRegistrar: serverRegistrar,
tlsConfig: tlsConfig,
}
} | go | func NewGRPCServer(listenAddress string, tlsConfig *tls.Config, handler, serverRegistrar interface{}) ifrit.Runner {
return &grpcServerRunner{
listenAddress: listenAddress,
handler: handler,
serverRegistrar: serverRegistrar,
tlsConfig: tlsConfig,
}
} | [
"func",
"NewGRPCServer",
"(",
"listenAddress",
"string",
",",
"tlsConfig",
"*",
"tls",
".",
"Config",
",",
"handler",
",",
"serverRegistrar",
"interface",
"{",
"}",
")",
"ifrit",
".",
"Runner",
"{",
"return",
"&",
"grpcServerRunner",
"{",
"listenAddress",
":",... | // NewGRPCServer returns an ifrit.Runner for your GRPC server process, given artifacts normally generated from a
// protobuf service definition by protoc.
//
// tlsConfig is optional. If nil the server will run insecure.
//
// handler must be an implementation of the interface generated by protoc.
//
// serverRegistra... | [
"NewGRPCServer",
"returns",
"an",
"ifrit",
".",
"Runner",
"for",
"your",
"GRPC",
"server",
"process",
"given",
"artifacts",
"normally",
"generated",
"from",
"a",
"protobuf",
"service",
"definition",
"by",
"protoc",
".",
"tlsConfig",
"is",
"optional",
".",
"If",
... | bea94bb476ccecfbd31b12ed493a971bdb8c904b | https://github.com/tedsuo/ifrit/blob/bea94bb476ccecfbd31b12ed493a971bdb8c904b/grpc_server/server.go#L36-L43 |
142,752 | codeship/codeship-go | options.go | BaseURL | func BaseURL(baseURL string) Option {
return func(c *Client) error {
c.baseURL = baseURL
return nil
}
} | go | func BaseURL(baseURL string) Option {
return func(c *Client) error {
c.baseURL = baseURL
return nil
}
} | [
"func",
"BaseURL",
"(",
"baseURL",
"string",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Client",
")",
"error",
"{",
"c",
".",
"baseURL",
"=",
"baseURL",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] | // BaseURL allows overriding of API client baseURL for testing | [
"BaseURL",
"allows",
"overriding",
"of",
"API",
"client",
"baseURL",
"for",
"testing"
] | f94652240d8cc3bdb4bade9296fd852a603c0038 | https://github.com/codeship/codeship-go/blob/f94652240d8cc3bdb4bade9296fd852a603c0038/options.go#L28-L33 |
142,753 | codeship/codeship-go | options.go | Logger | func Logger(logger StdLogger) Option {
return func(c *Client) error {
c.logger = logger
return nil
}
} | go | func Logger(logger StdLogger) Option {
return func(c *Client) error {
c.logger = logger
return nil
}
} | [
"func",
"Logger",
"(",
"logger",
"StdLogger",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Client",
")",
"error",
"{",
"c",
".",
"logger",
"=",
"logger",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] | // Logger allows overriding the default STDOUT logger | [
"Logger",
"allows",
"overriding",
"the",
"default",
"STDOUT",
"logger"
] | f94652240d8cc3bdb4bade9296fd852a603c0038 | https://github.com/codeship/codeship-go/blob/f94652240d8cc3bdb4bade9296fd852a603c0038/options.go#L36-L41 |
142,754 | codeship/codeship-go | codeship.go | New | func New(auth Authenticator, opts ...Option) (*Client, error) {
if auth == nil {
return nil, errors.New("no authenticator provided")
}
client := &Client{
authenticator: auth,
baseURL: apiURL,
headers: make(http.Header),
}
if err := client.parseOptions(opts...); err != nil {
return nil, erro... | go | func New(auth Authenticator, opts ...Option) (*Client, error) {
if auth == nil {
return nil, errors.New("no authenticator provided")
}
client := &Client{
authenticator: auth,
baseURL: apiURL,
headers: make(http.Header),
}
if err := client.parseOptions(opts...); err != nil {
return nil, erro... | [
"func",
"New",
"(",
"auth",
"Authenticator",
",",
"opts",
"...",
"Option",
")",
"(",
"*",
"Client",
",",
"error",
")",
"{",
"if",
"auth",
"==",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"clie... | // New creates a new Codeship API client | [
"New",
"creates",
"a",
"new",
"Codeship",
"API",
"client"
] | f94652240d8cc3bdb4bade9296fd852a603c0038 | https://github.com/codeship/codeship-go/blob/f94652240d8cc3bdb4bade9296fd852a603c0038/codeship.go#L111-L143 |
142,755 | codeship/codeship-go | codeship.go | Organization | func (c *Client) Organization(ctx context.Context, name string) (*Organization, error) {
if name == "" {
return nil, errors.New("no organization name provided")
}
if c.AuthenticationRequired() {
if _, err := c.Authenticate(ctx); err != nil {
return nil, errors.Wrap(err, "authentication failed")
}
}
for ... | go | func (c *Client) Organization(ctx context.Context, name string) (*Organization, error) {
if name == "" {
return nil, errors.New("no organization name provided")
}
if c.AuthenticationRequired() {
if _, err := c.Authenticate(ctx); err != nil {
return nil, errors.Wrap(err, "authentication failed")
}
}
for ... | [
"func",
"(",
"c",
"*",
"Client",
")",
"Organization",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"string",
")",
"(",
"*",
"Organization",
",",
"error",
")",
"{",
"if",
"name",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"errors",
".",
"Ne... | // Organization scopes a client to a single Organization, allowing the user to make calls to the API | [
"Organization",
"scopes",
"a",
"client",
"to",
"a",
"single",
"Organization",
"allowing",
"the",
"user",
"to",
"make",
"calls",
"to",
"the",
"API"
] | f94652240d8cc3bdb4bade9296fd852a603c0038 | https://github.com/codeship/codeship-go/blob/f94652240d8cc3bdb4bade9296fd852a603c0038/codeship.go#L146-L168 |
142,756 | codeship/codeship-go | codeship.go | AuthenticationRequired | func (c *Client) AuthenticationRequired() bool {
return c.authentication.AccessToken == "" || c.authentication.ExpiresAt <= time.Now().Unix()
} | go | func (c *Client) AuthenticationRequired() bool {
return c.authentication.AccessToken == "" || c.authentication.ExpiresAt <= time.Now().Unix()
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"AuthenticationRequired",
"(",
")",
"bool",
"{",
"return",
"c",
".",
"authentication",
".",
"AccessToken",
"==",
"\"",
"\"",
"||",
"c",
".",
"authentication",
".",
"ExpiresAt",
"<=",
"time",
".",
"Now",
"(",
")",
"... | // AuthenticationRequired determines if a client must authenticate before making a request | [
"AuthenticationRequired",
"determines",
"if",
"a",
"client",
"must",
"authenticate",
"before",
"making",
"a",
"request"
] | f94652240d8cc3bdb4bade9296fd852a603c0038 | https://github.com/codeship/codeship-go/blob/f94652240d8cc3bdb4bade9296fd852a603c0038/codeship.go#L176-L178 |
142,757 | codeship/codeship-go | projects.go | UnmarshalJSON | func (t *ProjectType) UnmarshalJSON(data []byte) error {
var s string
if err := json.Unmarshal(data, &s); err != nil {
return fmt.Errorf("ProjectType should be a string, got %T", data)
}
v, ok := _projectTypeNameToValue[s]
if !ok {
return fmt.Errorf("invalid ProjectType: %s", s)
}
*t = v
return nil
} | go | func (t *ProjectType) UnmarshalJSON(data []byte) error {
var s string
if err := json.Unmarshal(data, &s); err != nil {
return fmt.Errorf("ProjectType should be a string, got %T", data)
}
v, ok := _projectTypeNameToValue[s]
if !ok {
return fmt.Errorf("invalid ProjectType: %s", s)
}
*t = v
return nil
} | [
"func",
"(",
"t",
"*",
"ProjectType",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"var",
"s",
"string",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"s",
")",
";",
"err",
"!=",
"nil",
"{",
... | // UnmarshalJSON unmarshals JSON to a ProjectType | [
"UnmarshalJSON",
"unmarshals",
"JSON",
"to",
"a",
"ProjectType"
] | f94652240d8cc3bdb4bade9296fd852a603c0038 | https://github.com/codeship/codeship-go/blob/f94652240d8cc3bdb4bade9296fd852a603c0038/projects.go#L43-L54 |
142,758 | codeship/codeship-go | pagination.go | NextPage | func (l Links) NextPage() (int, error) {
if l.Next == "" {
return 0, nil
}
return pageForURL(l.Next)
} | go | func (l Links) NextPage() (int, error) {
if l.Next == "" {
return 0, nil
}
return pageForURL(l.Next)
} | [
"func",
"(",
"l",
"Links",
")",
"NextPage",
"(",
")",
"(",
"int",
",",
"error",
")",
"{",
"if",
"l",
".",
"Next",
"==",
"\"",
"\"",
"{",
"return",
"0",
",",
"nil",
"\n",
"}",
"\n",
"return",
"pageForURL",
"(",
"l",
".",
"Next",
")",
"\n",
"}"... | // NextPage returns the page number of the next page | [
"NextPage",
"returns",
"the",
"page",
"number",
"of",
"the",
"next",
"page"
] | f94652240d8cc3bdb4bade9296fd852a603c0038 | https://github.com/codeship/codeship-go/blob/f94652240d8cc3bdb4bade9296fd852a603c0038/pagination.go#L75-L80 |
142,759 | codeship/codeship-go | pagination.go | PreviousPage | func (l Links) PreviousPage() (int, error) {
if l.Previous == "" {
return 0, nil
}
return pageForURL(l.Previous)
} | go | func (l Links) PreviousPage() (int, error) {
if l.Previous == "" {
return 0, nil
}
return pageForURL(l.Previous)
} | [
"func",
"(",
"l",
"Links",
")",
"PreviousPage",
"(",
")",
"(",
"int",
",",
"error",
")",
"{",
"if",
"l",
".",
"Previous",
"==",
"\"",
"\"",
"{",
"return",
"0",
",",
"nil",
"\n",
"}",
"\n",
"return",
"pageForURL",
"(",
"l",
".",
"Previous",
")",
... | // PreviousPage returns the page number of the previous page | [
"PreviousPage",
"returns",
"the",
"page",
"number",
"of",
"the",
"previous",
"page"
] | f94652240d8cc3bdb4bade9296fd852a603c0038 | https://github.com/codeship/codeship-go/blob/f94652240d8cc3bdb4bade9296fd852a603c0038/pagination.go#L83-L88 |
142,760 | codeship/codeship-go | pagination.go | CurrentPage | func (l Links) CurrentPage() (int, error) {
switch {
case l.Previous == "" && l.Next != "":
return 1, nil
case l.Previous != "":
prevPage, err := pageForURL(l.Previous)
if err != nil {
return 0, err
}
return prevPage + 1, nil
}
return 0, nil
} | go | func (l Links) CurrentPage() (int, error) {
switch {
case l.Previous == "" && l.Next != "":
return 1, nil
case l.Previous != "":
prevPage, err := pageForURL(l.Previous)
if err != nil {
return 0, err
}
return prevPage + 1, nil
}
return 0, nil
} | [
"func",
"(",
"l",
"Links",
")",
"CurrentPage",
"(",
")",
"(",
"int",
",",
"error",
")",
"{",
"switch",
"{",
"case",
"l",
".",
"Previous",
"==",
"\"",
"\"",
"&&",
"l",
".",
"Next",
"!=",
"\"",
"\"",
":",
"return",
"1",
",",
"nil",
"\n",
"case",
... | // CurrentPage returns the page number of the current page | [
"CurrentPage",
"returns",
"the",
"page",
"number",
"of",
"the",
"current",
"page"
] | f94652240d8cc3bdb4bade9296fd852a603c0038 | https://github.com/codeship/codeship-go/blob/f94652240d8cc3bdb4bade9296fd852a603c0038/pagination.go#L91-L104 |
142,761 | codeship/codeship-go | pagination.go | LastPage | func (l Links) LastPage() (int, error) {
if l.Last == "" {
return l.CurrentPage()
}
return pageForURL(l.Last)
} | go | func (l Links) LastPage() (int, error) {
if l.Last == "" {
return l.CurrentPage()
}
return pageForURL(l.Last)
} | [
"func",
"(",
"l",
"Links",
")",
"LastPage",
"(",
")",
"(",
"int",
",",
"error",
")",
"{",
"if",
"l",
".",
"Last",
"==",
"\"",
"\"",
"{",
"return",
"l",
".",
"CurrentPage",
"(",
")",
"\n",
"}",
"\n",
"return",
"pageForURL",
"(",
"l",
".",
"Last"... | // LastPage returns the page number of the last page | [
"LastPage",
"returns",
"the",
"page",
"number",
"of",
"the",
"last",
"page"
] | f94652240d8cc3bdb4bade9296fd852a603c0038 | https://github.com/codeship/codeship-go/blob/f94652240d8cc3bdb4bade9296fd852a603c0038/pagination.go#L107-L112 |
142,762 | codeship/codeship-go | authenticator.go | NewBasicAuth | func NewBasicAuth(username, password string) *BasicAuth {
return &BasicAuth{
Username: username,
Password: password,
}
} | go | func NewBasicAuth(username, password string) *BasicAuth {
return &BasicAuth{
Username: username,
Password: password,
}
} | [
"func",
"NewBasicAuth",
"(",
"username",
",",
"password",
"string",
")",
"*",
"BasicAuth",
"{",
"return",
"&",
"BasicAuth",
"{",
"Username",
":",
"username",
",",
"Password",
":",
"password",
",",
"}",
"\n",
"}"
] | // NewBasicAuth returns a new BasicAuth Authenticator | [
"NewBasicAuth",
"returns",
"a",
"new",
"BasicAuth",
"Authenticator"
] | f94652240d8cc3bdb4bade9296fd852a603c0038 | https://github.com/codeship/codeship-go/blob/f94652240d8cc3bdb4bade9296fd852a603c0038/authenticator.go#L11-L16 |
142,763 | Bandwidth/go-bandwidth | messages.go | GetMessages | func (api *Client) GetMessages(query ...*GetMessagesQuery) ([]*Message, error) {
var options *GetMessagesQuery
if len(query) > 0 {
options = query[0]
}
result, _, err := api.makeRequest(http.MethodGet, api.concatUserPath(messagesPath), &[]*Message{}, options)
if err != nil {
return nil, err
}
return *(result... | go | func (api *Client) GetMessages(query ...*GetMessagesQuery) ([]*Message, error) {
var options *GetMessagesQuery
if len(query) > 0 {
options = query[0]
}
result, _, err := api.makeRequest(http.MethodGet, api.concatUserPath(messagesPath), &[]*Message{}, options)
if err != nil {
return nil, err
}
return *(result... | [
"func",
"(",
"api",
"*",
"Client",
")",
"GetMessages",
"(",
"query",
"...",
"*",
"GetMessagesQuery",
")",
"(",
"[",
"]",
"*",
"Message",
",",
"error",
")",
"{",
"var",
"options",
"*",
"GetMessagesQuery",
"\n",
"if",
"len",
"(",
"query",
")",
">",
"0"... | // GetMessages returns list of all messages
// It returns list of Message instances or error | [
"GetMessages",
"returns",
"list",
"of",
"all",
"messages",
"It",
"returns",
"list",
"of",
"Message",
"instances",
"or",
"error"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/messages.go#L68-L78 |
142,764 | Bandwidth/go-bandwidth | messages.go | GetMessage | func (api *Client) GetMessage(id string) (*Message, error) {
result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s", api.concatUserPath(messagesPath), id), &Message{})
if err != nil {
return nil, err
}
return result.(*Message), nil
} | go | func (api *Client) GetMessage(id string) (*Message, error) {
result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s", api.concatUserPath(messagesPath), id), &Message{})
if err != nil {
return nil, err
}
return result.(*Message), nil
} | [
"func",
"(",
"api",
"*",
"Client",
")",
"GetMessage",
"(",
"id",
"string",
")",
"(",
"*",
"Message",
",",
"error",
")",
"{",
"result",
",",
"_",
",",
"err",
":=",
"api",
".",
"makeRequest",
"(",
"http",
".",
"MethodGet",
",",
"fmt",
".",
"Sprintf",... | // GetMessage returns a single message
// It returns Message instance or error | [
"GetMessage",
"returns",
"a",
"single",
"message",
"It",
"returns",
"Message",
"instance",
"or",
"error"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/messages.go#L106-L112 |
142,765 | Bandwidth/go-bandwidth | recordings.go | GetRecordings | func (api *Client) GetRecordings(query ...*GetRecordingsQuery) ([]*Recording, error) {
var options *GetRecordingsQuery
if len(query) > 0 {
options = query[0]
}
result, _, err := api.makeRequest(http.MethodGet, api.concatUserPath(recordingsPath), &[]*Recording{}, options)
if err != nil {
return nil, err
}
ret... | go | func (api *Client) GetRecordings(query ...*GetRecordingsQuery) ([]*Recording, error) {
var options *GetRecordingsQuery
if len(query) > 0 {
options = query[0]
}
result, _, err := api.makeRequest(http.MethodGet, api.concatUserPath(recordingsPath), &[]*Recording{}, options)
if err != nil {
return nil, err
}
ret... | [
"func",
"(",
"api",
"*",
"Client",
")",
"GetRecordings",
"(",
"query",
"...",
"*",
"GetRecordingsQuery",
")",
"(",
"[",
"]",
"*",
"Recording",
",",
"error",
")",
"{",
"var",
"options",
"*",
"GetRecordingsQuery",
"\n",
"if",
"len",
"(",
"query",
")",
">... | // GetRecordings returns a list of the calls recordings
// It returns list of Recording instances or error | [
"GetRecordings",
"returns",
"a",
"list",
"of",
"the",
"calls",
"recordings",
"It",
"returns",
"list",
"of",
"Recording",
"instances",
"or",
"error"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/recordings.go#L28-L38 |
142,766 | Bandwidth/go-bandwidth | domains.go | GetDomains | func (api *Client) GetDomains(query ...*GetDomainsQuery) ([]*Domain, error) {
var options *GetDomainsQuery
if len(query) > 0 {
options = query[0]
}
result, _, err := api.makeRequest(http.MethodGet, api.concatUserPath(domainsPath), &[]*Domain{}, options)
if err != nil {
return nil, err
}
return *(result.(*[]*... | go | func (api *Client) GetDomains(query ...*GetDomainsQuery) ([]*Domain, error) {
var options *GetDomainsQuery
if len(query) > 0 {
options = query[0]
}
result, _, err := api.makeRequest(http.MethodGet, api.concatUserPath(domainsPath), &[]*Domain{}, options)
if err != nil {
return nil, err
}
return *(result.(*[]*... | [
"func",
"(",
"api",
"*",
"Client",
")",
"GetDomains",
"(",
"query",
"...",
"*",
"GetDomainsQuery",
")",
"(",
"[",
"]",
"*",
"Domain",
",",
"error",
")",
"{",
"var",
"options",
"*",
"GetDomainsQuery",
"\n",
"if",
"len",
"(",
"query",
")",
">",
"0",
... | // GetDomains returns a list of the domains that have been created
// It returns list of Domain instances or error | [
"GetDomains",
"returns",
"a",
"list",
"of",
"the",
"domains",
"that",
"have",
"been",
"created",
"It",
"returns",
"list",
"of",
"Domain",
"instances",
"or",
"error"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/domains.go#L24-L34 |
142,767 | Bandwidth/go-bandwidth | domains.go | CreateDomain | func (api *Client) CreateDomain(data *CreateDomainData) (string, error) {
_, headers, err := api.makeRequest(http.MethodPost, api.concatUserPath(domainsPath), nil, data)
if err != nil {
return "", err
}
return getIDFromLocationHeader(headers), nil
} | go | func (api *Client) CreateDomain(data *CreateDomainData) (string, error) {
_, headers, err := api.makeRequest(http.MethodPost, api.concatUserPath(domainsPath), nil, data)
if err != nil {
return "", err
}
return getIDFromLocationHeader(headers), nil
} | [
"func",
"(",
"api",
"*",
"Client",
")",
"CreateDomain",
"(",
"data",
"*",
"CreateDomainData",
")",
"(",
"string",
",",
"error",
")",
"{",
"_",
",",
"headers",
",",
"err",
":=",
"api",
".",
"makeRequest",
"(",
"http",
".",
"MethodPost",
",",
"api",
".... | // CreateDomain creates a new domain
// It returns ID of created domain or error | [
"CreateDomain",
"creates",
"a",
"new",
"domain",
"It",
"returns",
"ID",
"of",
"created",
"domain",
"or",
"error"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/domains.go#L44-L50 |
142,768 | Bandwidth/go-bandwidth | domains.go | DeleteDomain | func (api *Client) DeleteDomain(id string) error {
_, _, err := api.makeRequest(http.MethodDelete, fmt.Sprintf("%s/%s", api.concatUserPath(domainsPath), id))
return err
} | go | func (api *Client) DeleteDomain(id string) error {
_, _, err := api.makeRequest(http.MethodDelete, fmt.Sprintf("%s/%s", api.concatUserPath(domainsPath), id))
return err
} | [
"func",
"(",
"api",
"*",
"Client",
")",
"DeleteDomain",
"(",
"id",
"string",
")",
"error",
"{",
"_",
",",
"_",
",",
"err",
":=",
"api",
".",
"makeRequest",
"(",
"http",
".",
"MethodDelete",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"api",
... | // DeleteDomain removes a domain
// It returns error object | [
"DeleteDomain",
"removes",
"a",
"domain",
"It",
"returns",
"error",
"object"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/domains.go#L54-L57 |
142,769 | Bandwidth/go-bandwidth | transcriptions.go | GetRecordingTranscriptions | func (api *Client) GetRecordingTranscriptions(id string) ([]*Transcription, error) {
result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s/%s", api.concatUserPath(recordingsPath), id, transcriptionsPath), &[]*Transcription{})
if err != nil {
return nil, err
}
return *(result.(*[]*Transcription)), n... | go | func (api *Client) GetRecordingTranscriptions(id string) ([]*Transcription, error) {
result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s/%s", api.concatUserPath(recordingsPath), id, transcriptionsPath), &[]*Transcription{})
if err != nil {
return nil, err
}
return *(result.(*[]*Transcription)), n... | [
"func",
"(",
"api",
"*",
"Client",
")",
"GetRecordingTranscriptions",
"(",
"id",
"string",
")",
"(",
"[",
"]",
"*",
"Transcription",
",",
"error",
")",
"{",
"result",
",",
"_",
",",
"err",
":=",
"api",
".",
"makeRequest",
"(",
"http",
".",
"MethodGet",... | // GetRecordingTranscriptions returns list of all transcriptions for a recording
// It returns list of Transcription instances or error | [
"GetRecordingTranscriptions",
"returns",
"list",
"of",
"all",
"transcriptions",
"for",
"a",
"recording",
"It",
"returns",
"list",
"of",
"Transcription",
"instances",
"or",
"error"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/transcriptions.go#L22-L28 |
142,770 | Bandwidth/go-bandwidth | transcriptions.go | CreateRecordingTranscription | func (api *Client) CreateRecordingTranscription(id string) (string, error) {
_, headers, err := api.makeRequest(http.MethodPost, fmt.Sprintf("%s/%s/%s", api.concatUserPath(recordingsPath), id, transcriptionsPath))
if err != nil {
return "", err
}
return getIDFromLocationHeader(headers), nil
} | go | func (api *Client) CreateRecordingTranscription(id string) (string, error) {
_, headers, err := api.makeRequest(http.MethodPost, fmt.Sprintf("%s/%s/%s", api.concatUserPath(recordingsPath), id, transcriptionsPath))
if err != nil {
return "", err
}
return getIDFromLocationHeader(headers), nil
} | [
"func",
"(",
"api",
"*",
"Client",
")",
"CreateRecordingTranscription",
"(",
"id",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"_",
",",
"headers",
",",
"err",
":=",
"api",
".",
"makeRequest",
"(",
"http",
".",
"MethodPost",
",",
"fmt",
".",
... | // CreateRecordingTranscription creates a new transcription for a recording
// It returns ID of created transcription or error | [
"CreateRecordingTranscription",
"creates",
"a",
"new",
"transcription",
"for",
"a",
"recording",
"It",
"returns",
"ID",
"of",
"created",
"transcription",
"or",
"error"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/transcriptions.go#L32-L38 |
142,771 | Bandwidth/go-bandwidth | transcriptions.go | GetRecordingTranscription | func (api *Client) GetRecordingTranscription(recordingID string, transcriptionID string) (*Transcription, error) {
result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s/%s/%s", api.concatUserPath(recordingsPath), recordingID, transcriptionsPath, transcriptionID), &Transcription{})
if err != nil {
ret... | go | func (api *Client) GetRecordingTranscription(recordingID string, transcriptionID string) (*Transcription, error) {
result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s/%s/%s", api.concatUserPath(recordingsPath), recordingID, transcriptionsPath, transcriptionID), &Transcription{})
if err != nil {
ret... | [
"func",
"(",
"api",
"*",
"Client",
")",
"GetRecordingTranscription",
"(",
"recordingID",
"string",
",",
"transcriptionID",
"string",
")",
"(",
"*",
"Transcription",
",",
"error",
")",
"{",
"result",
",",
"_",
",",
"err",
":=",
"api",
".",
"makeRequest",
"(... | // GetRecordingTranscription returns single enpoint for a recording
// It returns Transcription instance or error | [
"GetRecordingTranscription",
"returns",
"single",
"enpoint",
"for",
"a",
"recording",
"It",
"returns",
"Transcription",
"instance",
"or",
"error"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/transcriptions.go#L42-L48 |
142,772 | Bandwidth/go-bandwidth | endpoints.go | GetDomainEndpoints | func (api *Client) GetDomainEndpoints(id string, query ...*GetDomainEndpointsQuery) ([]*DomainEndpoint, error) {
var options *GetDomainEndpointsQuery
if len(query) > 0 {
options = query[0]
}
result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s/%s", api.concatUserPath(domainsPath), id, endpointsPat... | go | func (api *Client) GetDomainEndpoints(id string, query ...*GetDomainEndpointsQuery) ([]*DomainEndpoint, error) {
var options *GetDomainEndpointsQuery
if len(query) > 0 {
options = query[0]
}
result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s/%s", api.concatUserPath(domainsPath), id, endpointsPat... | [
"func",
"(",
"api",
"*",
"Client",
")",
"GetDomainEndpoints",
"(",
"id",
"string",
",",
"query",
"...",
"*",
"GetDomainEndpointsQuery",
")",
"(",
"[",
"]",
"*",
"DomainEndpoint",
",",
"error",
")",
"{",
"var",
"options",
"*",
"GetDomainEndpointsQuery",
"\n",... | // GetDomainEndpoints returns list of all endpoints for a domain
// It returns list of DomainEndpoint instances or error | [
"GetDomainEndpoints",
"returns",
"list",
"of",
"all",
"endpoints",
"for",
"a",
"domain",
"It",
"returns",
"list",
"of",
"DomainEndpoint",
"instances",
"or",
"error"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/endpoints.go#L54-L64 |
142,773 | Bandwidth/go-bandwidth | endpoints.go | CreateDomainEndpoint | func (api *Client) CreateDomainEndpoint(id string, data *DomainEndpointData) (string, error) {
_, headers, err := api.makeRequest(http.MethodPost, fmt.Sprintf("%s/%s/%s", api.concatUserPath(domainsPath), id, endpointsPath), nil, data)
if err != nil {
return "", err
}
return getIDFromLocationHeader(headers), nil
} | go | func (api *Client) CreateDomainEndpoint(id string, data *DomainEndpointData) (string, error) {
_, headers, err := api.makeRequest(http.MethodPost, fmt.Sprintf("%s/%s/%s", api.concatUserPath(domainsPath), id, endpointsPath), nil, data)
if err != nil {
return "", err
}
return getIDFromLocationHeader(headers), nil
} | [
"func",
"(",
"api",
"*",
"Client",
")",
"CreateDomainEndpoint",
"(",
"id",
"string",
",",
"data",
"*",
"DomainEndpointData",
")",
"(",
"string",
",",
"error",
")",
"{",
"_",
",",
"headers",
",",
"err",
":=",
"api",
".",
"makeRequest",
"(",
"http",
".",... | // CreateDomainEndpoint creates a new endpoint for a domain
// It returns ID of created endpoint or error | [
"CreateDomainEndpoint",
"creates",
"a",
"new",
"endpoint",
"for",
"a",
"domain",
"It",
"returns",
"ID",
"of",
"created",
"endpoint",
"or",
"error"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/endpoints.go#L68-L74 |
142,774 | Bandwidth/go-bandwidth | endpoints.go | GetDomainEndpoint | func (api *Client) GetDomainEndpoint(id string, endpointID string) (*DomainEndpoint, error) {
result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s/%s/%s", api.concatUserPath(domainsPath), id, endpointsPath, endpointID), &DomainEndpoint{})
if err != nil {
return nil, err
}
return result.(*DomainEnd... | go | func (api *Client) GetDomainEndpoint(id string, endpointID string) (*DomainEndpoint, error) {
result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s/%s/%s", api.concatUserPath(domainsPath), id, endpointsPath, endpointID), &DomainEndpoint{})
if err != nil {
return nil, err
}
return result.(*DomainEnd... | [
"func",
"(",
"api",
"*",
"Client",
")",
"GetDomainEndpoint",
"(",
"id",
"string",
",",
"endpointID",
"string",
")",
"(",
"*",
"DomainEndpoint",
",",
"error",
")",
"{",
"result",
",",
"_",
",",
"err",
":=",
"api",
".",
"makeRequest",
"(",
"http",
".",
... | // GetDomainEndpoint returns single enpoint for a domain
// It returns DomainEndpoint instance or error | [
"GetDomainEndpoint",
"returns",
"single",
"enpoint",
"for",
"a",
"domain",
"It",
"returns",
"DomainEndpoint",
"instance",
"or",
"error"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/endpoints.go#L78-L84 |
142,775 | Bandwidth/go-bandwidth | endpoints.go | DeleteDomainEndpoint | func (api *Client) DeleteDomainEndpoint(id string, endpointID string) error {
_, _, err := api.makeRequest(http.MethodDelete, fmt.Sprintf("%s/%s/%s/%s", api.concatUserPath(domainsPath), id, endpointsPath, endpointID))
return err
} | go | func (api *Client) DeleteDomainEndpoint(id string, endpointID string) error {
_, _, err := api.makeRequest(http.MethodDelete, fmt.Sprintf("%s/%s/%s/%s", api.concatUserPath(domainsPath), id, endpointsPath, endpointID))
return err
} | [
"func",
"(",
"api",
"*",
"Client",
")",
"DeleteDomainEndpoint",
"(",
"id",
"string",
",",
"endpointID",
"string",
")",
"error",
"{",
"_",
",",
"_",
",",
"err",
":=",
"api",
".",
"makeRequest",
"(",
"http",
".",
"MethodDelete",
",",
"fmt",
".",
"Sprintf... | // DeleteDomainEndpoint removes a endpoint from domain
// It returns error object | [
"DeleteDomainEndpoint",
"removes",
"a",
"endpoint",
"from",
"domain",
"It",
"returns",
"error",
"object"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/endpoints.go#L88-L91 |
142,776 | Bandwidth/go-bandwidth | endpoints.go | UpdateDomainEndpoint | func (api *Client) UpdateDomainEndpoint(id string, endpointID string, changedData *DomainEndpointData) error {
_, _, err := api.makeRequest(http.MethodPost, fmt.Sprintf("%s/%s/%s/%s", api.concatUserPath(domainsPath), id, endpointsPath, endpointID), nil, changedData)
return err
} | go | func (api *Client) UpdateDomainEndpoint(id string, endpointID string, changedData *DomainEndpointData) error {
_, _, err := api.makeRequest(http.MethodPost, fmt.Sprintf("%s/%s/%s/%s", api.concatUserPath(domainsPath), id, endpointsPath, endpointID), nil, changedData)
return err
} | [
"func",
"(",
"api",
"*",
"Client",
")",
"UpdateDomainEndpoint",
"(",
"id",
"string",
",",
"endpointID",
"string",
",",
"changedData",
"*",
"DomainEndpointData",
")",
"error",
"{",
"_",
",",
"_",
",",
"err",
":=",
"api",
".",
"makeRequest",
"(",
"http",
"... | // UpdateDomainEndpoint removes a endpoint from domain
// It returns error object | [
"UpdateDomainEndpoint",
"removes",
"a",
"endpoint",
"from",
"domain",
"It",
"returns",
"error",
"object"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/endpoints.go#L95-L98 |
142,777 | Bandwidth/go-bandwidth | endpoints.go | CreateDomainEndpointToken | func (api *Client) CreateDomainEndpointToken(id, endpointID string) (*DomainEndpointToken, error) {
result, _, err := api.makeRequest(http.MethodPost, fmt.Sprintf("%s/%s/%s/%s/tokens", api.concatUserPath(domainsPath), id, endpointsPath, endpointID), &DomainEndpointToken{}, nil)
if err != nil {
return nil, err
}
r... | go | func (api *Client) CreateDomainEndpointToken(id, endpointID string) (*DomainEndpointToken, error) {
result, _, err := api.makeRequest(http.MethodPost, fmt.Sprintf("%s/%s/%s/%s/tokens", api.concatUserPath(domainsPath), id, endpointsPath, endpointID), &DomainEndpointToken{}, nil)
if err != nil {
return nil, err
}
r... | [
"func",
"(",
"api",
"*",
"Client",
")",
"CreateDomainEndpointToken",
"(",
"id",
",",
"endpointID",
"string",
")",
"(",
"*",
"DomainEndpointToken",
",",
"error",
")",
"{",
"result",
",",
"_",
",",
"err",
":=",
"api",
".",
"makeRequest",
"(",
"http",
".",
... | // CreateDomainEndpointToken creates a new auth token for a domain's enpoint
// It returns token or error | [
"CreateDomainEndpointToken",
"creates",
"a",
"new",
"auth",
"token",
"for",
"a",
"domain",
"s",
"enpoint",
"It",
"returns",
"token",
"or",
"error"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/endpoints.go#L102-L108 |
142,778 | Bandwidth/go-bandwidth | account.go | GetAccountTransactions | func (api *Client) GetAccountTransactions() ([]*AccountTransaction, error) {
result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s", api.concatUserPath(accountPath), "transactions"), &[]*AccountTransaction{})
if err != nil {
return nil, err
}
return *(result.(*[]*AccountTransaction)), nil
} | go | func (api *Client) GetAccountTransactions() ([]*AccountTransaction, error) {
result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s", api.concatUserPath(accountPath), "transactions"), &[]*AccountTransaction{})
if err != nil {
return nil, err
}
return *(result.(*[]*AccountTransaction)), nil
} | [
"func",
"(",
"api",
"*",
"Client",
")",
"GetAccountTransactions",
"(",
")",
"(",
"[",
"]",
"*",
"AccountTransaction",
",",
"error",
")",
"{",
"result",
",",
"_",
",",
"err",
":=",
"api",
".",
"makeRequest",
"(",
"http",
".",
"MethodGet",
",",
"fmt",
... | // GetAccountTransactions returns transactions from the user's account
// It returns list of AccountTransaction instances or error | [
"GetAccountTransactions",
"returns",
"transactions",
"from",
"the",
"user",
"s",
"account",
"It",
"returns",
"list",
"of",
"AccountTransaction",
"instances",
"or",
"error"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/account.go#L39-L45 |
142,779 | Bandwidth/go-bandwidth | media.go | GetMediaFiles | func (api *Client) GetMediaFiles() ([]*MediaFile, error) {
result, _, err := api.makeRequest(http.MethodGet, api.concatUserPath(mediaPath), &[]*MediaFile{})
if err != nil {
return nil, err
}
return *(result.(*[]*MediaFile)), nil
} | go | func (api *Client) GetMediaFiles() ([]*MediaFile, error) {
result, _, err := api.makeRequest(http.MethodGet, api.concatUserPath(mediaPath), &[]*MediaFile{})
if err != nil {
return nil, err
}
return *(result.(*[]*MediaFile)), nil
} | [
"func",
"(",
"api",
"*",
"Client",
")",
"GetMediaFiles",
"(",
")",
"(",
"[",
"]",
"*",
"MediaFile",
",",
"error",
")",
"{",
"result",
",",
"_",
",",
"err",
":=",
"api",
".",
"makeRequest",
"(",
"http",
".",
"MethodGet",
",",
"api",
".",
"concatUser... | // GetMediaFiles returns a list of your media files
// It returns list of MediaFile instances or error | [
"GetMediaFiles",
"returns",
"a",
"list",
"of",
"your",
"media",
"files",
"It",
"returns",
"list",
"of",
"MediaFile",
"instances",
"or",
"error"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/media.go#L23-L29 |
142,780 | Bandwidth/go-bandwidth | media.go | DeleteMediaFile | func (api *Client) DeleteMediaFile(name string) error {
_, _, err := api.makeRequest(http.MethodDelete, fmt.Sprintf("%s/%s", api.concatUserPath(mediaPath), url.QueryEscape(name)))
return err
} | go | func (api *Client) DeleteMediaFile(name string) error {
_, _, err := api.makeRequest(http.MethodDelete, fmt.Sprintf("%s/%s", api.concatUserPath(mediaPath), url.QueryEscape(name)))
return err
} | [
"func",
"(",
"api",
"*",
"Client",
")",
"DeleteMediaFile",
"(",
"name",
"string",
")",
"error",
"{",
"_",
",",
"_",
",",
"err",
":=",
"api",
".",
"makeRequest",
"(",
"http",
".",
"MethodDelete",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"ap... | // DeleteMediaFile removes a media file
// It returns error object | [
"DeleteMediaFile",
"removes",
"a",
"media",
"file",
"It",
"returns",
"error",
"object"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/media.go#L33-L36 |
142,781 | Bandwidth/go-bandwidth | bridges.go | GetBridges | func (api *Client) GetBridges(query ...*GetBridgesQuery) ([]*Bridge, error) {
var options *GetBridgesQuery
if len(query) > 0 {
options = query[0]
}
result, _, err := api.makeRequest(http.MethodGet, api.concatUserPath(bridgesPath), &[]*Bridge{}, options)
if err != nil {
return nil, err
}
return *(result.(*[]*... | go | func (api *Client) GetBridges(query ...*GetBridgesQuery) ([]*Bridge, error) {
var options *GetBridgesQuery
if len(query) > 0 {
options = query[0]
}
result, _, err := api.makeRequest(http.MethodGet, api.concatUserPath(bridgesPath), &[]*Bridge{}, options)
if err != nil {
return nil, err
}
return *(result.(*[]*... | [
"func",
"(",
"api",
"*",
"Client",
")",
"GetBridges",
"(",
"query",
"...",
"*",
"GetBridgesQuery",
")",
"(",
"[",
"]",
"*",
"Bridge",
",",
"error",
")",
"{",
"var",
"options",
"*",
"GetBridgesQuery",
"\n",
"if",
"len",
"(",
"query",
")",
">",
"0",
... | // GetBridges returns list of previous bridges
// It returns list of Bridge instances or error | [
"GetBridges",
"returns",
"list",
"of",
"previous",
"bridges",
"It",
"returns",
"list",
"of",
"Bridge",
"instances",
"or",
"error"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/bridges.go#L29-L39 |
142,782 | Bandwidth/go-bandwidth | bridges.go | CreateBridge | func (api *Client) CreateBridge(data *BridgeData) (string, error) {
_, headers, err := api.makeRequest(http.MethodPost, api.concatUserPath(bridgesPath), nil, data)
if err != nil {
return "", err
}
return getIDFromLocationHeader(headers), nil
} | go | func (api *Client) CreateBridge(data *BridgeData) (string, error) {
_, headers, err := api.makeRequest(http.MethodPost, api.concatUserPath(bridgesPath), nil, data)
if err != nil {
return "", err
}
return getIDFromLocationHeader(headers), nil
} | [
"func",
"(",
"api",
"*",
"Client",
")",
"CreateBridge",
"(",
"data",
"*",
"BridgeData",
")",
"(",
"string",
",",
"error",
")",
"{",
"_",
",",
"headers",
",",
"err",
":=",
"api",
".",
"makeRequest",
"(",
"http",
".",
"MethodPost",
",",
"api",
".",
"... | // CreateBridge creates a bridge
// It returns ID of created bridge | [
"CreateBridge",
"creates",
"a",
"bridge",
"It",
"returns",
"ID",
"of",
"created",
"bridge"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/bridges.go#L49-L55 |
142,783 | Bandwidth/go-bandwidth | calls.go | GetCalls | func (api *Client) GetCalls(query ...*GetCallsQuery) ([]*Call, error) {
var options *GetCallsQuery
if len(query) > 0 {
options = query[0]
}
result, _, err := api.makeRequest(http.MethodGet, api.concatUserPath(callsPath), &[]*Call{}, options)
if err != nil {
return nil, err
}
return *(result.(*[]*Call)), nil
... | go | func (api *Client) GetCalls(query ...*GetCallsQuery) ([]*Call, error) {
var options *GetCallsQuery
if len(query) > 0 {
options = query[0]
}
result, _, err := api.makeRequest(http.MethodGet, api.concatUserPath(callsPath), &[]*Call{}, options)
if err != nil {
return nil, err
}
return *(result.(*[]*Call)), nil
... | [
"func",
"(",
"api",
"*",
"Client",
")",
"GetCalls",
"(",
"query",
"...",
"*",
"GetCallsQuery",
")",
"(",
"[",
"]",
"*",
"Call",
",",
"error",
")",
"{",
"var",
"options",
"*",
"GetCallsQuery",
"\n",
"if",
"len",
"(",
"query",
")",
">",
"0",
"{",
"... | // GetCalls returns list of previous calls that were made or received
// It returns list of Call instances or error | [
"GetCalls",
"returns",
"list",
"of",
"previous",
"calls",
"that",
"were",
"made",
"or",
"received",
"It",
"returns",
"list",
"of",
"Call",
"instances",
"or",
"error"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/calls.go#L50-L60 |
142,784 | Bandwidth/go-bandwidth | calls.go | CreateCall | func (api *Client) CreateCall(data *CreateCallData) (string, error) {
_, headers, err := api.makeRequest(http.MethodPost, api.concatUserPath(callsPath), nil, data)
if err != nil {
return "", err
}
return getIDFromLocationHeader(headers), nil
} | go | func (api *Client) CreateCall(data *CreateCallData) (string, error) {
_, headers, err := api.makeRequest(http.MethodPost, api.concatUserPath(callsPath), nil, data)
if err != nil {
return "", err
}
return getIDFromLocationHeader(headers), nil
} | [
"func",
"(",
"api",
"*",
"Client",
")",
"CreateCall",
"(",
"data",
"*",
"CreateCallData",
")",
"(",
"string",
",",
"error",
")",
"{",
"_",
",",
"headers",
",",
"err",
":=",
"api",
".",
"makeRequest",
"(",
"http",
".",
"MethodPost",
",",
"api",
".",
... | // CreateCall creates an outbound phone call
// It returns ID of created call | [
"CreateCall",
"creates",
"an",
"outbound",
"phone",
"call",
"It",
"returns",
"ID",
"of",
"created",
"call"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/calls.go#L84-L90 |
142,785 | Bandwidth/go-bandwidth | calls.go | PlayAudioToCall | func (api *Client) PlayAudioToCall(id string, data *PlayAudioData) error {
_, _, err := api.makeRequest(http.MethodPost, fmt.Sprintf("%s/%s/%s", api.concatUserPath(callsPath), id, "audio"), nil, data)
return err
} | go | func (api *Client) PlayAudioToCall(id string, data *PlayAudioData) error {
_, _, err := api.makeRequest(http.MethodPost, fmt.Sprintf("%s/%s/%s", api.concatUserPath(callsPath), id, "audio"), nil, data)
return err
} | [
"func",
"(",
"api",
"*",
"Client",
")",
"PlayAudioToCall",
"(",
"id",
"string",
",",
"data",
"*",
"PlayAudioData",
")",
"error",
"{",
"_",
",",
"_",
",",
"err",
":=",
"api",
".",
"makeRequest",
"(",
"http",
".",
"MethodPost",
",",
"fmt",
".",
"Sprint... | // PlayAudioToCall plays an audio or speak a sentence in a call
// It returns error object | [
"PlayAudioToCall",
"plays",
"an",
"audio",
"or",
"speak",
"a",
"sentence",
"in",
"a",
"call",
"It",
"returns",
"error",
"object"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/calls.go#L124-L127 |
142,786 | Bandwidth/go-bandwidth | calls.go | GetCallEvents | func (api *Client) GetCallEvents(id string) ([]*CallEvent, error) {
result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s/%s", api.concatUserPath(callsPath), id, "events"), &[]*CallEvent{})
if err != nil {
return nil, err
}
return *(result.(*[]*CallEvent)), nil
} | go | func (api *Client) GetCallEvents(id string) ([]*CallEvent, error) {
result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s/%s", api.concatUserPath(callsPath), id, "events"), &[]*CallEvent{})
if err != nil {
return nil, err
}
return *(result.(*[]*CallEvent)), nil
} | [
"func",
"(",
"api",
"*",
"Client",
")",
"GetCallEvents",
"(",
"id",
"string",
")",
"(",
"[",
"]",
"*",
"CallEvent",
",",
"error",
")",
"{",
"result",
",",
"_",
",",
"err",
":=",
"api",
".",
"makeRequest",
"(",
"http",
".",
"MethodGet",
",",
"fmt",
... | // GetCallEvents returns the list of call events for a call
// It returns list of CallEvent instances or error | [
"GetCallEvents",
"returns",
"the",
"list",
"of",
"call",
"events",
"for",
"a",
"call",
"It",
"returns",
"list",
"of",
"CallEvent",
"instances",
"or",
"error"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/calls.go#L157-L163 |
142,787 | Bandwidth/go-bandwidth | calls.go | CreateGather | func (api *Client) CreateGather(id string, data *CreateGatherData) (string, error) {
_, headers, err := api.makeRequest(http.MethodPost, fmt.Sprintf("%s/%s/%s", api.concatUserPath(callsPath), id, "gather"), nil, data)
if err != nil {
return "", err
}
return getIDFromLocationHeader(headers), nil
} | go | func (api *Client) CreateGather(id string, data *CreateGatherData) (string, error) {
_, headers, err := api.makeRequest(http.MethodPost, fmt.Sprintf("%s/%s/%s", api.concatUserPath(callsPath), id, "gather"), nil, data)
if err != nil {
return "", err
}
return getIDFromLocationHeader(headers), nil
} | [
"func",
"(",
"api",
"*",
"Client",
")",
"CreateGather",
"(",
"id",
"string",
",",
"data",
"*",
"CreateGatherData",
")",
"(",
"string",
",",
"error",
")",
"{",
"_",
",",
"headers",
",",
"err",
":=",
"api",
".",
"makeRequest",
"(",
"http",
".",
"Method... | // CreateGather gathers the DTMF digits pressed in a call
// It returns ID of created gather or error | [
"CreateGather",
"gathers",
"the",
"DTMF",
"digits",
"pressed",
"in",
"a",
"call",
"It",
"returns",
"ID",
"of",
"created",
"gather",
"or",
"error"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/calls.go#L217-L223 |
142,788 | Bandwidth/go-bandwidth | calls.go | GetGather | func (api *Client) GetGather(id string, gatherID string) (*Gather, error) {
result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s/%s/%s", api.concatUserPath(callsPath), id, "gather", gatherID), &Gather{})
if err != nil {
return nil, err
}
return result.(*Gather), nil
} | go | func (api *Client) GetGather(id string, gatherID string) (*Gather, error) {
result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s/%s/%s", api.concatUserPath(callsPath), id, "gather", gatherID), &Gather{})
if err != nil {
return nil, err
}
return result.(*Gather), nil
} | [
"func",
"(",
"api",
"*",
"Client",
")",
"GetGather",
"(",
"id",
"string",
",",
"gatherID",
"string",
")",
"(",
"*",
"Gather",
",",
"error",
")",
"{",
"result",
",",
"_",
",",
"err",
":=",
"api",
".",
"makeRequest",
"(",
"http",
".",
"MethodGet",
",... | // GetGather returns the gather DTMF parameters and results of the call
// It returns Gather instance or error | [
"GetGather",
"returns",
"the",
"gather",
"DTMF",
"parameters",
"and",
"results",
"of",
"the",
"call",
"It",
"returns",
"Gather",
"instance",
"or",
"error"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/calls.go#L237-L243 |
142,789 | Bandwidth/go-bandwidth | numberInfo.go | GetNumberInfo | func (api *Client) GetNumberInfo(number string) (*NumberInfo, error) {
result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s", numberInfoPath, url.QueryEscape(number)), &NumberInfo{})
if err != nil {
return nil, err
}
return result.(*NumberInfo), nil
} | go | func (api *Client) GetNumberInfo(number string) (*NumberInfo, error) {
result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s", numberInfoPath, url.QueryEscape(number)), &NumberInfo{})
if err != nil {
return nil, err
}
return result.(*NumberInfo), nil
} | [
"func",
"(",
"api",
"*",
"Client",
")",
"GetNumberInfo",
"(",
"number",
"string",
")",
"(",
"*",
"NumberInfo",
",",
"error",
")",
"{",
"result",
",",
"_",
",",
"err",
":=",
"api",
".",
"makeRequest",
"(",
"http",
".",
"MethodGet",
",",
"fmt",
".",
... | // GetNumberInfo returns information fo given number
// It returns NumberInfo instance or error | [
"GetNumberInfo",
"returns",
"information",
"fo",
"given",
"number",
"It",
"returns",
"NumberInfo",
"instance",
"or",
"error"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/numberInfo.go#L21-L27 |
142,790 | Bandwidth/go-bandwidth | conferences.go | CreateConference | func (api *Client) CreateConference(data *CreateConferenceData) (string, error) {
_, headers, err := api.makeRequest(http.MethodPost, api.concatUserPath(conferencesPath), nil, data)
if err != nil {
return "", err
}
return getIDFromLocationHeader(headers), nil
} | go | func (api *Client) CreateConference(data *CreateConferenceData) (string, error) {
_, headers, err := api.makeRequest(http.MethodPost, api.concatUserPath(conferencesPath), nil, data)
if err != nil {
return "", err
}
return getIDFromLocationHeader(headers), nil
} | [
"func",
"(",
"api",
"*",
"Client",
")",
"CreateConference",
"(",
"data",
"*",
"CreateConferenceData",
")",
"(",
"string",
",",
"error",
")",
"{",
"_",
",",
"headers",
",",
"err",
":=",
"api",
".",
"makeRequest",
"(",
"http",
".",
"MethodPost",
",",
"ap... | // CreateConference creates a new conference
// It returns ID of creeated conference | [
"CreateConference",
"creates",
"a",
"new",
"conference",
"It",
"returns",
"ID",
"of",
"creeated",
"conference"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/conferences.go#L41-L47 |
142,791 | Bandwidth/go-bandwidth | conferences.go | CreateConferenceMember | func (api *Client) CreateConferenceMember(id string, data *CreateConferenceMemberData) (string, error) {
_, headers, err := api.makeRequest(http.MethodPost, fmt.Sprintf("%s/%s/%s", api.concatUserPath(conferencesPath), id, "members"), nil, data)
if err != nil {
return "", err
}
return getIDFromLocationHeader(heade... | go | func (api *Client) CreateConferenceMember(id string, data *CreateConferenceMemberData) (string, error) {
_, headers, err := api.makeRequest(http.MethodPost, fmt.Sprintf("%s/%s/%s", api.concatUserPath(conferencesPath), id, "members"), nil, data)
if err != nil {
return "", err
}
return getIDFromLocationHeader(heade... | [
"func",
"(",
"api",
"*",
"Client",
")",
"CreateConferenceMember",
"(",
"id",
"string",
",",
"data",
"*",
"CreateConferenceMemberData",
")",
"(",
"string",
",",
"error",
")",
"{",
"_",
",",
"headers",
",",
"err",
":=",
"api",
".",
"makeRequest",
"(",
"htt... | // CreateConferenceMember creates a new conference member
// It returns ID of created member | [
"CreateConferenceMember",
"creates",
"a",
"new",
"conference",
"member",
"It",
"returns",
"ID",
"of",
"created",
"member"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/conferences.go#L114-L120 |
142,792 | Bandwidth/go-bandwidth | conferences.go | GetConferenceMembers | func (api *Client) GetConferenceMembers(id string) ([]*ConferenceMember, error) {
result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s/%s", api.concatUserPath(conferencesPath), id, "members"), &[]*ConferenceMember{})
if err != nil {
return nil, err
}
return *(result.(*[]*ConferenceMember)), nil
} | go | func (api *Client) GetConferenceMembers(id string) ([]*ConferenceMember, error) {
result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s/%s", api.concatUserPath(conferencesPath), id, "members"), &[]*ConferenceMember{})
if err != nil {
return nil, err
}
return *(result.(*[]*ConferenceMember)), nil
} | [
"func",
"(",
"api",
"*",
"Client",
")",
"GetConferenceMembers",
"(",
"id",
"string",
")",
"(",
"[",
"]",
"*",
"ConferenceMember",
",",
"error",
")",
"{",
"result",
",",
"_",
",",
"err",
":=",
"api",
".",
"makeRequest",
"(",
"http",
".",
"MethodGet",
... | // GetConferenceMembers returns the list of conference members
// It returns list of ConferenceMember or error | [
"GetConferenceMembers",
"returns",
"the",
"list",
"of",
"conference",
"members",
"It",
"returns",
"list",
"of",
"ConferenceMember",
"or",
"error"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/conferences.go#L124-L130 |
142,793 | Bandwidth/go-bandwidth | xml/response.go | ToXML | func (r *Response) ToXML() string{
bytes, _ := xml.Marshal(r)
return string(bytes)
} | go | func (r *Response) ToXML() string{
bytes, _ := xml.Marshal(r)
return string(bytes)
} | [
"func",
"(",
"r",
"*",
"Response",
")",
"ToXML",
"(",
")",
"string",
"{",
"bytes",
",",
"_",
":=",
"xml",
".",
"Marshal",
"(",
"r",
")",
"\n",
"return",
"string",
"(",
"bytes",
")",
"\n",
"}"
] | // ToXML builds BXML as string | [
"ToXML",
"builds",
"BXML",
"as",
"string"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/xml/response.go#L14-L17 |
142,794 | Bandwidth/go-bandwidth | errors.go | GetErrors | func (api *Client) GetErrors(query ...*GetErrorsQuery) ([]*Error, error) {
var options *GetErrorsQuery
if len(query) > 0 {
options = query[0]
}
result, _, err := api.makeRequest(http.MethodGet, api.concatUserPath(errorsPath), &[]*Error{}, options)
if err != nil {
return nil, err
}
return *(result.(*[]*Error)... | go | func (api *Client) GetErrors(query ...*GetErrorsQuery) ([]*Error, error) {
var options *GetErrorsQuery
if len(query) > 0 {
options = query[0]
}
result, _, err := api.makeRequest(http.MethodGet, api.concatUserPath(errorsPath), &[]*Error{}, options)
if err != nil {
return nil, err
}
return *(result.(*[]*Error)... | [
"func",
"(",
"api",
"*",
"Client",
")",
"GetErrors",
"(",
"query",
"...",
"*",
"GetErrorsQuery",
")",
"(",
"[",
"]",
"*",
"Error",
",",
"error",
")",
"{",
"var",
"options",
"*",
"GetErrorsQuery",
"\n",
"if",
"len",
"(",
"query",
")",
">",
"0",
"{",... | // GetErrors returns list of errors
// It returns list of Error instances or error | [
"GetErrors",
"returns",
"list",
"of",
"errors",
"It",
"returns",
"list",
"of",
"Error",
"instances",
"or",
"error"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/errors.go#L35-L45 |
142,795 | Bandwidth/go-bandwidth | errors.go | GetError | func (api *Client) GetError(id string) (*Error, error) {
result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s", api.concatUserPath(errorsPath), id), &Error{})
if err != nil {
return nil, err
}
return result.(*Error), nil
} | go | func (api *Client) GetError(id string) (*Error, error) {
result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s", api.concatUserPath(errorsPath), id), &Error{})
if err != nil {
return nil, err
}
return result.(*Error), nil
} | [
"func",
"(",
"api",
"*",
"Client",
")",
"GetError",
"(",
"id",
"string",
")",
"(",
"*",
"Error",
",",
"error",
")",
"{",
"result",
",",
"_",
",",
"err",
":=",
"api",
".",
"makeRequest",
"(",
"http",
".",
"MethodGet",
",",
"fmt",
".",
"Sprintf",
"... | // GetError returns error by id
// It return Error instance for found error or error object | [
"GetError",
"returns",
"error",
"by",
"id",
"It",
"return",
"Error",
"instance",
"for",
"found",
"error",
"or",
"error",
"object"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/errors.go#L49-L55 |
142,796 | Bandwidth/go-bandwidth | availableNumbers.go | GetAvailableNumbers | func (api *Client) GetAvailableNumbers(numberType AvailableNumberType, query *GetAvailableNumberQuery) ([]*AvailableNumber, error) {
result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s", availableNumbersPath, numberType), &[]*AvailableNumber{}, query)
if err != nil {
return nil, err
}
return *(re... | go | func (api *Client) GetAvailableNumbers(numberType AvailableNumberType, query *GetAvailableNumberQuery) ([]*AvailableNumber, error) {
result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s", availableNumbersPath, numberType), &[]*AvailableNumber{}, query)
if err != nil {
return nil, err
}
return *(re... | [
"func",
"(",
"api",
"*",
"Client",
")",
"GetAvailableNumbers",
"(",
"numberType",
"AvailableNumberType",
",",
"query",
"*",
"GetAvailableNumberQuery",
")",
"(",
"[",
"]",
"*",
"AvailableNumber",
",",
"error",
")",
"{",
"result",
",",
"_",
",",
"err",
":=",
... | // GetAvailableNumbers looks for available numbers | [
"GetAvailableNumbers",
"looks",
"for",
"available",
"numbers"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/availableNumbers.go#L45-L51 |
142,797 | Bandwidth/go-bandwidth | availableNumbers.go | GetAndOrderAvailableNumbers | func (api *Client) GetAndOrderAvailableNumbers(numberType AvailableNumberType, query *GetAvailableNumberQuery) ([]*OrderedNumber, error) {
path := fmt.Sprintf("%s/%s", availableNumbersPath, numberType)
result, _, err := api.makeRequest(http.MethodPost, path, &[]*OrderedNumber{}, query, true)
if err != nil {
return... | go | func (api *Client) GetAndOrderAvailableNumbers(numberType AvailableNumberType, query *GetAvailableNumberQuery) ([]*OrderedNumber, error) {
path := fmt.Sprintf("%s/%s", availableNumbersPath, numberType)
result, _, err := api.makeRequest(http.MethodPost, path, &[]*OrderedNumber{}, query, true)
if err != nil {
return... | [
"func",
"(",
"api",
"*",
"Client",
")",
"GetAndOrderAvailableNumbers",
"(",
"numberType",
"AvailableNumberType",
",",
"query",
"*",
"GetAvailableNumberQuery",
")",
"(",
"[",
"]",
"*",
"OrderedNumber",
",",
"error",
")",
"{",
"path",
":=",
"fmt",
".",
"Sprintf"... | // GetAndOrderAvailableNumbers looks for available numbers and orders them | [
"GetAndOrderAvailableNumbers",
"looks",
"for",
"available",
"numbers",
"and",
"orders",
"them"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/availableNumbers.go#L63-L76 |
142,798 | Bandwidth/go-bandwidth | applications.go | GetApplications | func (api *Client) GetApplications(query ...*GetApplicationsQuery) ([]*Application, error) {
var options *GetApplicationsQuery
if len(query) > 0 {
options = query[0]
}
result, _, err := api.makeRequest(http.MethodGet, api.concatUserPath(applicationsPath), &[]*Application{}, options)
if err != nil {
return nil,... | go | func (api *Client) GetApplications(query ...*GetApplicationsQuery) ([]*Application, error) {
var options *GetApplicationsQuery
if len(query) > 0 {
options = query[0]
}
result, _, err := api.makeRequest(http.MethodGet, api.concatUserPath(applicationsPath), &[]*Application{}, options)
if err != nil {
return nil,... | [
"func",
"(",
"api",
"*",
"Client",
")",
"GetApplications",
"(",
"query",
"...",
"*",
"GetApplicationsQuery",
")",
"(",
"[",
"]",
"*",
"Application",
",",
"error",
")",
"{",
"var",
"options",
"*",
"GetApplicationsQuery",
"\n",
"if",
"len",
"(",
"query",
"... | // GetApplications returns list of user's applications
// It returns list of Application instances or error | [
"GetApplications",
"returns",
"list",
"of",
"user",
"s",
"applications",
"It",
"returns",
"list",
"of",
"Application",
"instances",
"or",
"error"
] | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/applications.go#L32-L42 |
142,799 | Bandwidth/go-bandwidth | applications.go | CreateApplication | func (api *Client) CreateApplication(data *ApplicationData) (string, error) {
_, headers, err := api.makeRequest(http.MethodPost, api.concatUserPath(applicationsPath), nil, data)
if err != nil {
return "", err
}
return getIDFromLocationHeader(headers), nil
} | go | func (api *Client) CreateApplication(data *ApplicationData) (string, error) {
_, headers, err := api.makeRequest(http.MethodPost, api.concatUserPath(applicationsPath), nil, data)
if err != nil {
return "", err
}
return getIDFromLocationHeader(headers), nil
} | [
"func",
"(",
"api",
"*",
"Client",
")",
"CreateApplication",
"(",
"data",
"*",
"ApplicationData",
")",
"(",
"string",
",",
"error",
")",
"{",
"_",
",",
"headers",
",",
"err",
":=",
"api",
".",
"makeRequest",
"(",
"http",
".",
"MethodPost",
",",
"api",
... | // CreateApplication creates an application that can handle calls and messages for one of your phone number. Many phone numbers can share an application.
// It returns ID of created application or error | [
"CreateApplication",
"creates",
"an",
"application",
"that",
"can",
"handle",
"calls",
"and",
"messages",
"for",
"one",
"of",
"your",
"phone",
"number",
".",
"Many",
"phone",
"numbers",
"can",
"share",
"an",
"application",
".",
"It",
"returns",
"ID",
"of",
"... | 76d8de5eeb96d25cf550d4f57fcdc152061f2568 | https://github.com/Bandwidth/go-bandwidth/blob/76d8de5eeb96d25cf550d4f57fcdc152061f2568/applications.go#L59-L65 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.