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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
152,700 | attwad/nessie | nessie.go | ServerProperties | func (n *nessusImpl) ServerProperties() (*ServerProperties, error) {
if n.verbose {
log.Println("Server properties...")
}
resp, err := n.doRequest("GET", "/server/properties", nil, []int{http.StatusOK})
if err != nil {
return nil, err
}
defer resp.Body.Close()
reply := &ServerProperties{}
if err = json.NewDecoder(resp.Body).Decode(&reply); err != nil {
return nil, err
}
return reply, nil
} | go | func (n *nessusImpl) ServerProperties() (*ServerProperties, error) {
if n.verbose {
log.Println("Server properties...")
}
resp, err := n.doRequest("GET", "/server/properties", nil, []int{http.StatusOK})
if err != nil {
return nil, err
}
defer resp.Body.Close()
reply := &ServerProperties{}
if err = json.NewDecoder(resp.Body).Decode(&reply); err != nil {
return nil, err
}
return reply, nil
} | [
"func",
"(",
"n",
"*",
"nessusImpl",
")",
"ServerProperties",
"(",
")",
"(",
"*",
"ServerProperties",
",",
"error",
")",
"{",
"if",
"n",
".",
"verbose",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"resp",
",",
"err",
":=",
... | // ServerProperties will return the current state of the nessus instance. | [
"ServerProperties",
"will",
"return",
"the",
"current",
"state",
"of",
"the",
"nessus",
"instance",
"."
] | dc0f47847ebbbf878f6689ab38fcec8c710b5ca9 | https://github.com/attwad/nessie/blob/dc0f47847ebbbf878f6689ab38fcec8c710b5ca9/nessie.go#L280-L295 |
152,701 | attwad/nessie | nessie.go | ServerStatus | func (n *nessusImpl) ServerStatus() (*ServerStatus, error) {
if n.verbose {
log.Println("Server status...")
}
resp, err := n.doRequest("GET", "/server/status", nil, []int{http.StatusOK, http.StatusServiceUnavailable})
if err != nil {
return nil, err
}
defer resp.Body.Close()
reply := &ServerStatus{}
if err = json.NewDecoder(resp.Body).Decode(&reply); err != nil {
return nil, err
}
if resp.StatusCode == http.StatusServiceUnavailable {
reply.MustDestroySession = true
}
return reply, nil
} | go | func (n *nessusImpl) ServerStatus() (*ServerStatus, error) {
if n.verbose {
log.Println("Server status...")
}
resp, err := n.doRequest("GET", "/server/status", nil, []int{http.StatusOK, http.StatusServiceUnavailable})
if err != nil {
return nil, err
}
defer resp.Body.Close()
reply := &ServerStatus{}
if err = json.NewDecoder(resp.Body).Decode(&reply); err != nil {
return nil, err
}
if resp.StatusCode == http.StatusServiceUnavailable {
reply.MustDestroySession = true
}
return reply, nil
} | [
"func",
"(",
"n",
"*",
"nessusImpl",
")",
"ServerStatus",
"(",
")",
"(",
"*",
"ServerStatus",
",",
"error",
")",
"{",
"if",
"n",
".",
"verbose",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"resp",
",",
"err",
":=",
"n",
... | // ServerStatus will return the current status of the nessus instance. | [
"ServerStatus",
"will",
"return",
"the",
"current",
"status",
"of",
"the",
"nessus",
"instance",
"."
] | dc0f47847ebbbf878f6689ab38fcec8c710b5ca9 | https://github.com/attwad/nessie/blob/dc0f47847ebbbf878f6689ab38fcec8c710b5ca9/nessie.go#L298-L316 |
152,702 | attwad/nessie | nessie.go | CreateUser | func (n *nessusImpl) CreateUser(username, password, userType, permissions, name, email string) (*User, error) {
if n.verbose {
log.Println("Creating new user...")
}
data := createUserRequest{
Username: username,
Password: password,
Permissions: permissions,
Type: userType,
}
if name != "" {
data.Name = name
}
if email != "" {
data.Email = email
}
resp, err := n.doRequest("POST", "/users", data, []int{http.StatusOK})
if err != nil {
return nil, err
}
defer resp.Body.Close()
reply := &User{}
if err = json.NewDecoder(resp.Body).Decode(&reply); err != nil {
return nil, err
}
return reply, nil
} | go | func (n *nessusImpl) CreateUser(username, password, userType, permissions, name, email string) (*User, error) {
if n.verbose {
log.Println("Creating new user...")
}
data := createUserRequest{
Username: username,
Password: password,
Permissions: permissions,
Type: userType,
}
if name != "" {
data.Name = name
}
if email != "" {
data.Email = email
}
resp, err := n.doRequest("POST", "/users", data, []int{http.StatusOK})
if err != nil {
return nil, err
}
defer resp.Body.Close()
reply := &User{}
if err = json.NewDecoder(resp.Body).Decode(&reply); err != nil {
return nil, err
}
return reply, nil
} | [
"func",
"(",
"n",
"*",
"nessusImpl",
")",
"CreateUser",
"(",
"username",
",",
"password",
",",
"userType",
",",
"permissions",
",",
"name",
",",
"email",
"string",
")",
"(",
"*",
"User",
",",
"error",
")",
"{",
"if",
"n",
".",
"verbose",
"{",
"log",
... | // CreateUser will register a new user with the nessus instance.
// Name and email can be empty. | [
"CreateUser",
"will",
"register",
"a",
"new",
"user",
"with",
"the",
"nessus",
"instance",
".",
"Name",
"and",
"email",
"can",
"be",
"empty",
"."
] | dc0f47847ebbbf878f6689ab38fcec8c710b5ca9 | https://github.com/attwad/nessie/blob/dc0f47847ebbbf878f6689ab38fcec8c710b5ca9/nessie.go#L331-L358 |
152,703 | attwad/nessie | nessie.go | ListUsers | func (n *nessusImpl) ListUsers() ([]User, error) {
if n.verbose {
log.Println("Listing users...")
}
resp, err := n.doRequest("GET", "/users", nil, []int{http.StatusOK})
if err != nil {
return nil, err
}
defer resp.Body.Close()
reply := &listUsersResp{}
if err = json.NewDecoder(resp.Body).Decode(&reply); err != nil {
return nil, err
}
return reply.Users, nil
} | go | func (n *nessusImpl) ListUsers() ([]User, error) {
if n.verbose {
log.Println("Listing users...")
}
resp, err := n.doRequest("GET", "/users", nil, []int{http.StatusOK})
if err != nil {
return nil, err
}
defer resp.Body.Close()
reply := &listUsersResp{}
if err = json.NewDecoder(resp.Body).Decode(&reply); err != nil {
return nil, err
}
return reply.Users, nil
} | [
"func",
"(",
"n",
"*",
"nessusImpl",
")",
"ListUsers",
"(",
")",
"(",
"[",
"]",
"User",
",",
"error",
")",
"{",
"if",
"n",
".",
"verbose",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"resp",
",",
"err",
":=",
"n",
"."... | // ListUsers will return the list of users on this nessus instance. | [
"ListUsers",
"will",
"return",
"the",
"list",
"of",
"users",
"on",
"this",
"nessus",
"instance",
"."
] | dc0f47847ebbbf878f6689ab38fcec8c710b5ca9 | https://github.com/attwad/nessie/blob/dc0f47847ebbbf878f6689ab38fcec8c710b5ca9/nessie.go#L361-L376 |
152,704 | attwad/nessie | nessie.go | DeleteUser | func (n *nessusImpl) DeleteUser(userID int) error {
if n.verbose {
log.Println("Deleting user...")
}
_, err := n.doRequest("DELETE", fmt.Sprintf("/users/%d", userID), nil, []int{http.StatusOK})
return err
} | go | func (n *nessusImpl) DeleteUser(userID int) error {
if n.verbose {
log.Println("Deleting user...")
}
_, err := n.doRequest("DELETE", fmt.Sprintf("/users/%d", userID), nil, []int{http.StatusOK})
return err
} | [
"func",
"(",
"n",
"*",
"nessusImpl",
")",
"DeleteUser",
"(",
"userID",
"int",
")",
"error",
"{",
"if",
"n",
".",
"verbose",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"_",
",",
"err",
":=",
"n",
".",
"doRequest",
"(",
... | // DeleteUser will remove a user from this nessus instance. | [
"DeleteUser",
"will",
"remove",
"a",
"user",
"from",
"this",
"nessus",
"instance",
"."
] | dc0f47847ebbbf878f6689ab38fcec8c710b5ca9 | https://github.com/attwad/nessie/blob/dc0f47847ebbbf878f6689ab38fcec8c710b5ca9/nessie.go#L379-L386 |
152,705 | attwad/nessie | nessie.go | SetUserPassword | func (n *nessusImpl) SetUserPassword(userID int, password string) error {
if n.verbose {
log.Println("Changing password of user...")
}
data := setUserPasswordRequest{
Password: password,
}
_, err := n.doRequest("PUT", fmt.Sprintf("/users/%d/chpasswd", userID), data, []int{http.StatusOK})
return err
} | go | func (n *nessusImpl) SetUserPassword(userID int, password string) error {
if n.verbose {
log.Println("Changing password of user...")
}
data := setUserPasswordRequest{
Password: password,
}
_, err := n.doRequest("PUT", fmt.Sprintf("/users/%d/chpasswd", userID), data, []int{http.StatusOK})
return err
} | [
"func",
"(",
"n",
"*",
"nessusImpl",
")",
"SetUserPassword",
"(",
"userID",
"int",
",",
"password",
"string",
")",
"error",
"{",
"if",
"n",
".",
"verbose",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"data",
":=",
"setUserPassw... | // SetUserPassword will change the password for the given user. | [
"SetUserPassword",
"will",
"change",
"the",
"password",
"for",
"the",
"given",
"user",
"."
] | dc0f47847ebbbf878f6689ab38fcec8c710b5ca9 | https://github.com/attwad/nessie/blob/dc0f47847ebbbf878f6689ab38fcec8c710b5ca9/nessie.go#L389-L399 |
152,706 | attwad/nessie | nessie.go | EditUser | func (n *nessusImpl) EditUser(userID int, permissions, name, email string) (*User, error) {
if n.verbose {
log.Println("Editing user...")
}
data := editUserRequest{}
if permissions != "" {
data.Permissions = permissions
}
if name != "" {
data.Name = name
}
if email != "" {
data.Email = email
}
resp, err := n.doRequest("PUT", fmt.Sprintf("/users/%d", userID), data, []int{http.StatusOK})
if err != nil {
return nil, err
}
defer resp.Body.Close()
reply := &User{}
if err = json.NewDecoder(resp.Body).Decode(&reply); err != nil {
return nil, err
}
return reply, nil
} | go | func (n *nessusImpl) EditUser(userID int, permissions, name, email string) (*User, error) {
if n.verbose {
log.Println("Editing user...")
}
data := editUserRequest{}
if permissions != "" {
data.Permissions = permissions
}
if name != "" {
data.Name = name
}
if email != "" {
data.Email = email
}
resp, err := n.doRequest("PUT", fmt.Sprintf("/users/%d", userID), data, []int{http.StatusOK})
if err != nil {
return nil, err
}
defer resp.Body.Close()
reply := &User{}
if err = json.NewDecoder(resp.Body).Decode(&reply); err != nil {
return nil, err
}
return reply, nil
} | [
"func",
"(",
"n",
"*",
"nessusImpl",
")",
"EditUser",
"(",
"userID",
"int",
",",
"permissions",
",",
"name",
",",
"email",
"string",
")",
"(",
"*",
"User",
",",
"error",
")",
"{",
"if",
"n",
".",
"verbose",
"{",
"log",
".",
"Println",
"(",
"\"",
... | // EditUser will edit certain information about a user.
// Any non empty parameter will be set. | [
"EditUser",
"will",
"edit",
"certain",
"information",
"about",
"a",
"user",
".",
"Any",
"non",
"empty",
"parameter",
"will",
"be",
"set",
"."
] | dc0f47847ebbbf878f6689ab38fcec8c710b5ca9 | https://github.com/attwad/nessie/blob/dc0f47847ebbbf878f6689ab38fcec8c710b5ca9/nessie.go#L403-L429 |
152,707 | attwad/nessie | nessie.go | StartScan | func (n *nessusImpl) StartScan(scanID int64) (string, error) {
if n.verbose {
log.Println("Starting scan...")
}
resp, err := n.doRequest("POST", fmt.Sprintf("/scans/%d/launch", scanID), nil, []int{http.StatusOK})
if err != nil {
return "", err
}
defer resp.Body.Close()
reply := &startScanResp{}
if err = json.NewDecoder(resp.Body).Decode(&reply); err != nil {
return "", err
}
return reply.UUID, nil
} | go | func (n *nessusImpl) StartScan(scanID int64) (string, error) {
if n.verbose {
log.Println("Starting scan...")
}
resp, err := n.doRequest("POST", fmt.Sprintf("/scans/%d/launch", scanID), nil, []int{http.StatusOK})
if err != nil {
return "", err
}
defer resp.Body.Close()
reply := &startScanResp{}
if err = json.NewDecoder(resp.Body).Decode(&reply); err != nil {
return "", err
}
return reply.UUID, nil
} | [
"func",
"(",
"n",
"*",
"nessusImpl",
")",
"StartScan",
"(",
"scanID",
"int64",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"n",
".",
"verbose",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"resp",
",",
"err",
":=",
... | // StartScan starts the given scan and returns its UUID. | [
"StartScan",
"starts",
"the",
"given",
"scan",
"and",
"returns",
"its",
"UUID",
"."
] | dc0f47847ebbbf878f6689ab38fcec8c710b5ca9 | https://github.com/attwad/nessie/blob/dc0f47847ebbbf878f6689ab38fcec8c710b5ca9/nessie.go#L669-L684 |
152,708 | attwad/nessie | nessie.go | ExportFinished | func (n *nessusImpl) ExportFinished(scanID, exportID int64) (bool, error) {
if n.verbose {
log.Println("Getting export status...")
}
resp, err := n.doRequest("GET", fmt.Sprintf("/scans/%d/export/%d/status", scanID, exportID), nil, []int{http.StatusOK})
if err != nil {
return false, err
}
defer resp.Body.Close()
reply := &exportStatusResp{}
if err = json.NewDecoder(resp.Body).Decode(&reply); err != nil {
return false, err
}
return reply.Status == "ready", nil
} | go | func (n *nessusImpl) ExportFinished(scanID, exportID int64) (bool, error) {
if n.verbose {
log.Println("Getting export status...")
}
resp, err := n.doRequest("GET", fmt.Sprintf("/scans/%d/export/%d/status", scanID, exportID), nil, []int{http.StatusOK})
if err != nil {
return false, err
}
defer resp.Body.Close()
reply := &exportStatusResp{}
if err = json.NewDecoder(resp.Body).Decode(&reply); err != nil {
return false, err
}
return reply.Status == "ready", nil
} | [
"func",
"(",
"n",
"*",
"nessusImpl",
")",
"ExportFinished",
"(",
"scanID",
",",
"exportID",
"int64",
")",
"(",
"bool",
",",
"error",
")",
"{",
"if",
"n",
".",
"verbose",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"resp",
... | // ExportFinished returns whether the given scan export file has finished being prepared. | [
"ExportFinished",
"returns",
"whether",
"the",
"given",
"scan",
"export",
"file",
"has",
"finished",
"being",
"prepared",
"."
] | dc0f47847ebbbf878f6689ab38fcec8c710b5ca9 | https://github.com/attwad/nessie/blob/dc0f47847ebbbf878f6689ab38fcec8c710b5ca9/nessie.go#L831-L846 |
152,709 | attwad/nessie | nessie.go | DownloadExport | func (n *nessusImpl) DownloadExport(scanID, exportID int64) ([]byte, error) {
if n.verbose {
log.Println("Downloading export file...")
}
resp, err := n.doRequest("GET", fmt.Sprintf("/scans/%d/export/%d/download", scanID, exportID), nil, []int{http.StatusOK})
if err != nil {
return nil, err
}
body, err := ioutil.ReadAll(resp.Body)
defer resp.Body.Close()
if err != nil {
return nil, err
}
return body, err
} | go | func (n *nessusImpl) DownloadExport(scanID, exportID int64) ([]byte, error) {
if n.verbose {
log.Println("Downloading export file...")
}
resp, err := n.doRequest("GET", fmt.Sprintf("/scans/%d/export/%d/download", scanID, exportID), nil, []int{http.StatusOK})
if err != nil {
return nil, err
}
body, err := ioutil.ReadAll(resp.Body)
defer resp.Body.Close()
if err != nil {
return nil, err
}
return body, err
} | [
"func",
"(",
"n",
"*",
"nessusImpl",
")",
"DownloadExport",
"(",
"scanID",
",",
"exportID",
"int64",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"n",
".",
"verbose",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n... | // DownloadExport will download the given export from nessus. | [
"DownloadExport",
"will",
"download",
"the",
"given",
"export",
"from",
"nessus",
"."
] | dc0f47847ebbbf878f6689ab38fcec8c710b5ca9 | https://github.com/attwad/nessie/blob/dc0f47847ebbbf878f6689ab38fcec8c710b5ca9/nessie.go#L849-L864 |
152,710 | pingcap/tso | client/client.go | MarkDone | func (pr *PipelineRequest) MarkDone(reply *proto.Response, err error) {
if err != nil {
pr.reply = nil
}
pr.reply = reply
pr.done <- errors.Trace(err)
} | go | func (pr *PipelineRequest) MarkDone(reply *proto.Response, err error) {
if err != nil {
pr.reply = nil
}
pr.reply = reply
pr.done <- errors.Trace(err)
} | [
"func",
"(",
"pr",
"*",
"PipelineRequest",
")",
"MarkDone",
"(",
"reply",
"*",
"proto",
".",
"Response",
",",
"err",
"error",
")",
"{",
"if",
"err",
"!=",
"nil",
"{",
"pr",
".",
"reply",
"=",
"nil",
"\n",
"}",
"\n",
"pr",
".",
"reply",
"=",
"repl... | // MarkDone sets the repsone for current request. | [
"MarkDone",
"sets",
"the",
"repsone",
"for",
"current",
"request",
"."
] | 118f6c141d58f1e72577ff61f43f649bf39355ee | https://github.com/pingcap/tso/blob/118f6c141d58f1e72577ff61f43f649bf39355ee/client/client.go#L57-L63 |
152,711 | pingcap/tso | client/client.go | GetTS | func (pr *PipelineRequest) GetTS() (*proto.Timestamp, error) {
err := <-pr.done
if err != nil {
return nil, errors.Trace(err)
}
return &pr.reply.Timestamp, nil
} | go | func (pr *PipelineRequest) GetTS() (*proto.Timestamp, error) {
err := <-pr.done
if err != nil {
return nil, errors.Trace(err)
}
return &pr.reply.Timestamp, nil
} | [
"func",
"(",
"pr",
"*",
"PipelineRequest",
")",
"GetTS",
"(",
")",
"(",
"*",
"proto",
".",
"Timestamp",
",",
"error",
")",
"{",
"err",
":=",
"<-",
"pr",
".",
"done",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Trace... | // GetTS gets the timestamp. | [
"GetTS",
"gets",
"the",
"timestamp",
"."
] | 118f6c141d58f1e72577ff61f43f649bf39355ee | https://github.com/pingcap/tso/blob/118f6c141d58f1e72577ff61f43f649bf39355ee/client/client.go#L66-L73 |
152,712 | pingcap/tso | client/client.go | NewClient | func NewClient(conf *Conf) *Client {
c := &Client{
requests: make(chan *PipelineRequest, maxPipelineRequest),
pending: list.New(),
conf: conf,
leaderCh: make(chan string, 1),
}
if len(conf.ZKAddr) == 0 {
c.leaderCh <- conf.ServerAddr
} else {
go c.watchLeader()
}
go c.workerLoop()
return c
} | go | func NewClient(conf *Conf) *Client {
c := &Client{
requests: make(chan *PipelineRequest, maxPipelineRequest),
pending: list.New(),
conf: conf,
leaderCh: make(chan string, 1),
}
if len(conf.ZKAddr) == 0 {
c.leaderCh <- conf.ServerAddr
} else {
go c.watchLeader()
}
go c.workerLoop()
return c
} | [
"func",
"NewClient",
"(",
"conf",
"*",
"Conf",
")",
"*",
"Client",
"{",
"c",
":=",
"&",
"Client",
"{",
"requests",
":",
"make",
"(",
"chan",
"*",
"PipelineRequest",
",",
"maxPipelineRequest",
")",
",",
"pending",
":",
"list",
".",
"New",
"(",
")",
",... | // NewClient creates a timestamp oracle client. | [
"NewClient",
"creates",
"a",
"timestamp",
"oracle",
"client",
"."
] | 118f6c141d58f1e72577ff61f43f649bf39355ee | https://github.com/pingcap/tso/blob/118f6c141d58f1e72577ff61f43f649bf39355ee/client/client.go#L76-L93 |
152,713 | pingcap/tso | client/client.go | GoGetTimestamp | func (c *Client) GoGetTimestamp() *PipelineRequest {
pr := newPipelineRequest()
c.requests <- pr
return pr
} | go | func (c *Client) GoGetTimestamp() *PipelineRequest {
pr := newPipelineRequest()
c.requests <- pr
return pr
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"GoGetTimestamp",
"(",
")",
"*",
"PipelineRequest",
"{",
"pr",
":=",
"newPipelineRequest",
"(",
")",
"\n",
"c",
".",
"requests",
"<-",
"pr",
"\n",
"return",
"pr",
"\n",
"}"
] | // GoGetTimestamp returns a PipelineRequest so you can get the timestamp later. | [
"GoGetTimestamp",
"returns",
"a",
"PipelineRequest",
"so",
"you",
"can",
"get",
"the",
"timestamp",
"later",
"."
] | 118f6c141d58f1e72577ff61f43f649bf39355ee | https://github.com/pingcap/tso/blob/118f6c141d58f1e72577ff61f43f649bf39355ee/client/client.go#L239-L243 |
152,714 | pingcap/tso | client/conn.go | NewConnection | func NewConnection(addr string, netTimeout time.Duration) (*Conn, error) {
conn, err := net.DialTimeout("tcp", addr, netTimeout)
if err != nil {
return nil, err
}
return &Conn{
addr: addr,
Conn: conn,
r: bufio.NewReaderSize(deadline.NewDeadlineReader(conn, netTimeout), 512*1024),
w: bufio.NewWriterSize(deadline.NewDeadlineWriter(conn, netTimeout), 512*1024),
netTimeout: netTimeout,
}, nil
} | go | func NewConnection(addr string, netTimeout time.Duration) (*Conn, error) {
conn, err := net.DialTimeout("tcp", addr, netTimeout)
if err != nil {
return nil, err
}
return &Conn{
addr: addr,
Conn: conn,
r: bufio.NewReaderSize(deadline.NewDeadlineReader(conn, netTimeout), 512*1024),
w: bufio.NewWriterSize(deadline.NewDeadlineWriter(conn, netTimeout), 512*1024),
netTimeout: netTimeout,
}, nil
} | [
"func",
"NewConnection",
"(",
"addr",
"string",
",",
"netTimeout",
"time",
".",
"Duration",
")",
"(",
"*",
"Conn",
",",
"error",
")",
"{",
"conn",
",",
"err",
":=",
"net",
".",
"DialTimeout",
"(",
"\"",
"\"",
",",
"addr",
",",
"netTimeout",
")",
"\n"... | // NewConnection creates a conn. | [
"NewConnection",
"creates",
"a",
"conn",
"."
] | 118f6c141d58f1e72577ff61f43f649bf39355ee | https://github.com/pingcap/tso/blob/118f6c141d58f1e72577ff61f43f649bf39355ee/client/conn.go#L22-L35 |
152,715 | pingcap/tso | client/conn.go | Read | func (c *Conn) Read(p []byte) (int, error) {
return c.r.Read(p)
} | go | func (c *Conn) Read(p []byte) (int, error) {
return c.r.Read(p)
} | [
"func",
"(",
"c",
"*",
"Conn",
")",
"Read",
"(",
"p",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"return",
"c",
".",
"r",
".",
"Read",
"(",
"p",
")",
"\n",
"}"
] | // Read reads data and stores it into p. | [
"Read",
"reads",
"data",
"and",
"stores",
"it",
"into",
"p",
"."
] | 118f6c141d58f1e72577ff61f43f649bf39355ee | https://github.com/pingcap/tso/blob/118f6c141d58f1e72577ff61f43f649bf39355ee/client/conn.go#L38-L40 |
152,716 | lestrrat/go-slack | dialog_gen.go | Open | func (s *DialogService) Open(dialog *objects.Dialog, trigger_id string) *DialogOpenCall {
var call DialogOpenCall
call.service = s
call.dialog = dialog
call.trigger_id = trigger_id
return &call
} | go | func (s *DialogService) Open(dialog *objects.Dialog, trigger_id string) *DialogOpenCall {
var call DialogOpenCall
call.service = s
call.dialog = dialog
call.trigger_id = trigger_id
return &call
} | [
"func",
"(",
"s",
"*",
"DialogService",
")",
"Open",
"(",
"dialog",
"*",
"objects",
".",
"Dialog",
",",
"trigger_id",
"string",
")",
"*",
"DialogOpenCall",
"{",
"var",
"call",
"DialogOpenCall",
"\n",
"call",
".",
"service",
"=",
"s",
"\n",
"call",
".",
... | // Open creates a DialogOpenCall object in preparation for accessing the dialog.open endpoint | [
"Open",
"creates",
"a",
"DialogOpenCall",
"object",
"in",
"preparation",
"for",
"accessing",
"the",
"dialog",
".",
"open",
"endpoint"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/dialog_gen.go#L27-L33 |
152,717 | lestrrat/go-slack | dialog_gen.go | ValidateArgs | func (c *DialogOpenCall) ValidateArgs() error {
if c.dialog == nil {
return errors.New(`required field dialog not initialized`)
}
if len(c.trigger_id) <= 0 {
return errors.New(`required field trigger_id not initialized`)
}
return nil
} | go | func (c *DialogOpenCall) ValidateArgs() error {
if c.dialog == nil {
return errors.New(`required field dialog not initialized`)
}
if len(c.trigger_id) <= 0 {
return errors.New(`required field trigger_id not initialized`)
}
return nil
} | [
"func",
"(",
"c",
"*",
"DialogOpenCall",
")",
"ValidateArgs",
"(",
")",
"error",
"{",
"if",
"c",
".",
"dialog",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"`required field dialog not initialized`",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"c",... | // ValidateArgs checks that all required fields are set in the DialogOpenCall object | [
"ValidateArgs",
"checks",
"that",
"all",
"required",
"fields",
"are",
"set",
"in",
"the",
"DialogOpenCall",
"object"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/dialog_gen.go#L36-L44 |
152,718 | lestrrat/go-slack | dialog_gen.go | Values | func (c *DialogOpenCall) Values() (url.Values, error) {
if err := c.ValidateArgs(); err != nil {
return nil, errors.Wrap(err, `failed validation`)
}
v := url.Values{}
v.Set(`token`, c.service.token)
dialogEncoded, err := c.dialog.Encode()
if err != nil {
return nil, errors.Wrap(err, `failed to encode field`)
}
v.Set("dialog", dialogEncoded)
v.Set("trigger_id", c.trigger_id)
return v, nil
} | go | func (c *DialogOpenCall) Values() (url.Values, error) {
if err := c.ValidateArgs(); err != nil {
return nil, errors.Wrap(err, `failed validation`)
}
v := url.Values{}
v.Set(`token`, c.service.token)
dialogEncoded, err := c.dialog.Encode()
if err != nil {
return nil, errors.Wrap(err, `failed to encode field`)
}
v.Set("dialog", dialogEncoded)
v.Set("trigger_id", c.trigger_id)
return v, nil
} | [
"func",
"(",
"c",
"*",
"DialogOpenCall",
")",
"Values",
"(",
")",
"(",
"url",
".",
"Values",
",",
"error",
")",
"{",
"if",
"err",
":=",
"c",
".",
"ValidateArgs",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",... | // Values returns the DialogOpenCall object as url.Values | [
"Values",
"returns",
"the",
"DialogOpenCall",
"object",
"as",
"url",
".",
"Values"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/dialog_gen.go#L47-L62 |
152,719 | lestrrat/go-slack | emoji_gen.go | List | func (s *EmojiService) List() *EmojiListCall {
var call EmojiListCall
call.service = s
return &call
} | go | func (s *EmojiService) List() *EmojiListCall {
var call EmojiListCall
call.service = s
return &call
} | [
"func",
"(",
"s",
"*",
"EmojiService",
")",
"List",
"(",
")",
"*",
"EmojiListCall",
"{",
"var",
"call",
"EmojiListCall",
"\n",
"call",
".",
"service",
"=",
"s",
"\n",
"return",
"&",
"call",
"\n",
"}"
] | // List creates a EmojiListCall object in preparation for accessing the emoji.list endpoint | [
"List",
"creates",
"a",
"EmojiListCall",
"object",
"in",
"preparation",
"for",
"accessing",
"the",
"emoji",
".",
"list",
"endpoint"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/emoji_gen.go#L25-L29 |
152,720 | lestrrat/go-slack | auth_gen.go | Revoke | func (s *AuthService) Revoke() *AuthRevokeCall {
var call AuthRevokeCall
call.service = s
return &call
} | go | func (s *AuthService) Revoke() *AuthRevokeCall {
var call AuthRevokeCall
call.service = s
return &call
} | [
"func",
"(",
"s",
"*",
"AuthService",
")",
"Revoke",
"(",
")",
"*",
"AuthRevokeCall",
"{",
"var",
"call",
"AuthRevokeCall",
"\n",
"call",
".",
"service",
"=",
"s",
"\n",
"return",
"&",
"call",
"\n",
"}"
] | // Revoke creates a AuthRevokeCall object in preparation for accessing the auth.revoke endpoint | [
"Revoke",
"creates",
"a",
"AuthRevokeCall",
"object",
"in",
"preparation",
"for",
"accessing",
"the",
"auth",
".",
"revoke",
"endpoint"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/auth_gen.go#L31-L35 |
152,721 | taskcluster/jsonschema2go | jsonschema.go | MergeIn | func (items *Items) MergeIn(subSchema *JsonSubSchema, skipFields StringSet) {
if items == nil || len(items.Items) == 0 {
// nothing to do
return
}
p := reflect.ValueOf(subSchema).Elem()
// loop through all struct fields of Jsonsubschema
for i := 0; i < p.NumField(); i++ {
// don't copy fields that are blacklisted, or that aren't pointers
if skipFields[p.Type().Field(i).Name] || p.Field(i).Kind() != reflect.Ptr {
continue
}
// loop through all items (e.g. the list of oneOf schemas)
for _, item := range items.Items {
c := reflect.ValueOf(item).Elem()
// only replace destination value if it is currently nil
if destination, source := c.Field(i), p.Field(i); destination.IsNil() {
// To copy the pointer, we would just:
// destination.Set(source)
// However, we want to make copies of the entries, rather than
// copy the pointers, so that future modifications of a copied
// subschema won't update the source schema. Note: this is only
// a top-level copy, not a deep copy, but is better than nothing.
// dereference the pointer to get the value
targetValue := reflect.Indirect(source)
if targetValue.IsValid() {
// create a new value to store it
newValue := reflect.New(targetValue.Type()).Elem()
// copy the value into the new value
newValue.Set(targetValue)
// create a new pointer to point to the new value
newPointer := reflect.New(targetValue.Addr().Type()).Elem()
// set that pointer to the address of the new value
newPointer.Set(newValue.Addr())
// copy the new pointer to the destination
destination.Set(newPointer)
}
}
// If we wanted to "move" instead of "copy", we could reset source
// to nil with:
// source.Set(reflect.Zero(source.Type()))
}
}
} | go | func (items *Items) MergeIn(subSchema *JsonSubSchema, skipFields StringSet) {
if items == nil || len(items.Items) == 0 {
// nothing to do
return
}
p := reflect.ValueOf(subSchema).Elem()
// loop through all struct fields of Jsonsubschema
for i := 0; i < p.NumField(); i++ {
// don't copy fields that are blacklisted, or that aren't pointers
if skipFields[p.Type().Field(i).Name] || p.Field(i).Kind() != reflect.Ptr {
continue
}
// loop through all items (e.g. the list of oneOf schemas)
for _, item := range items.Items {
c := reflect.ValueOf(item).Elem()
// only replace destination value if it is currently nil
if destination, source := c.Field(i), p.Field(i); destination.IsNil() {
// To copy the pointer, we would just:
// destination.Set(source)
// However, we want to make copies of the entries, rather than
// copy the pointers, so that future modifications of a copied
// subschema won't update the source schema. Note: this is only
// a top-level copy, not a deep copy, but is better than nothing.
// dereference the pointer to get the value
targetValue := reflect.Indirect(source)
if targetValue.IsValid() {
// create a new value to store it
newValue := reflect.New(targetValue.Type()).Elem()
// copy the value into the new value
newValue.Set(targetValue)
// create a new pointer to point to the new value
newPointer := reflect.New(targetValue.Addr().Type()).Elem()
// set that pointer to the address of the new value
newPointer.Set(newValue.Addr())
// copy the new pointer to the destination
destination.Set(newPointer)
}
}
// If we wanted to "move" instead of "copy", we could reset source
// to nil with:
// source.Set(reflect.Zero(source.Type()))
}
}
} | [
"func",
"(",
"items",
"*",
"Items",
")",
"MergeIn",
"(",
"subSchema",
"*",
"JsonSubSchema",
",",
"skipFields",
"StringSet",
")",
"{",
"if",
"items",
"==",
"nil",
"||",
"len",
"(",
"items",
".",
"Items",
")",
"==",
"0",
"{",
"// nothing to do",
"return",
... | // MergeIn copies attributes from subSchema into the subschemas in items.Items
// when they are not currently set. | [
"MergeIn",
"copies",
"attributes",
"from",
"subSchema",
"into",
"the",
"subschemas",
"in",
"items",
".",
"Items",
"when",
"they",
"are",
"not",
"currently",
"set",
"."
] | 0757acc540d0725f2d78c22e434b7c295f247d8e | https://github.com/taskcluster/jsonschema2go/blob/0757acc540d0725f2d78c22e434b7c295f247d8e/jsonschema.go#L796-L841 |
152,722 | taskcluster/jsonschema2go | jsonschema.go | inferType | func (subSchema *JsonSubSchema) inferType() *string {
// 1) If already set, nothing to do...
if subSchema.Type != nil {
return subSchema.Type
}
// 2) See if we can infer from existence of `properties` or `items`
var inferredType string
switch {
case subSchema.Properties != nil:
inferredType = "object"
case subSchema.Items != nil:
inferredType = "array"
}
if inferredType != "" {
return &inferredType
}
// 3) If all items in subSchema.AllOf/subSchema.AnyOf/subSchema.OneOf have
// same type, we can infer that is the type
for _, items := range []*Items{
subSchema.AllOf,
subSchema.AnyOf,
subSchema.OneOf,
} {
if items != nil {
for _, subSubSchema := range items.Items {
subType := subSubSchema.inferType()
if subType == nil {
return nil
}
if inferredType == "" {
inferredType = *subType
continue
}
if inferredType != *subType {
return nil
}
}
return &inferredType
}
}
// 4) If const is set, infer from that
if subSchema.Const != nil {
return jsonSchemaTypeFromValue(*subSchema.Const)
}
// 5) If an enum, see if all entries have same type
for _, enumItem := range subSchema.Enum {
enumType := jsonSchemaTypeFromValue(enumItem)
if inferredType == "" {
inferredType = *enumType
continue
}
if inferredType != *enumType {
return nil
}
}
if inferredType != "" {
return &inferredType
}
// 6) Cannot infer type
return nil
} | go | func (subSchema *JsonSubSchema) inferType() *string {
// 1) If already set, nothing to do...
if subSchema.Type != nil {
return subSchema.Type
}
// 2) See if we can infer from existence of `properties` or `items`
var inferredType string
switch {
case subSchema.Properties != nil:
inferredType = "object"
case subSchema.Items != nil:
inferredType = "array"
}
if inferredType != "" {
return &inferredType
}
// 3) If all items in subSchema.AllOf/subSchema.AnyOf/subSchema.OneOf have
// same type, we can infer that is the type
for _, items := range []*Items{
subSchema.AllOf,
subSchema.AnyOf,
subSchema.OneOf,
} {
if items != nil {
for _, subSubSchema := range items.Items {
subType := subSubSchema.inferType()
if subType == nil {
return nil
}
if inferredType == "" {
inferredType = *subType
continue
}
if inferredType != *subType {
return nil
}
}
return &inferredType
}
}
// 4) If const is set, infer from that
if subSchema.Const != nil {
return jsonSchemaTypeFromValue(*subSchema.Const)
}
// 5) If an enum, see if all entries have same type
for _, enumItem := range subSchema.Enum {
enumType := jsonSchemaTypeFromValue(enumItem)
if inferredType == "" {
inferredType = *enumType
continue
}
if inferredType != *enumType {
return nil
}
}
if inferredType != "" {
return &inferredType
}
// 6) Cannot infer type
return nil
} | [
"func",
"(",
"subSchema",
"*",
"JsonSubSchema",
")",
"inferType",
"(",
")",
"*",
"string",
"{",
"// 1) If already set, nothing to do...",
"if",
"subSchema",
".",
"Type",
"!=",
"nil",
"{",
"return",
"subSchema",
".",
"Type",
"\n",
"}",
"\n\n",
"// 2) See if we ca... | // inferType is a cheeky little function that tries to set the type, if it can
// infer it from other information, such as if all OneOf subschemas share the
// same type, for example. | [
"inferType",
"is",
"a",
"cheeky",
"little",
"function",
"that",
"tries",
"to",
"set",
"the",
"type",
"if",
"it",
"can",
"infer",
"it",
"from",
"other",
"information",
"such",
"as",
"if",
"all",
"OneOf",
"subschemas",
"share",
"the",
"same",
"type",
"for",
... | 0757acc540d0725f2d78c22e434b7c295f247d8e | https://github.com/taskcluster/jsonschema2go/blob/0757acc540d0725f2d78c22e434b7c295f247d8e/jsonschema.go#L1100-L1166 |
152,723 | mixer/fsm | fsm.go | isLegal | func (f *Machine) isLegal(a uint8, b uint8) bool {
return f.transitions.Search(serialize(a, b)) != nil
} | go | func (f *Machine) isLegal(a uint8, b uint8) bool {
return f.transitions.Search(serialize(a, b)) != nil
} | [
"func",
"(",
"f",
"*",
"Machine",
")",
"isLegal",
"(",
"a",
"uint8",
",",
"b",
"uint8",
")",
"bool",
"{",
"return",
"f",
".",
"transitions",
".",
"Search",
"(",
"serialize",
"(",
"a",
",",
"b",
")",
")",
"!=",
"nil",
"\n",
"}"
] | // isLegal returns whether or not the specified transition from state a to b
// is legal. | [
"isLegal",
"returns",
"whether",
"or",
"not",
"the",
"specified",
"transition",
"from",
"state",
"a",
"to",
"b",
"is",
"legal",
"."
] | 40bf467cb298150fc847ee18ddda4c4f1fa2df35 | https://github.com/mixer/fsm/blob/40bf467cb298150fc847ee18ddda4c4f1fa2df35/fsm.go#L19-L21 |
152,724 | mixer/fsm | fsm.go | Allows | func (f *Machine) Allows(b uint8) bool {
return f.isLegal(f.state, b)
} | go | func (f *Machine) Allows(b uint8) bool {
return f.isLegal(f.state, b)
} | [
"func",
"(",
"f",
"*",
"Machine",
")",
"Allows",
"(",
"b",
"uint8",
")",
"bool",
"{",
"return",
"f",
".",
"isLegal",
"(",
"f",
".",
"state",
",",
"b",
")",
"\n",
"}"
] | // Allows returns whether or not this machine can transition to the state b. | [
"Allows",
"returns",
"whether",
"or",
"not",
"this",
"machine",
"can",
"transition",
"to",
"the",
"state",
"b",
"."
] | 40bf467cb298150fc847ee18ddda4c4f1fa2df35 | https://github.com/mixer/fsm/blob/40bf467cb298150fc847ee18ddda4c4f1fa2df35/fsm.go#L24-L26 |
152,725 | mixer/fsm | fsm.go | Goto | func (f *Machine) Goto(state uint8) error {
t := f.transitions.Search(serialize(f.state, state))
if t == nil {
return fmt.Errorf("can't transition from state %d to %d", f.state, state)
}
f.state = state
if t.fn != nil {
t.fn(f)
}
return nil
} | go | func (f *Machine) Goto(state uint8) error {
t := f.transitions.Search(serialize(f.state, state))
if t == nil {
return fmt.Errorf("can't transition from state %d to %d", f.state, state)
}
f.state = state
if t.fn != nil {
t.fn(f)
}
return nil
} | [
"func",
"(",
"f",
"*",
"Machine",
")",
"Goto",
"(",
"state",
"uint8",
")",
"error",
"{",
"t",
":=",
"f",
".",
"transitions",
".",
"Search",
"(",
"serialize",
"(",
"f",
".",
"state",
",",
"state",
")",
")",
"\n",
"if",
"t",
"==",
"nil",
"{",
"re... | // Goto moves the machine to the specified state. An error is returned if the
// transition is not valid. | [
"Goto",
"moves",
"the",
"machine",
"to",
"the",
"specified",
"state",
".",
"An",
"error",
"is",
"returned",
"if",
"the",
"transition",
"is",
"not",
"valid",
"."
] | 40bf467cb298150fc847ee18ddda4c4f1fa2df35 | https://github.com/mixer/fsm/blob/40bf467cb298150fc847ee18ddda4c4f1fa2df35/fsm.go#L41-L53 |
152,726 | michiwend/gomusicbrainz | place.go | LookupPlace | func (c *WS2Client) LookupPlace(id MBID, inc ...string) (*Place, error) {
a := &Place{ID: id}
err := c.Lookup(a, inc...)
return a, err
} | go | func (c *WS2Client) LookupPlace(id MBID, inc ...string) (*Place, error) {
a := &Place{ID: id}
err := c.Lookup(a, inc...)
return a, err
} | [
"func",
"(",
"c",
"*",
"WS2Client",
")",
"LookupPlace",
"(",
"id",
"MBID",
",",
"inc",
"...",
"string",
")",
"(",
"*",
"Place",
",",
"error",
")",
"{",
"a",
":=",
"&",
"Place",
"{",
"ID",
":",
"id",
"}",
"\n",
"err",
":=",
"c",
".",
"Lookup",
... | // LookupPlace performs a place lookup request for the given MBID. | [
"LookupPlace",
"performs",
"a",
"place",
"lookup",
"request",
"for",
"the",
"given",
"MBID",
"."
] | 6c07e13dd396ba10bd9f8904be5018df94472839 | https://github.com/michiwend/gomusicbrainz/blob/6c07e13dd396ba10bd9f8904be5018df94472839/place.go#L61-L66 |
152,727 | michiwend/gomusicbrainz | place.go | ResultsWithScore | func (r *PlaceSearchResponse) ResultsWithScore(score int) []*Place {
var res []*Place
for _, v := range r.Places {
if r.Scores[v] >= score {
res = append(res, v)
}
}
return res
} | go | func (r *PlaceSearchResponse) ResultsWithScore(score int) []*Place {
var res []*Place
for _, v := range r.Places {
if r.Scores[v] >= score {
res = append(res, v)
}
}
return res
} | [
"func",
"(",
"r",
"*",
"PlaceSearchResponse",
")",
"ResultsWithScore",
"(",
"score",
"int",
")",
"[",
"]",
"*",
"Place",
"{",
"var",
"res",
"[",
"]",
"*",
"Place",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"r",
".",
"Places",
"{",
"if",
"r",
"."... | // ResultsWithScore returns a slice of Places with a min score. | [
"ResultsWithScore",
"returns",
"a",
"slice",
"of",
"Places",
"with",
"a",
"min",
"score",
"."
] | 6c07e13dd396ba10bd9f8904be5018df94472839 | https://github.com/michiwend/gomusicbrainz/blob/6c07e13dd396ba10bd9f8904be5018df94472839/place.go#L113-L121 |
152,728 | michiwend/gomusicbrainz | structs.go | UnmarshalXML | func (r *TargetRelationsMap) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
var targetType string
for _, v := range start.Attr {
if v.Name.Local == "target-type" {
targetType = v.Value
break
}
}
if *r == nil {
(*r) = make(map[string][]Relation)
}
switch targetType {
case "artist":
var res struct {
XMLName xml.Name `xml:"relation-list"`
Relations []*ArtistRelation `xml:"relation"`
}
if err := d.DecodeElement(&res, &start); err != nil {
return err
}
(*r)[targetType] = make([]Relation, len(res.Relations))
for i, v := range res.Relations {
(*r)[targetType][i] = v
}
case "release":
var res struct {
XMLName xml.Name `xml:"relation-list"`
Relations []*ReleaseRelation `xml:"relation"`
}
if err := d.DecodeElement(&res, &start); err != nil {
return err
}
(*r)[targetType] = make([]Relation, len(res.Relations))
for i, v := range res.Relations {
(*r)[targetType][i] = v
}
case "url":
var res struct {
XMLName xml.Name `xml:"relation-list"`
Relations []*URLRelation `xml:"relation"`
}
if err := d.DecodeElement(&res, &start); err != nil {
return err
}
(*r)[targetType] = make([]Relation, len(res.Relations))
for i, v := range res.Relations {
(*r)[targetType][i] = v
}
// FIXME implement missing relations
default:
return d.Skip()
}
return nil
} | go | func (r *TargetRelationsMap) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
var targetType string
for _, v := range start.Attr {
if v.Name.Local == "target-type" {
targetType = v.Value
break
}
}
if *r == nil {
(*r) = make(map[string][]Relation)
}
switch targetType {
case "artist":
var res struct {
XMLName xml.Name `xml:"relation-list"`
Relations []*ArtistRelation `xml:"relation"`
}
if err := d.DecodeElement(&res, &start); err != nil {
return err
}
(*r)[targetType] = make([]Relation, len(res.Relations))
for i, v := range res.Relations {
(*r)[targetType][i] = v
}
case "release":
var res struct {
XMLName xml.Name `xml:"relation-list"`
Relations []*ReleaseRelation `xml:"relation"`
}
if err := d.DecodeElement(&res, &start); err != nil {
return err
}
(*r)[targetType] = make([]Relation, len(res.Relations))
for i, v := range res.Relations {
(*r)[targetType][i] = v
}
case "url":
var res struct {
XMLName xml.Name `xml:"relation-list"`
Relations []*URLRelation `xml:"relation"`
}
if err := d.DecodeElement(&res, &start); err != nil {
return err
}
(*r)[targetType] = make([]Relation, len(res.Relations))
for i, v := range res.Relations {
(*r)[targetType][i] = v
}
// FIXME implement missing relations
default:
return d.Skip()
}
return nil
} | [
"func",
"(",
"r",
"*",
"TargetRelationsMap",
")",
"UnmarshalXML",
"(",
"d",
"*",
"xml",
".",
"Decoder",
",",
"start",
"xml",
".",
"StartElement",
")",
"error",
"{",
"var",
"targetType",
"string",
"\n\n",
"for",
"_",
",",
"v",
":=",
"range",
"start",
".... | // UnmarshalXML is needed to implement XMLUnmarshaler for custom, value-based
// unmarshaling of relation-list elements. | [
"UnmarshalXML",
"is",
"needed",
"to",
"implement",
"XMLUnmarshaler",
"for",
"custom",
"value",
"-",
"based",
"unmarshaling",
"of",
"relation",
"-",
"list",
"elements",
"."
] | 6c07e13dd396ba10bd9f8904be5018df94472839 | https://github.com/michiwend/gomusicbrainz/blob/6c07e13dd396ba10bd9f8904be5018df94472839/structs.go#L234-L304 |
152,729 | michiwend/gomusicbrainz | release.go | LookupRelease | func (c *WS2Client) LookupRelease(id MBID, inc ...string) (*Release, error) {
a := &Release{ID: id}
err := c.Lookup(a, inc...)
return a, err
} | go | func (c *WS2Client) LookupRelease(id MBID, inc ...string) (*Release, error) {
a := &Release{ID: id}
err := c.Lookup(a, inc...)
return a, err
} | [
"func",
"(",
"c",
"*",
"WS2Client",
")",
"LookupRelease",
"(",
"id",
"MBID",
",",
"inc",
"...",
"string",
")",
"(",
"*",
"Release",
",",
"error",
")",
"{",
"a",
":=",
"&",
"Release",
"{",
"ID",
":",
"id",
"}",
"\n",
"err",
":=",
"c",
".",
"Look... | // LookupRelease performs a release lookup request for the given MBID. | [
"LookupRelease",
"performs",
"a",
"release",
"lookup",
"request",
"for",
"the",
"given",
"MBID",
"."
] | 6c07e13dd396ba10bd9f8904be5018df94472839 | https://github.com/michiwend/gomusicbrainz/blob/6c07e13dd396ba10bd9f8904be5018df94472839/release.go#L69-L74 |
152,730 | michiwend/gomusicbrainz | release.go | ResultsWithScore | func (r *ReleaseSearchResponse) ResultsWithScore(score int) []*Release {
var res []*Release
for _, v := range r.Releases {
if r.Scores[v] >= score {
res = append(res, v)
}
}
return res
} | go | func (r *ReleaseSearchResponse) ResultsWithScore(score int) []*Release {
var res []*Release
for _, v := range r.Releases {
if r.Scores[v] >= score {
res = append(res, v)
}
}
return res
} | [
"func",
"(",
"r",
"*",
"ReleaseSearchResponse",
")",
"ResultsWithScore",
"(",
"score",
"int",
")",
"[",
"]",
"*",
"Release",
"{",
"var",
"res",
"[",
"]",
"*",
"Release",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"r",
".",
"Releases",
"{",
"if",
"r... | // ResultsWithScore returns a slice of Releases with a min score. | [
"ResultsWithScore",
"returns",
"a",
"slice",
"of",
"Releases",
"with",
"a",
"min",
"score",
"."
] | 6c07e13dd396ba10bd9f8904be5018df94472839 | https://github.com/michiwend/gomusicbrainz/blob/6c07e13dd396ba10bd9f8904be5018df94472839/release.go#L140-L148 |
152,731 | pivotal-cf/graphite-nozzle | metrics/metric.go | prefixName | func prefixName(prefix, name string) string {
if prefix != "" {
name = prefix + "." + name
}
return name
} | go | func prefixName(prefix, name string) string {
if prefix != "" {
name = prefix + "." + name
}
return name
} | [
"func",
"prefixName",
"(",
"prefix",
",",
"name",
"string",
")",
"string",
"{",
"if",
"prefix",
"!=",
"\"",
"\"",
"{",
"name",
"=",
"prefix",
"+",
"\"",
"\"",
"+",
"name",
"\n",
"}",
"\n",
"return",
"name",
"\n",
"}"
] | // prefixName applies a prefix to a metric name if the prefix is not empty. | [
"prefixName",
"applies",
"a",
"prefix",
"to",
"a",
"metric",
"name",
"if",
"the",
"prefix",
"is",
"not",
"empty",
"."
] | 170aafd797d9fbfaa707295b39465d1b744a5050 | https://github.com/pivotal-cf/graphite-nozzle/blob/170aafd797d9fbfaa707295b39465d1b744a5050/metrics/metric.go#L78-L83 |
152,732 | mixer/fsm | transition.go | From | func (t *Transition) From(from uint8) *Transition {
t.from = from
t.fromSet = true
t.recalculate()
return t
} | go | func (t *Transition) From(from uint8) *Transition {
t.from = from
t.fromSet = true
t.recalculate()
return t
} | [
"func",
"(",
"t",
"*",
"Transition",
")",
"From",
"(",
"from",
"uint8",
")",
"*",
"Transition",
"{",
"t",
".",
"from",
"=",
"from",
"\n",
"t",
".",
"fromSet",
"=",
"true",
"\n",
"t",
".",
"recalculate",
"(",
")",
"\n",
"return",
"t",
"\n",
"}"
] | // From sets the source state of the transition. | [
"From",
"sets",
"the",
"source",
"state",
"of",
"the",
"transition",
"."
] | 40bf467cb298150fc847ee18ddda4c4f1fa2df35 | https://github.com/mixer/fsm/blob/40bf467cb298150fc847ee18ddda4c4f1fa2df35/transition.go#L24-L29 |
152,733 | mixer/fsm | transition.go | To | func (t *Transition) To(to uint8) *Transition {
t.to = to
t.toSet = true
t.recalculate()
return t
} | go | func (t *Transition) To(to uint8) *Transition {
t.to = to
t.toSet = true
t.recalculate()
return t
} | [
"func",
"(",
"t",
"*",
"Transition",
")",
"To",
"(",
"to",
"uint8",
")",
"*",
"Transition",
"{",
"t",
".",
"to",
"=",
"to",
"\n",
"t",
".",
"toSet",
"=",
"true",
"\n",
"t",
".",
"recalculate",
"(",
")",
"\n",
"return",
"t",
"\n",
"}"
] | // To sets the destination state of the transition. | [
"To",
"sets",
"the",
"destination",
"state",
"of",
"the",
"transition",
"."
] | 40bf467cb298150fc847ee18ddda4c4f1fa2df35 | https://github.com/mixer/fsm/blob/40bf467cb298150fc847ee18ddda4c4f1fa2df35/transition.go#L32-L37 |
152,734 | mixer/fsm | transition.go | recalculate | func (t *Transition) recalculate() {
if !t.toSet || !t.fromSet {
return
}
t.hash = serialize(t.from, t.to)
t.blueprint.Add(t)
} | go | func (t *Transition) recalculate() {
if !t.toSet || !t.fromSet {
return
}
t.hash = serialize(t.from, t.to)
t.blueprint.Add(t)
} | [
"func",
"(",
"t",
"*",
"Transition",
")",
"recalculate",
"(",
")",
"{",
"if",
"!",
"t",
".",
"toSet",
"||",
"!",
"t",
".",
"fromSet",
"{",
"return",
"\n",
"}",
"\n\n",
"t",
".",
"hash",
"=",
"serialize",
"(",
"t",
".",
"from",
",",
"t",
".",
... | // recalculate calculates the hash for this transition if both "from" and "to"
// have been set. If both "from" and "to" are set then this transition will
// also be added to the blueprint. | [
"recalculate",
"calculates",
"the",
"hash",
"for",
"this",
"transition",
"if",
"both",
"from",
"and",
"to",
"have",
"been",
"set",
".",
"If",
"both",
"from",
"and",
"to",
"are",
"set",
"then",
"this",
"transition",
"will",
"also",
"be",
"added",
"to",
"t... | 40bf467cb298150fc847ee18ddda4c4f1fa2df35 | https://github.com/mixer/fsm/blob/40bf467cb298150fc847ee18ddda4c4f1fa2df35/transition.go#L42-L49 |
152,735 | mixer/fsm | transition.go | Then | func (t *Transition) Then(fn Handler) *Transition {
t.fn = fn
return t
} | go | func (t *Transition) Then(fn Handler) *Transition {
t.fn = fn
return t
} | [
"func",
"(",
"t",
"*",
"Transition",
")",
"Then",
"(",
"fn",
"Handler",
")",
"*",
"Transition",
"{",
"t",
".",
"fn",
"=",
"fn",
"\n",
"return",
"t",
"\n",
"}"
] | // Then sets the callback function for when the transition has occurred. | [
"Then",
"sets",
"the",
"callback",
"function",
"for",
"when",
"the",
"transition",
"has",
"occurred",
"."
] | 40bf467cb298150fc847ee18ddda4c4f1fa2df35 | https://github.com/mixer/fsm/blob/40bf467cb298150fc847ee18ddda4c4f1fa2df35/transition.go#L52-L55 |
152,736 | mixer/fsm | transition.go | Swap | func (t list) Swap(a, b int) {
t[a], t[b] = t[b], t[a]
} | go | func (t list) Swap(a, b int) {
t[a], t[b] = t[b], t[a]
} | [
"func",
"(",
"t",
"list",
")",
"Swap",
"(",
"a",
",",
"b",
"int",
")",
"{",
"t",
"[",
"a",
"]",
",",
"t",
"[",
"b",
"]",
"=",
"t",
"[",
"b",
"]",
",",
"t",
"[",
"a",
"]",
"\n",
"}"
] | // Swap swaps the two elements with indexes a and b. | [
"Swap",
"swaps",
"the",
"two",
"elements",
"with",
"indexes",
"a",
"and",
"b",
"."
] | 40bf467cb298150fc847ee18ddda4c4f1fa2df35 | https://github.com/mixer/fsm/blob/40bf467cb298150fc847ee18ddda4c4f1fa2df35/transition.go#L73-L75 |
152,737 | mixer/fsm | transition.go | Less | func (t list) Less(a, b int) bool {
return t[a].hash < t[b].hash
} | go | func (t list) Less(a, b int) bool {
return t[a].hash < t[b].hash
} | [
"func",
"(",
"t",
"list",
")",
"Less",
"(",
"a",
",",
"b",
"int",
")",
"bool",
"{",
"return",
"t",
"[",
"a",
"]",
".",
"hash",
"<",
"t",
"[",
"b",
"]",
".",
"hash",
"\n",
"}"
] | // Less returns whether the element at index a should appear before b. | [
"Less",
"returns",
"whether",
"the",
"element",
"at",
"index",
"a",
"should",
"appear",
"before",
"b",
"."
] | 40bf467cb298150fc847ee18ddda4c4f1fa2df35 | https://github.com/mixer/fsm/blob/40bf467cb298150fc847ee18ddda4c4f1fa2df35/transition.go#L78-L80 |
152,738 | mixer/fsm | transition.go | Search | func (t list) Search(x uint16) *Transition {
low, high := 0, len(t)-1
for low <= high {
i := (low + high) / 2
if t[i].hash > x {
high = i - 1
} else if t[i].hash < x {
low = i + 1
} else {
return t[i]
}
}
return nil
} | go | func (t list) Search(x uint16) *Transition {
low, high := 0, len(t)-1
for low <= high {
i := (low + high) / 2
if t[i].hash > x {
high = i - 1
} else if t[i].hash < x {
low = i + 1
} else {
return t[i]
}
}
return nil
} | [
"func",
"(",
"t",
"list",
")",
"Search",
"(",
"x",
"uint16",
")",
"*",
"Transition",
"{",
"low",
",",
"high",
":=",
"0",
",",
"len",
"(",
"t",
")",
"-",
"1",
"\n",
"for",
"low",
"<=",
"high",
"{",
"i",
":=",
"(",
"low",
"+",
"high",
")",
"/... | // Search searches for the specified hash in the list and returns it if it is
// present. | [
"Search",
"searches",
"for",
"the",
"specified",
"hash",
"in",
"the",
"list",
"and",
"returns",
"it",
"if",
"it",
"is",
"present",
"."
] | 40bf467cb298150fc847ee18ddda4c4f1fa2df35 | https://github.com/mixer/fsm/blob/40bf467cb298150fc847ee18ddda4c4f1fa2df35/transition.go#L84-L98 |
152,739 | mixer/fsm | transition.go | InsertPos | func (t list) InsertPos(v *Transition) int {
return sort.Search(len(t), func(i int) bool {
return t[i].hash >= v.hash
})
} | go | func (t list) InsertPos(v *Transition) int {
return sort.Search(len(t), func(i int) bool {
return t[i].hash >= v.hash
})
} | [
"func",
"(",
"t",
"list",
")",
"InsertPos",
"(",
"v",
"*",
"Transition",
")",
"int",
"{",
"return",
"sort",
".",
"Search",
"(",
"len",
"(",
"t",
")",
",",
"func",
"(",
"i",
"int",
")",
"bool",
"{",
"return",
"t",
"[",
"i",
"]",
".",
"hash",
"... | // InsertPos returns the index at which the specified transition should be
// inserted into the slice to retain it's order. | [
"InsertPos",
"returns",
"the",
"index",
"at",
"which",
"the",
"specified",
"transition",
"should",
"be",
"inserted",
"into",
"the",
"slice",
"to",
"retain",
"it",
"s",
"order",
"."
] | 40bf467cb298150fc847ee18ddda4c4f1fa2df35 | https://github.com/mixer/fsm/blob/40bf467cb298150fc847ee18ddda4c4f1fa2df35/transition.go#L102-L106 |
152,740 | michiwend/gomusicbrainz | artist.go | LookupArtist | func (c *WS2Client) LookupArtist(id MBID, inc ...string) (*Artist, error) {
a := &Artist{ID: id}
err := c.Lookup(a, inc...)
return a, err
} | go | func (c *WS2Client) LookupArtist(id MBID, inc ...string) (*Artist, error) {
a := &Artist{ID: id}
err := c.Lookup(a, inc...)
return a, err
} | [
"func",
"(",
"c",
"*",
"WS2Client",
")",
"LookupArtist",
"(",
"id",
"MBID",
",",
"inc",
"...",
"string",
")",
"(",
"*",
"Artist",
",",
"error",
")",
"{",
"a",
":=",
"&",
"Artist",
"{",
"ID",
":",
"id",
"}",
"\n",
"err",
":=",
"c",
".",
"Lookup"... | // LookupArtist performs an artist lookup request for the given MBID. | [
"LookupArtist",
"performs",
"an",
"artist",
"lookup",
"request",
"for",
"the",
"given",
"MBID",
"."
] | 6c07e13dd396ba10bd9f8904be5018df94472839 | https://github.com/michiwend/gomusicbrainz/blob/6c07e13dd396ba10bd9f8904be5018df94472839/artist.go#L66-L71 |
152,741 | michiwend/gomusicbrainz | artist.go | ResultsWithScore | func (r *ArtistSearchResponse) ResultsWithScore(score int) []*Artist {
var res []*Artist
for _, v := range r.Artists {
if r.Scores[v] >= score {
res = append(res, v)
}
}
return res
} | go | func (r *ArtistSearchResponse) ResultsWithScore(score int) []*Artist {
var res []*Artist
for _, v := range r.Artists {
if r.Scores[v] >= score {
res = append(res, v)
}
}
return res
} | [
"func",
"(",
"r",
"*",
"ArtistSearchResponse",
")",
"ResultsWithScore",
"(",
"score",
"int",
")",
"[",
"]",
"*",
"Artist",
"{",
"var",
"res",
"[",
"]",
"*",
"Artist",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"r",
".",
"Artists",
"{",
"if",
"r",
... | // ResultsWithScore returns a slice of Artists with a min score. | [
"ResultsWithScore",
"returns",
"a",
"slice",
"of",
"Artists",
"with",
"a",
"min",
"score",
"."
] | 6c07e13dd396ba10bd9f8904be5018df94472839 | https://github.com/michiwend/gomusicbrainz/blob/6c07e13dd396ba10bd9f8904be5018df94472839/artist.go#L123-L131 |
152,742 | lestrrat/go-slack | server/server.go | Handle | func (s *Server) Handle(method string, h http.Handler) {
s.muHandlers.Lock()
defer s.muHandlers.Unlock()
s.handlers[method] = h
} | go | func (s *Server) Handle(method string, h http.Handler) {
s.muHandlers.Lock()
defer s.muHandlers.Unlock()
s.handlers[method] = h
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"Handle",
"(",
"method",
"string",
",",
"h",
"http",
".",
"Handler",
")",
"{",
"s",
".",
"muHandlers",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"muHandlers",
".",
"Unlock",
"(",
")",
"\n",
"s",
".",
... | // Handle sets the http.Handler for the given slack method. | [
"Handle",
"sets",
"the",
"http",
".",
"Handler",
"for",
"the",
"given",
"slack",
"method",
"."
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/server/server.go#L99-L103 |
152,743 | michiwend/gomusicbrainz | release_group.go | LookupReleaseGroup | func (c *WS2Client) LookupReleaseGroup(id MBID, inc ...string) (*ReleaseGroup, error) {
a := &ReleaseGroup{ID: id}
err := c.Lookup(a, inc...)
return a, err
} | go | func (c *WS2Client) LookupReleaseGroup(id MBID, inc ...string) (*ReleaseGroup, error) {
a := &ReleaseGroup{ID: id}
err := c.Lookup(a, inc...)
return a, err
} | [
"func",
"(",
"c",
"*",
"WS2Client",
")",
"LookupReleaseGroup",
"(",
"id",
"MBID",
",",
"inc",
"...",
"string",
")",
"(",
"*",
"ReleaseGroup",
",",
"error",
")",
"{",
"a",
":=",
"&",
"ReleaseGroup",
"{",
"ID",
":",
"id",
"}",
"\n",
"err",
":=",
"c",... | // LookupReleaseGroup performs a release-group lookup request for the given MBID. | [
"LookupReleaseGroup",
"performs",
"a",
"release",
"-",
"group",
"lookup",
"request",
"for",
"the",
"given",
"MBID",
"."
] | 6c07e13dd396ba10bd9f8904be5018df94472839 | https://github.com/michiwend/gomusicbrainz/blob/6c07e13dd396ba10bd9f8904be5018df94472839/release_group.go#L62-L67 |
152,744 | michiwend/gomusicbrainz | release_group.go | ResultsWithScore | func (r *ReleaseGroupSearchResponse) ResultsWithScore(score int) []*ReleaseGroup {
var res []*ReleaseGroup
for _, v := range r.ReleaseGroups {
if r.Scores[v] >= score {
res = append(res, v)
}
}
return res
} | go | func (r *ReleaseGroupSearchResponse) ResultsWithScore(score int) []*ReleaseGroup {
var res []*ReleaseGroup
for _, v := range r.ReleaseGroups {
if r.Scores[v] >= score {
res = append(res, v)
}
}
return res
} | [
"func",
"(",
"r",
"*",
"ReleaseGroupSearchResponse",
")",
"ResultsWithScore",
"(",
"score",
"int",
")",
"[",
"]",
"*",
"ReleaseGroup",
"{",
"var",
"res",
"[",
"]",
"*",
"ReleaseGroup",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"r",
".",
"ReleaseGroups",... | // ResultsWithScore returns a slice of ReleaseGroups with a min score. | [
"ResultsWithScore",
"returns",
"a",
"slice",
"of",
"ReleaseGroups",
"with",
"a",
"min",
"score",
"."
] | 6c07e13dd396ba10bd9f8904be5018df94472839 | https://github.com/michiwend/gomusicbrainz/blob/6c07e13dd396ba10bd9f8904be5018df94472839/release_group.go#L119-L127 |
152,745 | lestrrat/go-slack | reactions_gen.go | Add | func (s *ReactionsService) Add(name string) *ReactionsAddCall {
var call ReactionsAddCall
call.service = s
call.name = name
return &call
} | go | func (s *ReactionsService) Add(name string) *ReactionsAddCall {
var call ReactionsAddCall
call.service = s
call.name = name
return &call
} | [
"func",
"(",
"s",
"*",
"ReactionsService",
")",
"Add",
"(",
"name",
"string",
")",
"*",
"ReactionsAddCall",
"{",
"var",
"call",
"ReactionsAddCall",
"\n",
"call",
".",
"service",
"=",
"s",
"\n",
"call",
".",
"name",
"=",
"name",
"\n",
"return",
"&",
"ca... | // Add creates a ReactionsAddCall object in preparation for accessing the reactions.add endpoint | [
"Add",
"creates",
"a",
"ReactionsAddCall",
"object",
"in",
"preparation",
"for",
"accessing",
"the",
"reactions",
".",
"add",
"endpoint"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/reactions_gen.go#L59-L64 |
152,746 | lestrrat/go-slack | reactions_gen.go | Get | func (s *ReactionsService) Get() *ReactionsGetCall {
var call ReactionsGetCall
call.service = s
return &call
} | go | func (s *ReactionsService) Get() *ReactionsGetCall {
var call ReactionsGetCall
call.service = s
return &call
} | [
"func",
"(",
"s",
"*",
"ReactionsService",
")",
"Get",
"(",
")",
"*",
"ReactionsGetCall",
"{",
"var",
"call",
"ReactionsGetCall",
"\n",
"call",
".",
"service",
"=",
"s",
"\n",
"return",
"&",
"call",
"\n",
"}"
] | // Get creates a ReactionsGetCall object in preparation for accessing the reactions.get endpoint | [
"Get",
"creates",
"a",
"ReactionsGetCall",
"object",
"in",
"preparation",
"for",
"accessing",
"the",
"reactions",
".",
"get",
"endpoint"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/reactions_gen.go#L169-L173 |
152,747 | lestrrat/go-slack | reactions_gen.go | Values | func (c *ReactionsGetCall) Values() (url.Values, error) {
if err := c.ValidateArgs(); err != nil {
return nil, errors.Wrap(err, `failed validation`)
}
v := url.Values{}
v.Set(`token`, c.service.token)
if len(c.channel) > 0 {
v.Set("channel", c.channel)
}
if len(c.file) > 0 {
v.Set("file", c.file)
}
if len(c.fileComment) > 0 {
v.Set("fileComment", c.fileComment)
}
if c.full {
v.Set("full", "true")
}
if len(c.timestamp) > 0 {
v.Set("timestamp", c.timestamp)
}
return v, nil
} | go | func (c *ReactionsGetCall) Values() (url.Values, error) {
if err := c.ValidateArgs(); err != nil {
return nil, errors.Wrap(err, `failed validation`)
}
v := url.Values{}
v.Set(`token`, c.service.token)
if len(c.channel) > 0 {
v.Set("channel", c.channel)
}
if len(c.file) > 0 {
v.Set("file", c.file)
}
if len(c.fileComment) > 0 {
v.Set("fileComment", c.fileComment)
}
if c.full {
v.Set("full", "true")
}
if len(c.timestamp) > 0 {
v.Set("timestamp", c.timestamp)
}
return v, nil
} | [
"func",
"(",
"c",
"*",
"ReactionsGetCall",
")",
"Values",
"(",
")",
"(",
"url",
".",
"Values",
",",
"error",
")",
"{",
"if",
"err",
":=",
"c",
".",
"ValidateArgs",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap... | // Values returns the ReactionsGetCall object as url.Values | [
"Values",
"returns",
"the",
"ReactionsGetCall",
"object",
"as",
"url",
".",
"Values"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/reactions_gen.go#L211-L238 |
152,748 | lestrrat/go-slack | reactions_gen.go | List | func (s *ReactionsService) List() *ReactionsListCall {
var call ReactionsListCall
call.service = s
return &call
} | go | func (s *ReactionsService) List() *ReactionsListCall {
var call ReactionsListCall
call.service = s
return &call
} | [
"func",
"(",
"s",
"*",
"ReactionsService",
")",
"List",
"(",
")",
"*",
"ReactionsListCall",
"{",
"var",
"call",
"ReactionsListCall",
"\n",
"call",
".",
"service",
"=",
"s",
"\n",
"return",
"&",
"call",
"\n",
"}"
] | // List creates a ReactionsListCall object in preparation for accessing the reactions.list endpoint | [
"List",
"creates",
"a",
"ReactionsListCall",
"object",
"in",
"preparation",
"for",
"accessing",
"the",
"reactions",
".",
"list",
"endpoint"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/reactions_gen.go#L288-L292 |
152,749 | lestrrat/go-slack | reactions_gen.go | Page | func (c *ReactionsListCall) Page(page int) *ReactionsListCall {
c.page = page
return c
} | go | func (c *ReactionsListCall) Page(page int) *ReactionsListCall {
c.page = page
return c
} | [
"func",
"(",
"c",
"*",
"ReactionsListCall",
")",
"Page",
"(",
"page",
"int",
")",
"*",
"ReactionsListCall",
"{",
"c",
".",
"page",
"=",
"page",
"\n",
"return",
"c",
"\n",
"}"
] | // Page sets the value for optional page parameter | [
"Page",
"sets",
"the",
"value",
"for",
"optional",
"page",
"parameter"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/reactions_gen.go#L307-L310 |
152,750 | lestrrat/go-slack | reactions_gen.go | Values | func (c *ReactionsListCall) Values() (url.Values, error) {
if err := c.ValidateArgs(); err != nil {
return nil, errors.Wrap(err, `failed validation`)
}
v := url.Values{}
v.Set(`token`, c.service.token)
if c.count > 0 {
v.Set("count", strconv.Itoa(c.count))
}
if c.full {
v.Set("full", "true")
}
if c.page > 0 {
v.Set("page", strconv.Itoa(c.page))
}
if len(c.user) > 0 {
v.Set("user", c.user)
}
return v, nil
} | go | func (c *ReactionsListCall) Values() (url.Values, error) {
if err := c.ValidateArgs(); err != nil {
return nil, errors.Wrap(err, `failed validation`)
}
v := url.Values{}
v.Set(`token`, c.service.token)
if c.count > 0 {
v.Set("count", strconv.Itoa(c.count))
}
if c.full {
v.Set("full", "true")
}
if c.page > 0 {
v.Set("page", strconv.Itoa(c.page))
}
if len(c.user) > 0 {
v.Set("user", c.user)
}
return v, nil
} | [
"func",
"(",
"c",
"*",
"ReactionsListCall",
")",
"Values",
"(",
")",
"(",
"url",
".",
"Values",
",",
"error",
")",
"{",
"if",
"err",
":=",
"c",
".",
"ValidateArgs",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wra... | // Values returns the ReactionsListCall object as url.Values | [
"Values",
"returns",
"the",
"ReactionsListCall",
"object",
"as",
"url",
".",
"Values"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/reactions_gen.go#L324-L347 |
152,751 | lestrrat/go-slack | reactions_gen.go | Remove | func (s *ReactionsService) Remove(name string) *ReactionsRemoveCall {
var call ReactionsRemoveCall
call.service = s
call.name = name
return &call
} | go | func (s *ReactionsService) Remove(name string) *ReactionsRemoveCall {
var call ReactionsRemoveCall
call.service = s
call.name = name
return &call
} | [
"func",
"(",
"s",
"*",
"ReactionsService",
")",
"Remove",
"(",
"name",
"string",
")",
"*",
"ReactionsRemoveCall",
"{",
"var",
"call",
"ReactionsRemoveCall",
"\n",
"call",
".",
"service",
"=",
"s",
"\n",
"call",
".",
"name",
"=",
"name",
"\n",
"return",
"... | // Remove creates a ReactionsRemoveCall object in preparation for accessing the reactions.remove endpoint | [
"Remove",
"creates",
"a",
"ReactionsRemoveCall",
"object",
"in",
"preparation",
"for",
"accessing",
"the",
"reactions",
".",
"remove",
"endpoint"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/reactions_gen.go#L402-L407 |
152,752 | lestrrat/go-slack | chat_gen.go | Delete | func (s *ChatService) Delete(channel string) *ChatDeleteCall {
var call ChatDeleteCall
call.service = s
call.channel = channel
return &call
} | go | func (s *ChatService) Delete(channel string) *ChatDeleteCall {
var call ChatDeleteCall
call.service = s
call.channel = channel
return &call
} | [
"func",
"(",
"s",
"*",
"ChatService",
")",
"Delete",
"(",
"channel",
"string",
")",
"*",
"ChatDeleteCall",
"{",
"var",
"call",
"ChatDeleteCall",
"\n",
"call",
".",
"service",
"=",
"s",
"\n",
"call",
".",
"channel",
"=",
"channel",
"\n",
"return",
"&",
... | // Delete creates a ChatDeleteCall object in preparation for accessing the chat.delete endpoint | [
"Delete",
"creates",
"a",
"ChatDeleteCall",
"object",
"in",
"preparation",
"for",
"accessing",
"the",
"chat",
".",
"delete",
"endpoint"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/chat_gen.go#L74-L79 |
152,753 | lestrrat/go-slack | chat_gen.go | MeMessage | func (s *ChatService) MeMessage(channel string) *ChatMeMessageCall {
var call ChatMeMessageCall
call.service = s
call.channel = channel
return &call
} | go | func (s *ChatService) MeMessage(channel string) *ChatMeMessageCall {
var call ChatMeMessageCall
call.service = s
call.channel = channel
return &call
} | [
"func",
"(",
"s",
"*",
"ChatService",
")",
"MeMessage",
"(",
"channel",
"string",
")",
"*",
"ChatMeMessageCall",
"{",
"var",
"call",
"ChatMeMessageCall",
"\n",
"call",
".",
"service",
"=",
"s",
"\n",
"call",
".",
"channel",
"=",
"channel",
"\n",
"return",
... | // MeMessage creates a ChatMeMessageCall object in preparation for accessing the chat.meMessage endpoint | [
"MeMessage",
"creates",
"a",
"ChatMeMessageCall",
"object",
"in",
"preparation",
"for",
"accessing",
"the",
"chat",
".",
"meMessage",
"endpoint"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/chat_gen.go#L163-L168 |
152,754 | lestrrat/go-slack | chat_gen.go | Values | func (c *ChatMeMessageCall) Values() (url.Values, error) {
if err := c.ValidateArgs(); err != nil {
return nil, errors.Wrap(err, `failed validation`)
}
v := url.Values{}
v.Set(`token`, c.service.token)
v.Set("channel", c.channel)
if len(c.text) > 0 {
v.Set("text", c.text)
}
return v, nil
} | go | func (c *ChatMeMessageCall) Values() (url.Values, error) {
if err := c.ValidateArgs(); err != nil {
return nil, errors.Wrap(err, `failed validation`)
}
v := url.Values{}
v.Set(`token`, c.service.token)
v.Set("channel", c.channel)
if len(c.text) > 0 {
v.Set("text", c.text)
}
return v, nil
} | [
"func",
"(",
"c",
"*",
"ChatMeMessageCall",
")",
"Values",
"(",
")",
"(",
"url",
".",
"Values",
",",
"error",
")",
"{",
"if",
"err",
":=",
"c",
".",
"ValidateArgs",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wra... | // Values returns the ChatMeMessageCall object as url.Values | [
"Values",
"returns",
"the",
"ChatMeMessageCall",
"object",
"as",
"url",
".",
"Values"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/chat_gen.go#L185-L198 |
152,755 | lestrrat/go-slack | chat_gen.go | PostMessage | func (s *ChatService) PostMessage(channel string) *ChatPostMessageCall {
var call ChatPostMessageCall
call.service = s
call.channel = channel
return &call
} | go | func (s *ChatService) PostMessage(channel string) *ChatPostMessageCall {
var call ChatPostMessageCall
call.service = s
call.channel = channel
return &call
} | [
"func",
"(",
"s",
"*",
"ChatService",
")",
"PostMessage",
"(",
"channel",
"string",
")",
"*",
"ChatPostMessageCall",
"{",
"var",
"call",
"ChatPostMessageCall",
"\n",
"call",
".",
"service",
"=",
"s",
"\n",
"call",
".",
"channel",
"=",
"channel",
"\n",
"ret... | // PostMessage creates a ChatPostMessageCall object in preparation for accessing the chat.postMessage endpoint | [
"PostMessage",
"creates",
"a",
"ChatPostMessageCall",
"object",
"in",
"preparation",
"for",
"accessing",
"the",
"chat",
".",
"postMessage",
"endpoint"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/chat_gen.go#L235-L240 |
152,756 | lestrrat/go-slack | chat_gen.go | EscapeText | func (c *ChatPostMessageCall) EscapeText(escapeText bool) *ChatPostMessageCall {
c.escapeText = escapeText
return c
} | go | func (c *ChatPostMessageCall) EscapeText(escapeText bool) *ChatPostMessageCall {
c.escapeText = escapeText
return c
} | [
"func",
"(",
"c",
"*",
"ChatPostMessageCall",
")",
"EscapeText",
"(",
"escapeText",
"bool",
")",
"*",
"ChatPostMessageCall",
"{",
"c",
".",
"escapeText",
"=",
"escapeText",
"\n",
"return",
"c",
"\n",
"}"
] | // EscapeText sets the value for optional escapeText parameter | [
"EscapeText",
"sets",
"the",
"value",
"for",
"optional",
"escapeText",
"parameter"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/chat_gen.go#L261-L264 |
152,757 | lestrrat/go-slack | chat_gen.go | IconEmoji | func (c *ChatPostMessageCall) IconEmoji(iconEmoji string) *ChatPostMessageCall {
c.iconEmoji = iconEmoji
return c
} | go | func (c *ChatPostMessageCall) IconEmoji(iconEmoji string) *ChatPostMessageCall {
c.iconEmoji = iconEmoji
return c
} | [
"func",
"(",
"c",
"*",
"ChatPostMessageCall",
")",
"IconEmoji",
"(",
"iconEmoji",
"string",
")",
"*",
"ChatPostMessageCall",
"{",
"c",
".",
"iconEmoji",
"=",
"iconEmoji",
"\n",
"return",
"c",
"\n",
"}"
] | // IconEmoji sets the value for optional iconEmoji parameter | [
"IconEmoji",
"sets",
"the",
"value",
"for",
"optional",
"iconEmoji",
"parameter"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/chat_gen.go#L267-L270 |
152,758 | lestrrat/go-slack | chat_gen.go | IconURL | func (c *ChatPostMessageCall) IconURL(iconURL string) *ChatPostMessageCall {
c.iconURL = iconURL
return c
} | go | func (c *ChatPostMessageCall) IconURL(iconURL string) *ChatPostMessageCall {
c.iconURL = iconURL
return c
} | [
"func",
"(",
"c",
"*",
"ChatPostMessageCall",
")",
"IconURL",
"(",
"iconURL",
"string",
")",
"*",
"ChatPostMessageCall",
"{",
"c",
".",
"iconURL",
"=",
"iconURL",
"\n",
"return",
"c",
"\n",
"}"
] | // IconURL sets the value for optional iconURL parameter | [
"IconURL",
"sets",
"the",
"value",
"for",
"optional",
"iconURL",
"parameter"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/chat_gen.go#L273-L276 |
152,759 | lestrrat/go-slack | chat_gen.go | Markdown | func (c *ChatPostMessageCall) Markdown(markdown bool) *ChatPostMessageCall {
c.markdown = markdown
return c
} | go | func (c *ChatPostMessageCall) Markdown(markdown bool) *ChatPostMessageCall {
c.markdown = markdown
return c
} | [
"func",
"(",
"c",
"*",
"ChatPostMessageCall",
")",
"Markdown",
"(",
"markdown",
"bool",
")",
"*",
"ChatPostMessageCall",
"{",
"c",
".",
"markdown",
"=",
"markdown",
"\n",
"return",
"c",
"\n",
"}"
] | // Markdown sets the value for optional markdown parameter | [
"Markdown",
"sets",
"the",
"value",
"for",
"optional",
"markdown",
"parameter"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/chat_gen.go#L285-L288 |
152,760 | lestrrat/go-slack | chat_gen.go | UnfurlLinks | func (c *ChatPostMessageCall) UnfurlLinks(unfurlLinks bool) *ChatPostMessageCall {
c.unfurlLinks = unfurlLinks
return c
} | go | func (c *ChatPostMessageCall) UnfurlLinks(unfurlLinks bool) *ChatPostMessageCall {
c.unfurlLinks = unfurlLinks
return c
} | [
"func",
"(",
"c",
"*",
"ChatPostMessageCall",
")",
"UnfurlLinks",
"(",
"unfurlLinks",
"bool",
")",
"*",
"ChatPostMessageCall",
"{",
"c",
".",
"unfurlLinks",
"=",
"unfurlLinks",
"\n",
"return",
"c",
"\n",
"}"
] | // UnfurlLinks sets the value for optional unfurlLinks parameter | [
"UnfurlLinks",
"sets",
"the",
"value",
"for",
"optional",
"unfurlLinks",
"parameter"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/chat_gen.go#L303-L306 |
152,761 | lestrrat/go-slack | chat_gen.go | UnfurlMedia | func (c *ChatPostMessageCall) UnfurlMedia(unfurlMedia bool) *ChatPostMessageCall {
c.unfurlMedia = unfurlMedia
return c
} | go | func (c *ChatPostMessageCall) UnfurlMedia(unfurlMedia bool) *ChatPostMessageCall {
c.unfurlMedia = unfurlMedia
return c
} | [
"func",
"(",
"c",
"*",
"ChatPostMessageCall",
")",
"UnfurlMedia",
"(",
"unfurlMedia",
"bool",
")",
"*",
"ChatPostMessageCall",
"{",
"c",
".",
"unfurlMedia",
"=",
"unfurlMedia",
"\n",
"return",
"c",
"\n",
"}"
] | // UnfurlMedia sets the value for optional unfurlMedia parameter | [
"UnfurlMedia",
"sets",
"the",
"value",
"for",
"optional",
"unfurlMedia",
"parameter"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/chat_gen.go#L309-L312 |
152,762 | lestrrat/go-slack | chat_gen.go | Username | func (c *ChatPostMessageCall) Username(username string) *ChatPostMessageCall {
c.username = username
return c
} | go | func (c *ChatPostMessageCall) Username(username string) *ChatPostMessageCall {
c.username = username
return c
} | [
"func",
"(",
"c",
"*",
"ChatPostMessageCall",
")",
"Username",
"(",
"username",
"string",
")",
"*",
"ChatPostMessageCall",
"{",
"c",
".",
"username",
"=",
"username",
"\n",
"return",
"c",
"\n",
"}"
] | // Username sets the value for optional username parameter | [
"Username",
"sets",
"the",
"value",
"for",
"optional",
"username",
"parameter"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/chat_gen.go#L315-L318 |
152,763 | lestrrat/go-slack | chat_gen.go | ValidateArgs | func (c *ChatPostMessageCall) ValidateArgs() error {
if len(c.channel) <= 0 {
return errors.New(`required field channel not initialized`)
}
return nil
} | go | func (c *ChatPostMessageCall) ValidateArgs() error {
if len(c.channel) <= 0 {
return errors.New(`required field channel not initialized`)
}
return nil
} | [
"func",
"(",
"c",
"*",
"ChatPostMessageCall",
")",
"ValidateArgs",
"(",
")",
"error",
"{",
"if",
"len",
"(",
"c",
".",
"channel",
")",
"<=",
"0",
"{",
"return",
"errors",
".",
"New",
"(",
"`required field channel not initialized`",
")",
"\n",
"}",
"\n",
... | // ValidateArgs checks that all required fields are set in the ChatPostMessageCall object | [
"ValidateArgs",
"checks",
"that",
"all",
"required",
"fields",
"are",
"set",
"in",
"the",
"ChatPostMessageCall",
"object"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/chat_gen.go#L321-L326 |
152,764 | lestrrat/go-slack | chat_gen.go | Values | func (c *ChatPostMessageCall) Values() (url.Values, error) {
if err := c.ValidateArgs(); err != nil {
return nil, errors.Wrap(err, `failed validation`)
}
v := url.Values{}
v.Set(`token`, c.service.token)
if c.asUser {
v.Set("as_user", "true")
}
if len(c.attachments) > 0 {
attachmentsEncoded, err := c.attachments.Encode()
if err != nil {
return nil, errors.Wrap(err, `failed to encode field`)
}
v.Set("attachments", attachmentsEncoded)
}
v.Set("channel", c.channel)
if c.escapeText {
v.Set("escapeText", "true")
}
if len(c.iconEmoji) > 0 {
v.Set("iconEmoji", c.iconEmoji)
}
if len(c.iconURL) > 0 {
v.Set("iconURL", c.iconURL)
}
if c.linkNames {
v.Set("linkNames", "true")
}
if c.markdown {
v.Set("markdown", "true")
}
if len(c.parse) > 0 {
v.Set("parse", c.parse)
}
if len(c.text) > 0 {
v.Set("text", c.text)
}
if c.unfurlLinks {
v.Set("unfurlLinks", "true")
}
if c.unfurlMedia {
v.Set("unfurlMedia", "true")
}
if len(c.username) > 0 {
v.Set("username", c.username)
}
return v, nil
} | go | func (c *ChatPostMessageCall) Values() (url.Values, error) {
if err := c.ValidateArgs(); err != nil {
return nil, errors.Wrap(err, `failed validation`)
}
v := url.Values{}
v.Set(`token`, c.service.token)
if c.asUser {
v.Set("as_user", "true")
}
if len(c.attachments) > 0 {
attachmentsEncoded, err := c.attachments.Encode()
if err != nil {
return nil, errors.Wrap(err, `failed to encode field`)
}
v.Set("attachments", attachmentsEncoded)
}
v.Set("channel", c.channel)
if c.escapeText {
v.Set("escapeText", "true")
}
if len(c.iconEmoji) > 0 {
v.Set("iconEmoji", c.iconEmoji)
}
if len(c.iconURL) > 0 {
v.Set("iconURL", c.iconURL)
}
if c.linkNames {
v.Set("linkNames", "true")
}
if c.markdown {
v.Set("markdown", "true")
}
if len(c.parse) > 0 {
v.Set("parse", c.parse)
}
if len(c.text) > 0 {
v.Set("text", c.text)
}
if c.unfurlLinks {
v.Set("unfurlLinks", "true")
}
if c.unfurlMedia {
v.Set("unfurlMedia", "true")
}
if len(c.username) > 0 {
v.Set("username", c.username)
}
return v, nil
} | [
"func",
"(",
"c",
"*",
"ChatPostMessageCall",
")",
"Values",
"(",
")",
"(",
"url",
".",
"Values",
",",
"error",
")",
"{",
"if",
"err",
":=",
"c",
".",
"ValidateArgs",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"W... | // Values returns the ChatPostMessageCall object as url.Values | [
"Values",
"returns",
"the",
"ChatPostMessageCall",
"object",
"as",
"url",
".",
"Values"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/chat_gen.go#L329-L390 |
152,765 | lestrrat/go-slack | chat_gen.go | Unfurl | func (s *ChatService) Unfurl(channel string, timestamp string, unfurls string) *ChatUnfurlCall {
var call ChatUnfurlCall
call.service = s
call.channel = channel
call.timestamp = timestamp
call.unfurls = unfurls
return &call
} | go | func (s *ChatService) Unfurl(channel string, timestamp string, unfurls string) *ChatUnfurlCall {
var call ChatUnfurlCall
call.service = s
call.channel = channel
call.timestamp = timestamp
call.unfurls = unfurls
return &call
} | [
"func",
"(",
"s",
"*",
"ChatService",
")",
"Unfurl",
"(",
"channel",
"string",
",",
"timestamp",
"string",
",",
"unfurls",
"string",
")",
"*",
"ChatUnfurlCall",
"{",
"var",
"call",
"ChatUnfurlCall",
"\n",
"call",
".",
"service",
"=",
"s",
"\n",
"call",
"... | // Unfurl creates a ChatUnfurlCall object in preparation for accessing the chat.unfurl endpoint | [
"Unfurl",
"creates",
"a",
"ChatUnfurlCall",
"object",
"in",
"preparation",
"for",
"accessing",
"the",
"chat",
".",
"unfurl",
"endpoint"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/chat_gen.go#L486-L493 |
152,766 | lestrrat/go-slack | chat_gen.go | UserAuthRequired | func (c *ChatUnfurlCall) UserAuthRequired(userAuthRequired bool) *ChatUnfurlCall {
c.userAuthRequired = userAuthRequired
return c
} | go | func (c *ChatUnfurlCall) UserAuthRequired(userAuthRequired bool) *ChatUnfurlCall {
c.userAuthRequired = userAuthRequired
return c
} | [
"func",
"(",
"c",
"*",
"ChatUnfurlCall",
")",
"UserAuthRequired",
"(",
"userAuthRequired",
"bool",
")",
"*",
"ChatUnfurlCall",
"{",
"c",
".",
"userAuthRequired",
"=",
"userAuthRequired",
"\n",
"return",
"c",
"\n",
"}"
] | // UserAuthRequired sets the value for optional userAuthRequired parameter | [
"UserAuthRequired",
"sets",
"the",
"value",
"for",
"optional",
"userAuthRequired",
"parameter"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/chat_gen.go#L496-L499 |
152,767 | lestrrat/go-slack | chat_gen.go | ValidateArgs | func (c *ChatUnfurlCall) ValidateArgs() error {
if len(c.channel) <= 0 {
return errors.New(`required field channel not initialized`)
}
if len(c.timestamp) <= 0 {
return errors.New(`required field timestamp not initialized`)
}
if len(c.unfurls) <= 0 {
return errors.New(`required field unfurls not initialized`)
}
return nil
} | go | func (c *ChatUnfurlCall) ValidateArgs() error {
if len(c.channel) <= 0 {
return errors.New(`required field channel not initialized`)
}
if len(c.timestamp) <= 0 {
return errors.New(`required field timestamp not initialized`)
}
if len(c.unfurls) <= 0 {
return errors.New(`required field unfurls not initialized`)
}
return nil
} | [
"func",
"(",
"c",
"*",
"ChatUnfurlCall",
")",
"ValidateArgs",
"(",
")",
"error",
"{",
"if",
"len",
"(",
"c",
".",
"channel",
")",
"<=",
"0",
"{",
"return",
"errors",
".",
"New",
"(",
"`required field channel not initialized`",
")",
"\n",
"}",
"\n",
"if",... | // ValidateArgs checks that all required fields are set in the ChatUnfurlCall object | [
"ValidateArgs",
"checks",
"that",
"all",
"required",
"fields",
"are",
"set",
"in",
"the",
"ChatUnfurlCall",
"object"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/chat_gen.go#L502-L513 |
152,768 | lestrrat/go-slack | chat_gen.go | Values | func (c *ChatUnfurlCall) Values() (url.Values, error) {
if err := c.ValidateArgs(); err != nil {
return nil, errors.Wrap(err, `failed validation`)
}
v := url.Values{}
v.Set(`token`, c.service.token)
v.Set("channel", c.channel)
v.Set("ts", c.timestamp)
v.Set("unfurls", c.unfurls)
if c.userAuthRequired {
v.Set("user_auth_required", "true")
}
return v, nil
} | go | func (c *ChatUnfurlCall) Values() (url.Values, error) {
if err := c.ValidateArgs(); err != nil {
return nil, errors.Wrap(err, `failed validation`)
}
v := url.Values{}
v.Set(`token`, c.service.token)
v.Set("channel", c.channel)
v.Set("ts", c.timestamp)
v.Set("unfurls", c.unfurls)
if c.userAuthRequired {
v.Set("user_auth_required", "true")
}
return v, nil
} | [
"func",
"(",
"c",
"*",
"ChatUnfurlCall",
")",
"Values",
"(",
")",
"(",
"url",
".",
"Values",
",",
"error",
")",
"{",
"if",
"err",
":=",
"c",
".",
"ValidateArgs",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",... | // Values returns the ChatUnfurlCall object as url.Values | [
"Values",
"returns",
"the",
"ChatUnfurlCall",
"object",
"as",
"url",
".",
"Values"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/chat_gen.go#L516-L533 |
152,769 | lestrrat/go-slack | chat_gen.go | Update | func (s *ChatService) Update(channel string) *ChatUpdateCall {
var call ChatUpdateCall
call.service = s
call.channel = channel
return &call
} | go | func (s *ChatService) Update(channel string) *ChatUpdateCall {
var call ChatUpdateCall
call.service = s
call.channel = channel
return &call
} | [
"func",
"(",
"s",
"*",
"ChatService",
")",
"Update",
"(",
"channel",
"string",
")",
"*",
"ChatUpdateCall",
"{",
"var",
"call",
"ChatUpdateCall",
"\n",
"call",
".",
"service",
"=",
"s",
"\n",
"call",
".",
"channel",
"=",
"channel",
"\n",
"return",
"&",
... | // Update creates a ChatUpdateCall object in preparation for accessing the chat.update endpoint | [
"Update",
"creates",
"a",
"ChatUpdateCall",
"object",
"in",
"preparation",
"for",
"accessing",
"the",
"chat",
".",
"update",
"endpoint"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/chat_gen.go#L579-L584 |
152,770 | lestrrat/go-slack | chat_gen.go | Values | func (c *ChatUpdateCall) Values() (url.Values, error) {
if err := c.ValidateArgs(); err != nil {
return nil, errors.Wrap(err, `failed validation`)
}
v := url.Values{}
v.Set(`token`, c.service.token)
if c.asUser {
v.Set("as_user", "true")
}
if len(c.attachments) > 0 {
attachmentsEncoded, err := c.attachments.Encode()
if err != nil {
return nil, errors.Wrap(err, `failed to encode field`)
}
v.Set("attachments", attachmentsEncoded)
}
v.Set("channel", c.channel)
if c.linkNames {
v.Set("linkNames", "true")
}
if len(c.parse) > 0 {
v.Set("parse", c.parse)
}
if len(c.text) > 0 {
v.Set("text", c.text)
}
if len(c.timestamp) > 0 {
v.Set("ts", c.timestamp)
}
return v, nil
} | go | func (c *ChatUpdateCall) Values() (url.Values, error) {
if err := c.ValidateArgs(); err != nil {
return nil, errors.Wrap(err, `failed validation`)
}
v := url.Values{}
v.Set(`token`, c.service.token)
if c.asUser {
v.Set("as_user", "true")
}
if len(c.attachments) > 0 {
attachmentsEncoded, err := c.attachments.Encode()
if err != nil {
return nil, errors.Wrap(err, `failed to encode field`)
}
v.Set("attachments", attachmentsEncoded)
}
v.Set("channel", c.channel)
if c.linkNames {
v.Set("linkNames", "true")
}
if len(c.parse) > 0 {
v.Set("parse", c.parse)
}
if len(c.text) > 0 {
v.Set("text", c.text)
}
if len(c.timestamp) > 0 {
v.Set("ts", c.timestamp)
}
return v, nil
} | [
"func",
"(",
"c",
"*",
"ChatUpdateCall",
")",
"Values",
"(",
")",
"(",
"url",
".",
"Values",
",",
"error",
")",
"{",
"if",
"err",
":=",
"c",
".",
"ValidateArgs",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",... | // Values returns the ChatUpdateCall object as url.Values | [
"Values",
"returns",
"the",
"ChatUpdateCall",
"object",
"as",
"url",
".",
"Values"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/chat_gen.go#L637-L674 |
152,771 | michiwend/gomusicbrainz | recording.go | LookupRecording | func (c *WS2Client) LookupRecording(id MBID, inc ...string) (*Recording, error) {
a := &Recording{ID: id}
err := c.Lookup(a, inc...)
return a, err
} | go | func (c *WS2Client) LookupRecording(id MBID, inc ...string) (*Recording, error) {
a := &Recording{ID: id}
err := c.Lookup(a, inc...)
return a, err
} | [
"func",
"(",
"c",
"*",
"WS2Client",
")",
"LookupRecording",
"(",
"id",
"MBID",
",",
"inc",
"...",
"string",
")",
"(",
"*",
"Recording",
",",
"error",
")",
"{",
"a",
":=",
"&",
"Recording",
"{",
"ID",
":",
"id",
"}",
"\n",
"err",
":=",
"c",
".",
... | // LookupRecording performs an recording lookup request for the given MBID. | [
"LookupRecording",
"performs",
"an",
"recording",
"lookup",
"request",
"for",
"the",
"given",
"MBID",
"."
] | 6c07e13dd396ba10bd9f8904be5018df94472839 | https://github.com/michiwend/gomusicbrainz/blob/6c07e13dd396ba10bd9f8904be5018df94472839/recording.go#L58-L63 |
152,772 | michiwend/gomusicbrainz | recording.go | ResultsWithScore | func (r *RecordingSearchResponse) ResultsWithScore(score int) []*Recording {
var res []*Recording
for _, v := range r.Recordings {
if r.Scores[v] >= score {
res = append(res, v)
}
}
return res
} | go | func (r *RecordingSearchResponse) ResultsWithScore(score int) []*Recording {
var res []*Recording
for _, v := range r.Recordings {
if r.Scores[v] >= score {
res = append(res, v)
}
}
return res
} | [
"func",
"(",
"r",
"*",
"RecordingSearchResponse",
")",
"ResultsWithScore",
"(",
"score",
"int",
")",
"[",
"]",
"*",
"Recording",
"{",
"var",
"res",
"[",
"]",
"*",
"Recording",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"r",
".",
"Recordings",
"{",
"i... | // ResultsWithScore returns a slice of Recordings with a min score. | [
"ResultsWithScore",
"returns",
"a",
"slice",
"of",
"Recordings",
"with",
"a",
"min",
"score",
"."
] | 6c07e13dd396ba10bd9f8904be5018df94472839 | https://github.com/michiwend/gomusicbrainz/blob/6c07e13dd396ba10bd9f8904be5018df94472839/recording.go#L129-L137 |
152,773 | michiwend/gomusicbrainz | label.go | LookupLabel | func (c *WS2Client) LookupLabel(id MBID, inc ...string) (*Label, error) {
a := &Label{ID: id}
err := c.Lookup(a, inc...)
return a, err
} | go | func (c *WS2Client) LookupLabel(id MBID, inc ...string) (*Label, error) {
a := &Label{ID: id}
err := c.Lookup(a, inc...)
return a, err
} | [
"func",
"(",
"c",
"*",
"WS2Client",
")",
"LookupLabel",
"(",
"id",
"MBID",
",",
"inc",
"...",
"string",
")",
"(",
"*",
"Label",
",",
"error",
")",
"{",
"a",
":=",
"&",
"Label",
"{",
"ID",
":",
"id",
"}",
"\n",
"err",
":=",
"c",
".",
"Lookup",
... | // LookupLabel performs a label lookup request for the given MBID. | [
"LookupLabel",
"performs",
"a",
"label",
"lookup",
"request",
"for",
"the",
"given",
"MBID",
"."
] | 6c07e13dd396ba10bd9f8904be5018df94472839 | https://github.com/michiwend/gomusicbrainz/blob/6c07e13dd396ba10bd9f8904be5018df94472839/label.go#L70-L75 |
152,774 | michiwend/gomusicbrainz | label.go | ResultsWithScore | func (r *LabelSearchResponse) ResultsWithScore(score int) []*Label {
var res []*Label
for _, v := range r.Labels {
if r.Scores[v] >= score {
res = append(res, v)
}
}
return res
} | go | func (r *LabelSearchResponse) ResultsWithScore(score int) []*Label {
var res []*Label
for _, v := range r.Labels {
if r.Scores[v] >= score {
res = append(res, v)
}
}
return res
} | [
"func",
"(",
"r",
"*",
"LabelSearchResponse",
")",
"ResultsWithScore",
"(",
"score",
"int",
")",
"[",
"]",
"*",
"Label",
"{",
"var",
"res",
"[",
"]",
"*",
"Label",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"r",
".",
"Labels",
"{",
"if",
"r",
"."... | // ResultsWithScore returns a slice of Labels with a min score. | [
"ResultsWithScore",
"returns",
"a",
"slice",
"of",
"Labels",
"with",
"a",
"min",
"score",
"."
] | 6c07e13dd396ba10bd9f8904be5018df94472839 | https://github.com/michiwend/gomusicbrainz/blob/6c07e13dd396ba10bd9f8904be5018df94472839/label.go#L125-L133 |
152,775 | michiwend/gomusicbrainz | cd_stub.go | ResultsWithScore | func (r *CDStubSearchResponse) ResultsWithScore(score int) []*CDStub {
var res []*CDStub
for _, v := range r.CDStubs {
if r.Scores[v] >= score {
res = append(res, v)
}
}
return res
} | go | func (r *CDStubSearchResponse) ResultsWithScore(score int) []*CDStub {
var res []*CDStub
for _, v := range r.CDStubs {
if r.Scores[v] >= score {
res = append(res, v)
}
}
return res
} | [
"func",
"(",
"r",
"*",
"CDStubSearchResponse",
")",
"ResultsWithScore",
"(",
"score",
"int",
")",
"[",
"]",
"*",
"CDStub",
"{",
"var",
"res",
"[",
"]",
"*",
"CDStub",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"r",
".",
"CDStubs",
"{",
"if",
"r",
... | // ResultsWithScore returns a slice of CDStubs with a min score. | [
"ResultsWithScore",
"returns",
"a",
"slice",
"of",
"CDStubs",
"with",
"a",
"min",
"score",
"."
] | 6c07e13dd396ba10bd9f8904be5018df94472839 | https://github.com/michiwend/gomusicbrainz/blob/6c07e13dd396ba10bd9f8904be5018df94472839/cd_stub.go#L79-L87 |
152,776 | timehop/go-mixpanel | mixpanel.go | Track | func (m *Mixpanel) Track(distinctID string, event string, props Properties) error {
if distinctID != "" {
props["distinct_id"] = distinctID
}
props["token"] = m.Token
props["mp_lib"] = library
data := map[string]interface{}{"event": event, "properties": props}
return m.makeRequestWithData("GET", "track", data, sourceUser)
} | go | func (m *Mixpanel) Track(distinctID string, event string, props Properties) error {
if distinctID != "" {
props["distinct_id"] = distinctID
}
props["token"] = m.Token
props["mp_lib"] = library
data := map[string]interface{}{"event": event, "properties": props}
return m.makeRequestWithData("GET", "track", data, sourceUser)
} | [
"func",
"(",
"m",
"*",
"Mixpanel",
")",
"Track",
"(",
"distinctID",
"string",
",",
"event",
"string",
",",
"props",
"Properties",
")",
"error",
"{",
"if",
"distinctID",
"!=",
"\"",
"\"",
"{",
"props",
"[",
"\"",
"\"",
"]",
"=",
"distinctID",
"\n",
"}... | // Track sends event data with optional metadata. | [
"Track",
"sends",
"event",
"data",
"with",
"optional",
"metadata",
"."
] | 9b81eaf1f33eda1d280d59adbd1fe9d3ad3da08f | https://github.com/timehop/go-mixpanel/blob/9b81eaf1f33eda1d280d59adbd1fe9d3ad3da08f/mixpanel.go#L56-L65 |
152,777 | timehop/go-mixpanel | mixpanel.go | Engage | func (m *Mixpanel) Engage(distinctID string, props Properties, op *Operation) error {
return m.engage(distinctID, props, op, sourceUser)
} | go | func (m *Mixpanel) Engage(distinctID string, props Properties, op *Operation) error {
return m.engage(distinctID, props, op, sourceUser)
} | [
"func",
"(",
"m",
"*",
"Mixpanel",
")",
"Engage",
"(",
"distinctID",
"string",
",",
"props",
"Properties",
",",
"op",
"*",
"Operation",
")",
"error",
"{",
"return",
"m",
".",
"engage",
"(",
"distinctID",
",",
"props",
",",
"op",
",",
"sourceUser",
")",... | // Engage updates profile data.
// This will update the IP and related data on the profile.
// If you don't have the IP address of the user, then use the UpdateProperties method instead,
// otherwise the user's location will be set to wherever the script was run from. | [
"Engage",
"updates",
"profile",
"data",
".",
"This",
"will",
"update",
"the",
"IP",
"and",
"related",
"data",
"on",
"the",
"profile",
".",
"If",
"you",
"don",
"t",
"have",
"the",
"IP",
"address",
"of",
"the",
"user",
"then",
"use",
"the",
"UpdateProperti... | 9b81eaf1f33eda1d280d59adbd1fe9d3ad3da08f | https://github.com/timehop/go-mixpanel/blob/9b81eaf1f33eda1d280d59adbd1fe9d3ad3da08f/mixpanel.go#L71-L73 |
152,778 | timehop/go-mixpanel | mixpanel.go | EngageAsScript | func (m *Mixpanel) EngageAsScript(distinctID string, props Properties, op *Operation) error {
return m.engage(distinctID, props, op, sourceScript)
} | go | func (m *Mixpanel) EngageAsScript(distinctID string, props Properties, op *Operation) error {
return m.engage(distinctID, props, op, sourceScript)
} | [
"func",
"(",
"m",
"*",
"Mixpanel",
")",
"EngageAsScript",
"(",
"distinctID",
"string",
",",
"props",
"Properties",
",",
"op",
"*",
"Operation",
")",
"error",
"{",
"return",
"m",
".",
"engage",
"(",
"distinctID",
",",
"props",
",",
"op",
",",
"sourceScrip... | // EngageAsScript calls the engage endpoint, but doesn't set IP, city, country, on the profile. | [
"EngageAsScript",
"calls",
"the",
"engage",
"endpoint",
"but",
"doesn",
"t",
"set",
"IP",
"city",
"country",
"on",
"the",
"profile",
"."
] | 9b81eaf1f33eda1d280d59adbd1fe9d3ad3da08f | https://github.com/timehop/go-mixpanel/blob/9b81eaf1f33eda1d280d59adbd1fe9d3ad3da08f/mixpanel.go#L76-L78 |
152,779 | timehop/go-mixpanel | mixpanel.go | RedirectURL | func (m *Mixpanel) RedirectURL(distinctID, event, uri string, props Properties) (string, error) {
if distinctID != "" {
props["$distinct_id"] = distinctID
}
props["$token"] = m.Token
props["mp_lib"] = library
data := map[string]interface{}{"event": event, "properties": props}
b, err := json.Marshal(data)
if err != nil {
return "", err
}
params := map[string]string{
"data": base64.StdEncoding.EncodeToString(b),
"redirect": uri,
}
query := url.Values{}
for k, v := range params {
query[k] = []string{v}
}
return fmt.Sprintf("%s/%s?%s", m.BaseUrl, "track", query.Encode()), nil
} | go | func (m *Mixpanel) RedirectURL(distinctID, event, uri string, props Properties) (string, error) {
if distinctID != "" {
props["$distinct_id"] = distinctID
}
props["$token"] = m.Token
props["mp_lib"] = library
data := map[string]interface{}{"event": event, "properties": props}
b, err := json.Marshal(data)
if err != nil {
return "", err
}
params := map[string]string{
"data": base64.StdEncoding.EncodeToString(b),
"redirect": uri,
}
query := url.Values{}
for k, v := range params {
query[k] = []string{v}
}
return fmt.Sprintf("%s/%s?%s", m.BaseUrl, "track", query.Encode()), nil
} | [
"func",
"(",
"m",
"*",
"Mixpanel",
")",
"RedirectURL",
"(",
"distinctID",
",",
"event",
",",
"uri",
"string",
",",
"props",
"Properties",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"distinctID",
"!=",
"\"",
"\"",
"{",
"props",
"[",
"\"",
"\"",... | // RedirectURL returns a url that, when clicked, will track the given data and then redirect to provided url. | [
"RedirectURL",
"returns",
"a",
"url",
"that",
"when",
"clicked",
"will",
"track",
"the",
"given",
"data",
"and",
"then",
"redirect",
"to",
"provided",
"url",
"."
] | 9b81eaf1f33eda1d280d59adbd1fe9d3ad3da08f | https://github.com/timehop/go-mixpanel/blob/9b81eaf1f33eda1d280d59adbd1fe9d3ad3da08f/mixpanel.go#L125-L147 |
152,780 | layeh/asar | entry.go | New | func New(name string, ra io.ReaderAt, size, offset int64, flags Flag) *Entry {
return &Entry{
Name: name,
Size: size,
Offset: offset,
Flags: flags,
r: ra,
}
} | go | func New(name string, ra io.ReaderAt, size, offset int64, flags Flag) *Entry {
return &Entry{
Name: name,
Size: size,
Offset: offset,
Flags: flags,
r: ra,
}
} | [
"func",
"New",
"(",
"name",
"string",
",",
"ra",
"io",
".",
"ReaderAt",
",",
"size",
",",
"offset",
"int64",
",",
"flags",
"Flag",
")",
"*",
"Entry",
"{",
"return",
"&",
"Entry",
"{",
"Name",
":",
"name",
",",
"Size",
":",
"size",
",",
"Offset",
... | // New creates a new Entry. | [
"New",
"creates",
"a",
"new",
"Entry",
"."
] | bf07d1986b90c7d2ad63393e73e9390eeb510753 | https://github.com/layeh/asar/blob/bf07d1986b90c7d2ad63393e73e9390eeb510753/entry.go#L42-L51 |
152,781 | layeh/asar | entry.go | Bytes | func (e *Entry) Bytes() []byte {
body := e.Open()
if body == nil {
return nil
}
b, err := ioutil.ReadAll(body)
if err != nil {
return nil
}
return b
} | go | func (e *Entry) Bytes() []byte {
body := e.Open()
if body == nil {
return nil
}
b, err := ioutil.ReadAll(body)
if err != nil {
return nil
}
return b
} | [
"func",
"(",
"e",
"*",
"Entry",
")",
"Bytes",
"(",
")",
"[",
"]",
"byte",
"{",
"body",
":=",
"e",
".",
"Open",
"(",
")",
"\n",
"if",
"body",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"b",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
... | // Bytes returns the entry's contents as a byte slice. nil is returned if the
// entry cannot be read. | [
"Bytes",
"returns",
"the",
"entry",
"s",
"contents",
"as",
"a",
"byte",
"slice",
".",
"nil",
"is",
"returned",
"if",
"the",
"entry",
"cannot",
"be",
"read",
"."
] | bf07d1986b90c7d2ad63393e73e9390eeb510753 | https://github.com/layeh/asar/blob/bf07d1986b90c7d2ad63393e73e9390eeb510753/entry.go#L146-L156 |
152,782 | layeh/asar | entry.go | String | func (e *Entry) String() string {
body := e.Bytes()
if body == nil {
return ""
}
return string(body)
} | go | func (e *Entry) String() string {
body := e.Bytes()
if body == nil {
return ""
}
return string(body)
} | [
"func",
"(",
"e",
"*",
"Entry",
")",
"String",
"(",
")",
"string",
"{",
"body",
":=",
"e",
".",
"Bytes",
"(",
")",
"\n",
"if",
"body",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"string",
"(",
"body",
")",
"\n",
"}"
] | // Bytes returns the entry's contents as a string. nil is returned if the entry
// cannot be read. | [
"Bytes",
"returns",
"the",
"entry",
"s",
"contents",
"as",
"a",
"string",
".",
"nil",
"is",
"returned",
"if",
"the",
"entry",
"cannot",
"be",
"read",
"."
] | bf07d1986b90c7d2ad63393e73e9390eeb510753 | https://github.com/layeh/asar/blob/bf07d1986b90c7d2ad63393e73e9390eeb510753/entry.go#L160-L166 |
152,783 | layeh/asar | entry.go | Walk | func (e *Entry) Walk(walkFn filepath.WalkFunc) error {
return walk(e, "", walkFn)
} | go | func (e *Entry) Walk(walkFn filepath.WalkFunc) error {
return walk(e, "", walkFn)
} | [
"func",
"(",
"e",
"*",
"Entry",
")",
"Walk",
"(",
"walkFn",
"filepath",
".",
"WalkFunc",
")",
"error",
"{",
"return",
"walk",
"(",
"e",
",",
"\"",
"\"",
",",
"walkFn",
")",
"\n",
"}"
] | // Walk recursively walks over the entry's children. See filepath.Walk and
// filepath.WalkFunc for more information. | [
"Walk",
"recursively",
"walks",
"over",
"the",
"entry",
"s",
"children",
".",
"See",
"filepath",
".",
"Walk",
"and",
"filepath",
".",
"WalkFunc",
"for",
"more",
"information",
"."
] | bf07d1986b90c7d2ad63393e73e9390eeb510753 | https://github.com/layeh/asar/blob/bf07d1986b90c7d2ad63393e73e9390eeb510753/entry.go#L196-L198 |
152,784 | lestrrat/go-slack | usergroups_users_gen.go | List | func (s *UsergroupsUsersService) List(usergroup string) *UsergroupsUsersListCall {
var call UsergroupsUsersListCall
call.service = s
call.usergroup = usergroup
return &call
} | go | func (s *UsergroupsUsersService) List(usergroup string) *UsergroupsUsersListCall {
var call UsergroupsUsersListCall
call.service = s
call.usergroup = usergroup
return &call
} | [
"func",
"(",
"s",
"*",
"UsergroupsUsersService",
")",
"List",
"(",
"usergroup",
"string",
")",
"*",
"UsergroupsUsersListCall",
"{",
"var",
"call",
"UsergroupsUsersListCall",
"\n",
"call",
".",
"service",
"=",
"s",
"\n",
"call",
".",
"usergroup",
"=",
"usergrou... | // List creates a UsergroupsUsersListCall object in preparation for accessing the usergroups.users.list endpoint | [
"List",
"creates",
"a",
"UsergroupsUsersListCall",
"object",
"in",
"preparation",
"for",
"accessing",
"the",
"usergroups",
".",
"users",
".",
"list",
"endpoint"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/usergroups_users_gen.go#L35-L40 |
152,785 | lestrrat/go-slack | usergroups_users_gen.go | Values | func (c *UsergroupsUsersListCall) Values() (url.Values, error) {
if err := c.ValidateArgs(); err != nil {
return nil, errors.Wrap(err, `failed validation`)
}
v := url.Values{}
v.Set(`token`, c.service.token)
if c.includeDisabled {
v.Set("include_disabled", "true")
}
v.Set("usergroup", c.usergroup)
return v, nil
} | go | func (c *UsergroupsUsersListCall) Values() (url.Values, error) {
if err := c.ValidateArgs(); err != nil {
return nil, errors.Wrap(err, `failed validation`)
}
v := url.Values{}
v.Set(`token`, c.service.token)
if c.includeDisabled {
v.Set("include_disabled", "true")
}
v.Set("usergroup", c.usergroup)
return v, nil
} | [
"func",
"(",
"c",
"*",
"UsergroupsUsersListCall",
")",
"Values",
"(",
")",
"(",
"url",
".",
"Values",
",",
"error",
")",
"{",
"if",
"err",
":=",
"c",
".",
"ValidateArgs",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
... | // Values returns the UsergroupsUsersListCall object as url.Values | [
"Values",
"returns",
"the",
"UsergroupsUsersListCall",
"object",
"as",
"url",
".",
"Values"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/usergroups_users_gen.go#L57-L70 |
152,786 | lestrrat/go-slack | usergroups_users_gen.go | Update | func (s *UsergroupsUsersService) Update(usergroup string, users string) *UsergroupsUsersUpdateCall {
var call UsergroupsUsersUpdateCall
call.service = s
call.usergroup = usergroup
call.users = users
return &call
} | go | func (s *UsergroupsUsersService) Update(usergroup string, users string) *UsergroupsUsersUpdateCall {
var call UsergroupsUsersUpdateCall
call.service = s
call.usergroup = usergroup
call.users = users
return &call
} | [
"func",
"(",
"s",
"*",
"UsergroupsUsersService",
")",
"Update",
"(",
"usergroup",
"string",
",",
"users",
"string",
")",
"*",
"UsergroupsUsersUpdateCall",
"{",
"var",
"call",
"UsergroupsUsersUpdateCall",
"\n",
"call",
".",
"service",
"=",
"s",
"\n",
"call",
".... | // Update creates a UsergroupsUsersUpdateCall object in preparation for accessing the usergroups.users.update endpoint | [
"Update",
"creates",
"a",
"UsergroupsUsersUpdateCall",
"object",
"in",
"preparation",
"for",
"accessing",
"the",
"usergroups",
".",
"users",
".",
"update",
"endpoint"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/usergroups_users_gen.go#L111-L117 |
152,787 | lestrrat/go-slack | usergroups_users_gen.go | ValidateArgs | func (c *UsergroupsUsersUpdateCall) ValidateArgs() error {
if len(c.usergroup) <= 0 {
return errors.New(`required field usergroup not initialized`)
}
if len(c.users) <= 0 {
return errors.New(`required field users not initialized`)
}
return nil
} | go | func (c *UsergroupsUsersUpdateCall) ValidateArgs() error {
if len(c.usergroup) <= 0 {
return errors.New(`required field usergroup not initialized`)
}
if len(c.users) <= 0 {
return errors.New(`required field users not initialized`)
}
return nil
} | [
"func",
"(",
"c",
"*",
"UsergroupsUsersUpdateCall",
")",
"ValidateArgs",
"(",
")",
"error",
"{",
"if",
"len",
"(",
"c",
".",
"usergroup",
")",
"<=",
"0",
"{",
"return",
"errors",
".",
"New",
"(",
"`required field usergroup not initialized`",
")",
"\n",
"}",
... | // ValidateArgs checks that all required fields are set in the UsergroupsUsersUpdateCall object | [
"ValidateArgs",
"checks",
"that",
"all",
"required",
"fields",
"are",
"set",
"in",
"the",
"UsergroupsUsersUpdateCall",
"object"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/usergroups_users_gen.go#L126-L134 |
152,788 | lestrrat/go-slack | oauth_gen.go | Access | func (s *OAuthService) Access(clientID string, clientSecret string, code string) *OAuthAccessCall {
var call OAuthAccessCall
call.service = s
call.clientID = clientID
call.clientSecret = clientSecret
call.code = code
return &call
} | go | func (s *OAuthService) Access(clientID string, clientSecret string, code string) *OAuthAccessCall {
var call OAuthAccessCall
call.service = s
call.clientID = clientID
call.clientSecret = clientSecret
call.code = code
return &call
} | [
"func",
"(",
"s",
"*",
"OAuthService",
")",
"Access",
"(",
"clientID",
"string",
",",
"clientSecret",
"string",
",",
"code",
"string",
")",
"*",
"OAuthAccessCall",
"{",
"var",
"call",
"OAuthAccessCall",
"\n",
"call",
".",
"service",
"=",
"s",
"\n",
"call",... | // Access creates a OAuthAccessCall object in preparation for accessing the oauth.access endpoint | [
"Access",
"creates",
"a",
"OAuthAccessCall",
"object",
"in",
"preparation",
"for",
"accessing",
"the",
"oauth",
".",
"access",
"endpoint"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/oauth_gen.go#L29-L36 |
152,789 | lestrrat/go-slack | oauth_gen.go | RedirectURI | func (c *OAuthAccessCall) RedirectURI(redirectURI string) *OAuthAccessCall {
c.redirectURI = redirectURI
return c
} | go | func (c *OAuthAccessCall) RedirectURI(redirectURI string) *OAuthAccessCall {
c.redirectURI = redirectURI
return c
} | [
"func",
"(",
"c",
"*",
"OAuthAccessCall",
")",
"RedirectURI",
"(",
"redirectURI",
"string",
")",
"*",
"OAuthAccessCall",
"{",
"c",
".",
"redirectURI",
"=",
"redirectURI",
"\n",
"return",
"c",
"\n",
"}"
] | // RedirectURI sets the value for optional redirectURI parameter | [
"RedirectURI",
"sets",
"the",
"value",
"for",
"optional",
"redirectURI",
"parameter"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/oauth_gen.go#L39-L42 |
152,790 | lestrrat/go-slack | oauth_gen.go | ValidateArgs | func (c *OAuthAccessCall) ValidateArgs() error {
if len(c.clientID) <= 0 {
return errors.New(`required field clientID not initialized`)
}
if len(c.clientSecret) <= 0 {
return errors.New(`required field clientSecret not initialized`)
}
if len(c.code) <= 0 {
return errors.New(`required field code not initialized`)
}
return nil
} | go | func (c *OAuthAccessCall) ValidateArgs() error {
if len(c.clientID) <= 0 {
return errors.New(`required field clientID not initialized`)
}
if len(c.clientSecret) <= 0 {
return errors.New(`required field clientSecret not initialized`)
}
if len(c.code) <= 0 {
return errors.New(`required field code not initialized`)
}
return nil
} | [
"func",
"(",
"c",
"*",
"OAuthAccessCall",
")",
"ValidateArgs",
"(",
")",
"error",
"{",
"if",
"len",
"(",
"c",
".",
"clientID",
")",
"<=",
"0",
"{",
"return",
"errors",
".",
"New",
"(",
"`required field clientID not initialized`",
")",
"\n",
"}",
"\n",
"i... | // ValidateArgs checks that all required fields are set in the OAuthAccessCall object | [
"ValidateArgs",
"checks",
"that",
"all",
"required",
"fields",
"are",
"set",
"in",
"the",
"OAuthAccessCall",
"object"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/oauth_gen.go#L45-L56 |
152,791 | lestrrat/go-slack | oauth_gen.go | Values | func (c *OAuthAccessCall) Values() (url.Values, error) {
if err := c.ValidateArgs(); err != nil {
return nil, errors.Wrap(err, `failed validation`)
}
v := url.Values{}
v.Set("client_id", c.clientID)
v.Set("client_secret", c.clientSecret)
v.Set("code", c.code)
if len(c.redirectURI) > 0 {
v.Set("redirect_uri", c.redirectURI)
}
return v, nil
} | go | func (c *OAuthAccessCall) Values() (url.Values, error) {
if err := c.ValidateArgs(); err != nil {
return nil, errors.Wrap(err, `failed validation`)
}
v := url.Values{}
v.Set("client_id", c.clientID)
v.Set("client_secret", c.clientSecret)
v.Set("code", c.code)
if len(c.redirectURI) > 0 {
v.Set("redirect_uri", c.redirectURI)
}
return v, nil
} | [
"func",
"(",
"c",
"*",
"OAuthAccessCall",
")",
"Values",
"(",
")",
"(",
"url",
".",
"Values",
",",
"error",
")",
"{",
"if",
"err",
":=",
"c",
".",
"ValidateArgs",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap"... | // Values returns the OAuthAccessCall object as url.Values | [
"Values",
"returns",
"the",
"OAuthAccessCall",
"object",
"as",
"url",
".",
"Values"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/oauth_gen.go#L59-L75 |
152,792 | lestrrat/go-slack | users_gen.go | DeletePhoto | func (s *UsersService) DeletePhoto() *UsersDeletePhotoCall {
var call UsersDeletePhotoCall
call.service = s
return &call
} | go | func (s *UsersService) DeletePhoto() *UsersDeletePhotoCall {
var call UsersDeletePhotoCall
call.service = s
return &call
} | [
"func",
"(",
"s",
"*",
"UsersService",
")",
"DeletePhoto",
"(",
")",
"*",
"UsersDeletePhotoCall",
"{",
"var",
"call",
"UsersDeletePhotoCall",
"\n",
"call",
".",
"service",
"=",
"s",
"\n",
"return",
"&",
"call",
"\n",
"}"
] | // DeletePhoto creates a UsersDeletePhotoCall object in preparation for accessing the users.deletePhoto endpoint | [
"DeletePhoto",
"creates",
"a",
"UsersDeletePhotoCall",
"object",
"in",
"preparation",
"for",
"accessing",
"the",
"users",
".",
"deletePhoto",
"endpoint"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/users_gen.go#L62-L66 |
152,793 | lestrrat/go-slack | users_gen.go | GetPresence | func (s *UsersService) GetPresence(user string) *UsersGetPresenceCall {
var call UsersGetPresenceCall
call.service = s
call.user = user
return &call
} | go | func (s *UsersService) GetPresence(user string) *UsersGetPresenceCall {
var call UsersGetPresenceCall
call.service = s
call.user = user
return &call
} | [
"func",
"(",
"s",
"*",
"UsersService",
")",
"GetPresence",
"(",
"user",
"string",
")",
"*",
"UsersGetPresenceCall",
"{",
"var",
"call",
"UsersGetPresenceCall",
"\n",
"call",
".",
"service",
"=",
"s",
"\n",
"call",
".",
"user",
"=",
"user",
"\n",
"return",
... | // GetPresence creates a UsersGetPresenceCall object in preparation for accessing the users.getPresence endpoint | [
"GetPresence",
"creates",
"a",
"UsersGetPresenceCall",
"object",
"in",
"preparation",
"for",
"accessing",
"the",
"users",
".",
"getPresence",
"endpoint"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/users_gen.go#L111-L116 |
152,794 | lestrrat/go-slack | users_gen.go | Identity | func (s *UsersService) Identity() *UsersIdentityCall {
var call UsersIdentityCall
call.service = s
return &call
} | go | func (s *UsersService) Identity() *UsersIdentityCall {
var call UsersIdentityCall
call.service = s
return &call
} | [
"func",
"(",
"s",
"*",
"UsersService",
")",
"Identity",
"(",
")",
"*",
"UsersIdentityCall",
"{",
"var",
"call",
"UsersIdentityCall",
"\n",
"call",
".",
"service",
"=",
"s",
"\n",
"return",
"&",
"call",
"\n",
"}"
] | // Identity creates a UsersIdentityCall object in preparation for accessing the users.identity endpoint | [
"Identity",
"creates",
"a",
"UsersIdentityCall",
"object",
"in",
"preparation",
"for",
"accessing",
"the",
"users",
".",
"identity",
"endpoint"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/users_gen.go#L170-L174 |
152,795 | lestrrat/go-slack | users_gen.go | Info | func (s *UsersService) Info(user string) *UsersInfoCall {
var call UsersInfoCall
call.service = s
call.user = user
return &call
} | go | func (s *UsersService) Info(user string) *UsersInfoCall {
var call UsersInfoCall
call.service = s
call.user = user
return &call
} | [
"func",
"(",
"s",
"*",
"UsersService",
")",
"Info",
"(",
"user",
"string",
")",
"*",
"UsersInfoCall",
"{",
"var",
"call",
"UsersInfoCall",
"\n",
"call",
".",
"service",
"=",
"s",
"\n",
"call",
".",
"user",
"=",
"user",
"\n",
"return",
"&",
"call",
"\... | // Info creates a UsersInfoCall object in preparation for accessing the users.info endpoint | [
"Info",
"creates",
"a",
"UsersInfoCall",
"object",
"in",
"preparation",
"for",
"accessing",
"the",
"users",
".",
"info",
"endpoint"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/users_gen.go#L221-L226 |
152,796 | lestrrat/go-slack | users_gen.go | ValidateArgs | func (c *UsersInfoCall) ValidateArgs() error {
if len(c.user) <= 0 {
return errors.New(`required field user not initialized`)
}
return nil
} | go | func (c *UsersInfoCall) ValidateArgs() error {
if len(c.user) <= 0 {
return errors.New(`required field user not initialized`)
}
return nil
} | [
"func",
"(",
"c",
"*",
"UsersInfoCall",
")",
"ValidateArgs",
"(",
")",
"error",
"{",
"if",
"len",
"(",
"c",
".",
"user",
")",
"<=",
"0",
"{",
"return",
"errors",
".",
"New",
"(",
"`required field user not initialized`",
")",
"\n",
"}",
"\n",
"return",
... | // ValidateArgs checks that all required fields are set in the UsersInfoCall object | [
"ValidateArgs",
"checks",
"that",
"all",
"required",
"fields",
"are",
"set",
"in",
"the",
"UsersInfoCall",
"object"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/users_gen.go#L235-L240 |
152,797 | lestrrat/go-slack | users_gen.go | List | func (s *UsersService) List() *UsersListCall {
var call UsersListCall
call.service = s
return &call
} | go | func (s *UsersService) List() *UsersListCall {
var call UsersListCall
call.service = s
return &call
} | [
"func",
"(",
"s",
"*",
"UsersService",
")",
"List",
"(",
")",
"*",
"UsersListCall",
"{",
"var",
"call",
"UsersListCall",
"\n",
"call",
".",
"service",
"=",
"s",
"\n",
"return",
"&",
"call",
"\n",
"}"
] | // List creates a UsersListCall object in preparation for accessing the users.list endpoint | [
"List",
"creates",
"a",
"UsersListCall",
"object",
"in",
"preparation",
"for",
"accessing",
"the",
"users",
".",
"list",
"endpoint"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/users_gen.go#L297-L301 |
152,798 | lestrrat/go-slack | users_gen.go | Presence | func (c *UsersListCall) Presence(presence bool) *UsersListCall {
c.presence = presence
return c
} | go | func (c *UsersListCall) Presence(presence bool) *UsersListCall {
c.presence = presence
return c
} | [
"func",
"(",
"c",
"*",
"UsersListCall",
")",
"Presence",
"(",
"presence",
"bool",
")",
"*",
"UsersListCall",
"{",
"c",
".",
"presence",
"=",
"presence",
"\n",
"return",
"c",
"\n",
"}"
] | // Presence sets the value for optional presence parameter | [
"Presence",
"sets",
"the",
"value",
"for",
"optional",
"presence",
"parameter"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/users_gen.go#L316-L319 |
152,799 | lestrrat/go-slack | users_gen.go | Values | func (c *UsersListCall) Values() (url.Values, error) {
if err := c.ValidateArgs(); err != nil {
return nil, errors.Wrap(err, `failed validation`)
}
v := url.Values{}
v.Set(`token`, c.service.token)
if c.includeLocale {
v.Set("include_locale", "true")
}
if c.limit > 0 {
v.Set("limit", strconv.Itoa(c.limit))
}
if c.presence {
v.Set("presence", "true")
}
return v, nil
} | go | func (c *UsersListCall) Values() (url.Values, error) {
if err := c.ValidateArgs(); err != nil {
return nil, errors.Wrap(err, `failed validation`)
}
v := url.Values{}
v.Set(`token`, c.service.token)
if c.includeLocale {
v.Set("include_locale", "true")
}
if c.limit > 0 {
v.Set("limit", strconv.Itoa(c.limit))
}
if c.presence {
v.Set("presence", "true")
}
return v, nil
} | [
"func",
"(",
"c",
"*",
"UsersListCall",
")",
"Values",
"(",
")",
"(",
"url",
".",
"Values",
",",
"error",
")",
"{",
"if",
"err",
":=",
"c",
".",
"ValidateArgs",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
... | // Values returns the UsersListCall object as url.Values | [
"Values",
"returns",
"the",
"UsersListCall",
"object",
"as",
"url",
".",
"Values"
] | 0a277f80881a4cd1e12ca3228786c50f6922c0a8 | https://github.com/lestrrat/go-slack/blob/0a277f80881a4cd1e12ca3228786c50f6922c0a8/users_gen.go#L327-L346 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.