| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. |
| 4 |
| 5 package eventlog |
| 6 |
| 7 import "net/http" |
| 8 |
| 9 // A ClientOption is an optional argument to NewClient. |
| 10 type ClientOption interface { |
| 11 apply(*clientSettings) |
| 12 } |
| 13 |
| 14 type clientSettings struct { |
| 15 HTTPClient *http.Client |
| 16 } |
| 17 |
| 18 func (cs *clientSettings) Populate(opts []ClientOption) { |
| 19 } |
| 20 |
| 21 type httpClientOption struct { |
| 22 *http.Client |
| 23 } |
| 24 |
| 25 func (opt httpClientOption) apply(cs *clientSettings) { |
| 26 cs.HTTPClient = opt.Client |
| 27 } |
| 28 |
| 29 // WithHTTPClient returns a ClientOption that specifies the HTTP client to use a
s the basis of communications. |
| 30 func WithHTTPClient(client *http.Client) ClientOption { |
| 31 return httpClientOption{client} |
| 32 } |
| OLD | NEW |