// GetWithContext populates the given resource or fails
164733
func (client *Client) GetWithContext(ctx context.Context, ls Listable) (interface{}, error) {
	gs, err := client.ListWithContext(ctx, ls)
	if err != nil {
		return nil, err
	}

	count := len(gs)
	if count != 1 {
		req, err := ls.ListRequest()
		if err != nil {
			return nil, err
		}
		params, err := client.Payload(req)
		if err != nil {
			return nil, err
		}

		// removing sensitive/useless informations
		params.Del("expires")
		params.Del("response")
		params.Del("signature")
		params.Del("signatureversion")

		// formatting the query string nicely
		payload := params.Encode()
		payload = strings.Replace(payload, "&", ", ", -1)

		if count == 0 {
			return nil, &ErrorResponse{
				CSErrorCode: ServerAPIException,
				ErrorCode:   ParamError,
				ErrorText:   fmt.Sprintf("not found, query: %s", payload),
			}
		}
		return nil, fmt.Errorf("more than one element found: %s", payload)
	}

	return gs[0], nil
}
887701
func (q *Query) WithContext(ctx context.Context) *Query {
	q2 := *q
	q2.context = ctx
	return &q2
}
892486
func (o *GetIDParams) WithContext(ctx context.Context) *GetIDParams {
	o.SetContext(ctx)
	return o
}
790491
func (o *FindParams) WithContext(ctx context.Context) *FindParams {
	o.SetContext(ctx)
	return o
}
1069828
func WithContext(ctx context.Context) func(*Client) error {
	return func(c *Client) error {
		c.Ctx = ctx
		return nil
	}
}
598963
func (l *Logger) GetContext(key string) (interface{}, bool) {
	l.globalsL.RLock()
	defer l.globalsL.RUnlock()
	val, ok := l.globals[key]
	return val, ok
}
1197534
func (call *GetMessageQuotaCall) WithContext(ctx context.Context) *GetMessageQuotaCall {
	call.ctx = ctx
	return call
}
1218401
func (call *GetRoomMemberIDsCall) WithContext(ctx context.Context) *GetRoomMemberIDsCall {
	call.ctx = ctx
	return call
}
591463
func (o *GetServiceIDParams) WithContext(ctx context.Context) *GetServiceIDParams {
	o.SetContext(ctx)
	return o
}
1069975
func (o *UpdateOAuth2ClientParams) WithContext(ctx context.Context) *UpdateOAuth2ClientParams {
	o.SetContext(ctx)
	return o
}
715217
func (o *ListOAuth2ClientsParams) WithContext(ctx context.Context) *ListOAuth2ClientsParams {
	o.SetContext(ctx)
	return o
}
1055689
func (q *ModelQuery) WithContext(ctx context.Context) *ModelQuery {
	q.ctx = ctx
	return q
}
103227
func WithContext(ctx context.Context) FeatureOption {
	return func(opts *featureOption) {
		opts.ctx = &ctx
	}
}
396189
func (o *GetIdentityIDParams) WithContext(ctx context.Context) *GetIdentityIDParams {
	o.SetContext(ctx)
	return o
}
709835
func (call *GetMessageContentCall) WithContext(ctx context.Context) *GetMessageContentCall {
	call.ctx = ctx
	return call
}
449321
func (builder *UpdateSetCommandBuilder) WithContext(context []byte) *UpdateSetCommandBuilder {
	builder.protobuf.Context = context
	return builder
}
876258
func (call *GetLIFFAllCall) WithContext(ctx context.Context) *GetLIFFAllCall {
	call.ctx = ctx
	return call
}