Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate API interface, expose underlying "Teams" client #154

Closed
atc0005 opened this issue Feb 25, 2022 · 0 comments · Fixed by #155
Closed

Deprecate API interface, expose underlying "Teams" client #154

atc0005 opened this issue Feb 25, 2022 · 0 comments · Fixed by #155
Assignees
Labels
api documentation Improvements or additions to documentation enhancement New feature or request
Milestone

Comments

@atc0005
Copy link
Owner

atc0005 commented Feb 25, 2022

Overview

As mentioned in GH-149:

Next steps

A real challenge in the current package design is that it exposes the API interface instead of a concrete type. In order to expose the functionality added by #134 and #135, we'll need to expose the "client" (renaming teamsClient to TeamsClient) or provide a new variation of the API interface (e.g., APIv2).

and on https://go.dev/blog/module-compatibility:

Sometimes, new features require changes to publicly-exposed interfaces: for example, an interface needs to be extended with new methods. Directly adding to an interface is a breaking change, though—how, then, can we support new methods on a publicly-exposed interface?

The basic idea is to define a new interface with the new method, and then wherever the old interface is used, dynamically check whether the provided type is the older type or the newer type.

Overall, I feel the current API interface is too limiting. Based on the module compatibility guidelines, any new functionality that we add constitutes a breaking change. While doable, it doesn't seem like bumping a major version in order to add a minor change is really feasible. Instead, I plan to expose the underlying client in an effort to grow functionality and still maintain backwards compatibility with existing client code.

Goals

  • deprecate the current API interface
  • expose TeamsClient to take its place
  • create common interfaces and helper code to abstract specific Microsoft Teams message formats
  • update examples to reflect changes
  • restore support for overriding default http.Client
  • restore default project-specific user agent, support for overriding the default from client code
  • create "subpackages" to group functionality for specific message formats
@atc0005 atc0005 added documentation Improvements or additions to documentation enhancement New feature or request api labels Feb 25, 2022
@atc0005 atc0005 added this to the v2.7.0 milestone Feb 25, 2022
@atc0005 atc0005 self-assigned this Feb 25, 2022
atc0005 added a commit that referenced this issue Feb 25, 2022
Summary:

- deprecate the current `API` interface
- expose `TeamsClient` to take its place
- create common interfaces and helper code to abstract any specific
  Microsoft Teams message format
- create new `botapi` package (limited functionality)
- extend existing `MessageCard` type (where needed) type to support
  new behavior
- port existing `goteamsnotify.MessageCard` types/functions/methods to
  a new `messagecard` package and deprecate existing `MessageCard`
  functionality provided by the `goteamsnotify` "base" package
- update examples to reflect changes
- restore support for overriding default `http.Client`
- restore default project-specific user agent, support for
  overriding the default from client code

While making these changes I've refactored code and attempted to
clearly communicate which existing code/functionality is being
deprecated, all without introducing breaking changes for client code.

The `botapi` package added in this collection of changes is a minimal
implementation. This package is intended to provide limited user
mention functionality for channel updates as a "bridge" until future
`Adaptive Card` support can be implemented.

A future implementation of `Adaptive Card` support would provide a
more complete experience, presumably providing a superset of the
limited support in the `botapi` package and existing `MessageCard`
functionality.

refs GH-127
refs GH-134
refs GH-135
refs GH-154
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant