NewSession creates a new API session with the given project session.
(projectSession *project.Session, options *SessionOptions)
| 414 | |
| 415 | // NewSession creates a new API session with the given project session. |
| 416 | func NewSession(projectSession *project.Session, options *SessionOptions) *Session { |
| 417 | id := sessionIDCounter.Add(1) |
| 418 | s := &Session{ |
| 419 | id: formatSessionID(id), |
| 420 | projectSession: projectSession, |
| 421 | snapshots: make(map[SnapshotID]*snapshotData), |
| 422 | } |
| 423 | if options != nil { |
| 424 | s.useBinaryResponses = options.UseBinaryResponses |
| 425 | } |
| 426 | return s |
| 427 | } |
| 428 | |
| 429 | // ID returns the unique identifier for this session. |
| 430 | func (s *Session) ID() string { |