Skip to content

Commit

Permalink
Release organization metrics API (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
logan-stytch authored Apr 4, 2024
1 parent a6dbea7 commit 352abd1
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/stytch/b2b_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@
require_relative 'b2b_sso'
require_relative 'b2b_totps'
require_relative 'm2m'
require_relative 'project'
require_relative 'rbac_local'

module StytchB2B
class Client
ENVIRONMENTS = %i[live test].freeze

attr_reader :discovery, :m2m, :magic_links, :oauth, :otps, :organizations, :passwords, :rbac, :recovery_codes, :scim, :sso, :sessions, :totps
attr_reader :discovery, :m2m, :magic_links, :oauth, :otps, :organizations, :passwords, :project, :rbac, :recovery_codes, :scim, :sso, :sessions, :totps

def initialize(project_id:, secret:, env: nil, &block)
@api_host = api_host(env, project_id)
Expand All @@ -38,6 +39,7 @@ def initialize(project_id:, secret:, env: nil, &block)
@otps = StytchB2B::OTPs.new(@connection)
@organizations = StytchB2B::Organizations.new(@connection)
@passwords = StytchB2B::Passwords.new(@connection)
@project = Stytch::Project.new(@connection)
@rbac = StytchB2B::RBAC.new(@connection)
@recovery_codes = StytchB2B::RecoveryCodes.new(@connection)
@scim = StytchB2B::SCIM.new(@connection)
Expand Down
9 changes: 9 additions & 0 deletions lib/stytch/b2b_organizations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,15 @@ def search(
post_request('/v1/b2b/organizations/search', request, headers)
end

def metrics(
organization_id:
)
headers = {}
query_params = {}
request = request_with_query_params("/v1/b2b/organizations/#{organization_id}/metrics", query_params)
get_request(request, headers)
end

class Members
include Stytch::RequestHelper
attr_reader :oauth_providers
Expand Down
4 changes: 3 additions & 1 deletion lib/stytch/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
require_relative 'oauth'
require_relative 'otps'
require_relative 'passwords'
require_relative 'project'
require_relative 'sessions'
require_relative 'totps'
require_relative 'users'
Expand All @@ -15,7 +16,7 @@ module Stytch
class Client
ENVIRONMENTS = %i[live test].freeze

attr_reader :crypto_wallets, :m2m, :magic_links, :oauth, :otps, :passwords, :sessions, :totps, :users, :webauthn
attr_reader :crypto_wallets, :m2m, :magic_links, :oauth, :otps, :passwords, :project, :sessions, :totps, :users, :webauthn

def initialize(project_id:, secret:, env: nil, &block)
@api_host = api_host(env, project_id)
Expand All @@ -30,6 +31,7 @@ def initialize(project_id:, secret:, env: nil, &block)
@oauth = Stytch::OAuth.new(@connection)
@otps = Stytch::OTPs.new(@connection)
@passwords = Stytch::Passwords.new(@connection)
@project = Stytch::Project.new(@connection)
@sessions = Stytch::Sessions.new(@connection, @project_id)
@totps = Stytch::TOTPs.new(@connection)
@users = Stytch::Users.new(@connection)
Expand Down
26 changes: 26 additions & 0 deletions lib/stytch/project.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# frozen_string_literal: true

# !!!
# WARNING: This file is autogenerated
# Only modify code within MANUAL() sections
# or your changes may be overwritten later!
# !!!

require_relative 'request_helper'

module Stytch
class Project
include Stytch::RequestHelper

def initialize(connection)
@connection = connection
end

def metrics
headers = {}
query_params = {}
request = request_with_query_params('/v1/projects/metrics', query_params)
get_request(request, headers)
end
end
end
2 changes: 1 addition & 1 deletion lib/stytch/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Stytch
VERSION = '7.6.0'
VERSION = '7.7.0'
end

0 comments on commit 352abd1

Please sign in to comment.