Skip to content

Commit

Permalink
SDK regeneration
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Feb 2, 2024
1 parent f92df06 commit 9b16f10
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 25 deletions.
2 changes: 1 addition & 1 deletion core/client_option.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ func (c *ClientOptions) cloneHeader() http.Header {
headers := c.HTTPHeader.Clone()
headers.Set("X-Fern-Language", "Go")
headers.Set("X-Fern-SDK-Name", "github.com/trycourier/courier-go/v3")
headers.Set("X-Fern-SDK-Version", "v3.0.1")
headers.Set("X-Fern-SDK-Version", "v3.0.2")
return headers
}
106 changes: 82 additions & 24 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -6389,6 +6389,35 @@ func (m *Metadata) String() string {
return fmt.Sprintf("%#v", m)
}

type MsTeamsRecipient struct {
MsTeams *MsTeams `json:"ms_teams,omitempty"`

_rawJSON json.RawMessage
}

func (m *MsTeamsRecipient) UnmarshalJSON(data []byte) error {
type unmarshaler MsTeamsRecipient
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*m = MsTeamsRecipient(value)
m._rawJSON = json.RawMessage(data)
return nil
}

func (m *MsTeamsRecipient) String() string {
if len(m._rawJSON) > 0 {
if value, err := core.StringifyJSON(m._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(m); err == nil {
return value
}
return fmt.Sprintf("%#v", m)
}

type Override string

const (
Expand Down Expand Up @@ -6478,8 +6507,8 @@ type Recipient struct {
ListRecipient *ListRecipient
ListPatternRecipient *ListPatternRecipient
UserRecipient *UserRecipient
Slack *Slack
MsTeams *MsTeams
SlackRecipient *SlackRecipient
MsTeamsRecipient *MsTeamsRecipient
}

func NewRecipientFromAudienceRecipient(value *AudienceRecipient) *Recipient {
Expand All @@ -6498,12 +6527,12 @@ func NewRecipientFromUserRecipient(value *UserRecipient) *Recipient {
return &Recipient{typeName: "userRecipient", UserRecipient: value}
}

func NewRecipientFromSlack(value *Slack) *Recipient {
return &Recipient{typeName: "slack", Slack: value}
func NewRecipientFromSlackRecipient(value *SlackRecipient) *Recipient {
return &Recipient{typeName: "slackRecipient", SlackRecipient: value}
}

func NewRecipientFromMsTeams(value *MsTeams) *Recipient {
return &Recipient{typeName: "msTeams", MsTeams: value}
func NewRecipientFromMsTeamsRecipient(value *MsTeamsRecipient) *Recipient {
return &Recipient{typeName: "msTeamsRecipient", MsTeamsRecipient: value}
}

func (r *Recipient) UnmarshalJSON(data []byte) error {
Expand Down Expand Up @@ -6531,16 +6560,16 @@ func (r *Recipient) UnmarshalJSON(data []byte) error {
r.UserRecipient = valueUserRecipient
return nil
}
valueSlack := new(Slack)
if err := json.Unmarshal(data, &valueSlack); err == nil {
r.typeName = "slack"
r.Slack = valueSlack
valueSlackRecipient := new(SlackRecipient)
if err := json.Unmarshal(data, &valueSlackRecipient); err == nil {
r.typeName = "slackRecipient"
r.SlackRecipient = valueSlackRecipient
return nil
}
valueMsTeams := new(MsTeams)
if err := json.Unmarshal(data, &valueMsTeams); err == nil {
r.typeName = "msTeams"
r.MsTeams = valueMsTeams
valueMsTeamsRecipient := new(MsTeamsRecipient)
if err := json.Unmarshal(data, &valueMsTeamsRecipient); err == nil {
r.typeName = "msTeamsRecipient"
r.MsTeamsRecipient = valueMsTeamsRecipient
return nil
}
return fmt.Errorf("%s cannot be deserialized as a %T", data, r)
Expand All @@ -6558,10 +6587,10 @@ func (r Recipient) MarshalJSON() ([]byte, error) {
return json.Marshal(r.ListPatternRecipient)
case "userRecipient":
return json.Marshal(r.UserRecipient)
case "slack":
return json.Marshal(r.Slack)
case "msTeams":
return json.Marshal(r.MsTeams)
case "slackRecipient":
return json.Marshal(r.SlackRecipient)
case "msTeamsRecipient":
return json.Marshal(r.MsTeamsRecipient)
}
}

Expand All @@ -6570,8 +6599,8 @@ type RecipientVisitor interface {
VisitListRecipient(*ListRecipient) error
VisitListPatternRecipient(*ListPatternRecipient) error
VisitUserRecipient(*UserRecipient) error
VisitSlack(*Slack) error
VisitMsTeams(*MsTeams) error
VisitSlackRecipient(*SlackRecipient) error
VisitMsTeamsRecipient(*MsTeamsRecipient) error
}

func (r *Recipient) Accept(visitor RecipientVisitor) error {
Expand All @@ -6586,10 +6615,10 @@ func (r *Recipient) Accept(visitor RecipientVisitor) error {
return visitor.VisitListPatternRecipient(r.ListPatternRecipient)
case "userRecipient":
return visitor.VisitUserRecipient(r.UserRecipient)
case "slack":
return visitor.VisitSlack(r.Slack)
case "msTeams":
return visitor.VisitMsTeams(r.MsTeams)
case "slackRecipient":
return visitor.VisitSlackRecipient(r.SlackRecipient)
case "msTeamsRecipient":
return visitor.VisitMsTeamsRecipient(r.MsTeamsRecipient)
}
}

Expand Down Expand Up @@ -6814,6 +6843,35 @@ func (r RuleType) Ptr() *RuleType {
return &r
}

type SlackRecipient struct {
Slack *Slack `json:"slack,omitempty"`

_rawJSON json.RawMessage
}

func (s *SlackRecipient) UnmarshalJSON(data []byte) error {
type unmarshaler SlackRecipient
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*s = SlackRecipient(value)
s._rawJSON = json.RawMessage(data)
return nil
}

func (s *SlackRecipient) String() string {
if len(s._rawJSON) > 0 {
if value, err := core.StringifyJSON(s._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(s); err == nil {
return value
}
return fmt.Sprintf("%#v", s)
}

type TemplateMessage struct {
// An arbitrary object that includes any data you want to pass to the message.
// The data will populate the corresponding template or elements variables.
Expand Down
23 changes: 23 additions & 0 deletions users/tenants/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,29 @@ func (c *Client) Add(ctx context.Context, userId string, tenantId string, reques
return nil
}

// Removes a user from any tenants they may have been associated with.
//
// Id of the user to be removed from the supplied tenant.
func (c *Client) RemoveAll(ctx context.Context, userId string) error {
baseURL := "https://api.courier.com"
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := fmt.Sprintf(baseURL+"/"+"users/%v/tenants", userId)

if err := c.caller.Call(
ctx,
&core.CallParams{
URL: endpointURL,
Method: http.MethodDelete,
Headers: c.header,
},
); err != nil {
return err
}
return nil
}

// Removes a user from the supplied tenant.
//
// Id of the user to be removed from the supplied tenant.
Expand Down

0 comments on commit 9b16f10

Please sign in to comment.