-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 33b4a44
Showing
34 changed files
with
4,805 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Specify files that shouldn't be modified by Fern |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: ci | ||
|
||
on: [push] | ||
|
||
jobs: | ||
compile: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up go | ||
uses: actions/setup-go@v4 | ||
|
||
- name: Compile | ||
run: go build ./... | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up go | ||
uses: actions/setup-go@v4 | ||
|
||
- name: Test | ||
run: go test ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Ssoready. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// This file was auto-generated by Fern from our API Definition. | ||
|
||
package client | ||
|
||
import ( | ||
core "github.com/ssoready/ssoready-go/core" | ||
managementclient "github.com/ssoready/ssoready-go/management/client" | ||
option "github.com/ssoready/ssoready-go/option" | ||
saml "github.com/ssoready/ssoready-go/saml" | ||
scim "github.com/ssoready/ssoready-go/scim" | ||
http "net/http" | ||
os "os" | ||
) | ||
|
||
type Client struct { | ||
baseURL string | ||
caller *core.Caller | ||
header http.Header | ||
|
||
SAML *saml.Client | ||
Scim *scim.Client | ||
Management *managementclient.Client | ||
} | ||
|
||
func NewClient(opts ...option.RequestOption) *Client { | ||
options := core.NewRequestOptions(opts...) | ||
if options.APIKey == "" { | ||
options.APIKey = os.Getenv("SSOREADY_API_KEY") | ||
} | ||
return &Client{ | ||
baseURL: options.BaseURL, | ||
caller: core.NewCaller( | ||
&core.CallerParams{ | ||
Client: options.HTTPClient, | ||
MaxAttempts: options.MaxAttempts, | ||
}, | ||
), | ||
header: options.ToHeader(), | ||
SAML: saml.NewClient(opts...), | ||
Scim: scim.NewClient(opts...), | ||
Management: managementclient.NewClient(opts...), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// This file was auto-generated by Fern from our API Definition. | ||
|
||
package client | ||
|
||
import ( | ||
option "github.com/ssoready/ssoready-go/option" | ||
assert "github.com/stretchr/testify/assert" | ||
http "net/http" | ||
testing "testing" | ||
time "time" | ||
) | ||
|
||
func TestNewClient(t *testing.T) { | ||
t.Run("default", func(t *testing.T) { | ||
c := NewClient() | ||
assert.Empty(t, c.baseURL) | ||
}) | ||
|
||
t.Run("base url", func(t *testing.T) { | ||
c := NewClient( | ||
option.WithBaseURL("test.co"), | ||
) | ||
assert.Equal(t, "test.co", c.baseURL) | ||
}) | ||
|
||
t.Run("http client", func(t *testing.T) { | ||
httpClient := &http.Client{ | ||
Timeout: 5 * time.Second, | ||
} | ||
c := NewClient( | ||
option.WithHTTPClient(httpClient), | ||
) | ||
assert.Empty(t, c.baseURL) | ||
}) | ||
|
||
t.Run("http header", func(t *testing.T) { | ||
header := make(http.Header) | ||
header.Set("X-API-Tenancy", "test") | ||
c := NewClient( | ||
option.WithHTTPHeader(header), | ||
) | ||
assert.Empty(t, c.baseURL) | ||
assert.Equal(t, "test", c.header.Get("X-API-Tenancy")) | ||
}) | ||
} |
Oops, something went wrong.