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 Oct 11, 2024
0 parents commit 33b4a44
Show file tree
Hide file tree
Showing 34 changed files with 4,805 additions and 0 deletions.
1 change: 1 addition & 0 deletions .fernignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Specify files that shouldn't be modified by Fern
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
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 ./...
21 changes: 21 additions & 0 deletions LICENSE
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.
43 changes: 43 additions & 0 deletions client/client.go
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...),
}
}
45 changes: 45 additions & 0 deletions client/client_test.go
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"))
})
}
Loading

0 comments on commit 33b4a44

Please sign in to comment.