// GetChannelInfoContext retrieves the given channel with a custom context
// see https://api.slack.com/methods/channels.info
162375
func (api *Client) GetChannelInfoContext(ctx context.Context, channelID string) (*Channel, error) {
	values := url.Values{
		"token":          {api.token},
		"channel":        {channelID},
		"include_locale": {strconv.FormatBool(true)},
	}

	response, err := api.channelRequest(ctx, "channels.info", values)
	if err != nil {
		return nil, err
	}
	return &response.Channel, nil
}
548389
func (api *Client) GetBotInfoContext(ctx context.Context, bot string) (*Bot, error) {
	values := url.Values{
		"token": {api.token},
		"bot":   {bot},
	}

	response, err := api.botRequest(ctx, "bots.info", values)
	if err != nil {
		return nil, err
	}
	return &response.Bot, nil
}
1260394
func (sdk *FabricSDK) ChannelContext(channelID string, options ...ContextOption) contextApi.ChannelProvider {

	channelProvider := func() (contextApi.Channel, error) {

		clientCtxProvider := sdk.Context(options...)
		return context.NewChannel(clientCtxProvider, channelID)

	}

	return channelProvider
}
1234069
func GetCurrentContext() *Window {
	w := C.glfwGetCurrentContext()
	panicError()
	if w == nil {
		return nil
	}
	return windows.get(w)
}
107214
func (api *Client) CreateConversationContext(ctx context.Context, channelName string, isPrivate bool) (*Channel, error) {
	values := url.Values{
		"token":      {api.token},
		"name":       {channelName},
		"is_private": {strconv.FormatBool(isPrivate)},
	}
	response, err := api.channelRequest(ctx, "conversations.create", values)
	if err != nil {
		return nil, err
	}

	return &response.Channel, nil
}
943796
func (call *GetProfileCall) WithContext(ctx context.Context) *GetProfileCall {
	call.ctx = ctx
	return call
}
1202175
func (c *ChannelListCall) Context(ctx context.Context) *ChannelListCall {
	c.ctx_ = ctx
	return c
}
804975
func (e *Error) WithContext(ctx context.Context) *Error {
	if i, ok := infoFromContext(ctx); ok {
		e.info = i.data
		e.request = i.request
	}
	return e
}
958577
func (h PfssoHandler) addInfoToContext(ctx context.Context, info map[string]string) context.Context {
	return log.AddToLogContext(ctx, "username", info["username"], "ip", info["ip"], "mac", info["mac"], "role", info["role"])
}
1111328
func GetContext(ctx context.Context) context.Context {
	if ctx != nil {
		return ctx
	}
	return context.Background()
}
716826
func (api *Client) GetDNDInfoContext(ctx context.Context, user *string) (*DNDStatus, error) {
	values := url.Values{
		"token": {api.token},
	}
	if user != nil {
		values.Set("user", *user)
	}

	response, err := api.dndRequest(ctx, "dnd.info", values)
	if err != nil {
		return nil, err
	}
	return &response.DNDStatus, nil
}
206568
func (s *StatusEvent) GetContext() string {
	if s == nil || s.Context == nil {
		return ""
	}
	return *s.Context
}
1345331
func GetContextFromRequest(req *protos.Request, serverID string) (context.Context, error) {
	ctx, err := pcontext.Decode(req.GetMetadata())
	if err != nil {
		return nil, err
	}
	if ctx == nil {
		return nil, constants.ErrNoContextFound
	}
	tags := opentracing.Tags{
		"local.id":     serverID,
		"span.kind":    "server",
		"peer.id":      pcontext.GetFromPropagateCtx(ctx, constants.PeerIDKey),
		"peer.service": pcontext.GetFromPropagateCtx(ctx, constants.PeerServiceKey),
		"request.id":   pcontext.GetFromPropagateCtx(ctx, constants.RequestIDKey),
	}
	parent, err := tracing.ExtractSpan(ctx)
	if err != nil {
		logger.Log.Warnf("failed to retrieve parent span: %s", err.Error())
	}
	ctx = tracing.StartSpan(ctx, req.GetMsg().GetRoute(), tags, parent)
	ctx = CtxWithDefaultLogger(ctx, req.GetMsg().GetRoute(), "")
	return ctx, nil
}
858763
func (api *Client) GetReactionsContext(ctx context.Context, item ItemRef, params GetReactionsParameters) ([]ItemReaction, error) {
	values := url.Values{
		"token": {api.token},
	}
	if item.Channel != "" {
		values.Set("channel", item.Channel)
	}
	if item.Timestamp != "" {
		values.Set("timestamp", item.Timestamp)
	}
	if item.File != "" {
		values.Set("file", item.File)
	}
	if item.Comment != "" {
		values.Set("file_comment", item.Comment)
	}
	if params.Full != DEFAULT_REACTIONS_FULL {
		values.Set("full", strconv.FormatBool(params.Full))
	}

	response := &getReactionsResponseFull{}
	if err := api.postMethod(ctx, "reactions.get", values, response); err != nil {
		return nil, err
	}

	if err := response.Err(); err != nil {
		return nil, err
	}

	return response.extractReactions(), nil
}
715004
func getContext(marker interface{}) *context {
	globals.lockContexts.Lock()
	defer globals.lockContexts.Unlock()
	if globals.contexts == nil {
		return nil
	}
	c, ok := globals.contexts[marker]
	if !ok {
		return &consts.defaultContext
	}
	return c
}
153446
func getContext(inputFile, outputDir string) (*context, error) {
	if !strings.HasSuffix(inputFile, inputFileExt) {
		return nil, fmt.Errorf("invalid input file name: %q", inputFile)
	}

	ctx := &context{
		inputFile: inputFile,
	}

	// package name
	inputFileName := filepath.Base(inputFile)
	ctx.moduleName = inputFileName[:strings.Index(inputFileName, ".")]

	// alter package names for modules that are reserved keywords in Go
	switch ctx.moduleName {
	case "interface":
		ctx.packageName = "interfaces"
	case "map":
		ctx.packageName = "maps"
	default:
		ctx.packageName = ctx.moduleName
	}

	// output file
	packageDir := filepath.Join(outputDir, ctx.packageName)
	outputFileName := ctx.packageName + outputFileExt
	ctx.outputFile = filepath.Join(packageDir, outputFileName)

	return ctx, nil
}
779411
func (api *Client) GetChannelHistoryContext(ctx context.Context, channelID string, params HistoryParameters) (*History, error) {
	values := url.Values{
		"token":   {api.token},
		"channel": {channelID},
	}
	if params.Latest != DEFAULT_HISTORY_LATEST {
		values.Add("latest", params.Latest)
	}
	if params.Oldest != DEFAULT_HISTORY_OLDEST {
		values.Add("oldest", params.Oldest)
	}
	if params.Count != DEFAULT_HISTORY_COUNT {
		values.Add("count", strconv.Itoa(params.Count))
	}
	if params.Inclusive != DEFAULT_HISTORY_INCLUSIVE {
		if params.Inclusive {
			values.Add("inclusive", "1")
		} else {
			values.Add("inclusive", "0")
		}
	}

	if params.Unreads != DEFAULT_HISTORY_UNREADS {
		if params.Unreads {
			values.Add("unreads", "1")
		} else {
			values.Add("unreads", "0")
		}
	}

	response, err := api.channelRequest(ctx, "channels.history", values)
	if err != nil {
		return nil, err
	}
	return &response.History, nil
}