Documentation
¶
Index ¶
- Constants
- Variables
- type Client
- func (m *Client) Do(req *http.Request) (*http.Response, error)
- func (c *Client) NewRequest(ctx context.Context, method, uri string, payload any, options ...RequestOption) (*http.Request, error)
- func (c *Client) RefreshTestData() error
- func (m *Client) Request(ctx context.Context, method, uri string, payload any, result any, ...) error
- func (c *Client) URL(parts ...string) string
- type ClientCredentialsEnv
- type ClientOption
- func WithClient(client *http.Client) ClientOption
- func WithClientCredentials(ctx context.Context, credEnv ClientCredentialsEnv, ...) ClientOption
- func WithEmulator(ctx context.Context, credEnv ClientCredentialsEnv, scopes ...Scope) ClientOption
- func WithStaticToken(token string) ClientOption
- func WithTokenSource(tokenSource oauth2.TokenSource) ClientOption
- type Error
- type ErrorCode
- type ErrorResponse
- type GroupClient
- func (m *GroupClient) AddMember(ctx context.Context, groupUID strfmt.UUID, member models.GroupMemberWrite, ...) (models.Wrapped[models.GroupMember], error)
- func (c *GroupClient) Create(ctx context.Context, aff W) (models.Wrapped[R], error)
- func (c *GroupClient) Find(ctx context.Context, opts ...RequestOption) (models.WrappedWithMeta[[]R], error)
- func (m *GroupClient) FindMembers(ctx context.Context, groupUID strfmt.UUID, opts ...RequestOption) (models.WrappedWithMeta[[]models.GroupMember], error)
- func (c *GroupClient) Get(ctx context.Context, uid strfmt.UUID, opts ...RequestOption) (models.Wrapped[R], error)
- func (m *GroupClient) GetMember(ctx context.Context, groupUID strfmt.UUID, memberUID strfmt.UUID, ...) (models.Wrapped[models.GroupMember], error)
- func (c *GroupClient) Remove(ctx context.Context, uid strfmt.UUID) (models.Wrapped[R], error)
- func (m *GroupClient) RemoveMember(ctx context.Context, groupUID strfmt.UUID, memberUID strfmt.UUID, ...) (models.Wrapped[models.GroupMember], error)
- func (c *GroupClient) Update(ctx context.Context, uid strfmt.UUID, aff W) (models.Wrapped[R], error)
- type QueryOpts
- type RequestOption
- func Fields(fields ...string) RequestOption
- func Filter(filter string) RequestOption
- func Limit(n int) RequestOption
- func Page(n int) RequestOption
- func QueryOptions(q QueryOpts) RequestOption
- func Search(s string) RequestOption
- func Skip(n int) RequestOption
- func Sort(sortFields ...string) RequestOption
- type Scope
Constants ¶
View Source
const ( AffiliationsPath = "/affiliations" ConsentsPath = "/consents" CountriesPath = "/countries" GroupsPath = "/groups" OrgsPath = "/v2/orgs" PersonsPath = "/v2/persons" RelationsPath = "/relations" RoleAssignmentsPath = "/roleAssignments" RolesPath = "/roles" )
View Source
const MemberPath = "/members"
View Source
const UrlDev = "https://dev-api.bcc.no"
View Source
const UrlProd = "https://api.bcc.no"
View Source
const UrlSandbox = "https://sandbox-api.bcc.no"
Variables ¶
View Source
var CredEnvDev = ClientCredentialsEnv{
TokenUrl: "https://bcc-sso-dev.eu.auth0.com/oauth/token",
Audience: "dev-api.bcc.no",
}
View Source
var CredEnvProd = ClientCredentialsEnv{
TokenUrl: "https://bcc-sso.eu.auth0.com/oauth/token",
Audience: "api.bcc.no",
}
View Source
var CredEnvSandbox = ClientCredentialsEnv{
TokenUrl: "https://bcc-sso-sandbox.eu.auth0.com/oauth/token",
Audience: "sandbox-api.bcc.no",
}
View Source
var DefaultAgent = fmt.Sprintf("Go-Coreapi/%s", Version)
View Source
var GroupPath = "/groups"
View Source
var Version = "0.1.0-alpha.2"
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Affiliation *genericClient[models.Affiliation, models.AffiliationWrite]
Consent *genericClient[models.Consent, models.ConsentWrite]
Country *genericClient[models.Country, models.CountryWrite]
Group *GroupClient
Org *genericClient[models.Org, models.OrgWrite]
Person *genericClient[models.Person, models.PersonWrite]
Relation *genericClient[models.Relation, models.RelationWrite]
RoleAssignment *genericClient[models.RoleAssignment, models.RoleAssignmentWrite]
Role *genericClient[models.Role, models.RoleWrite]
// contains filtered or unexported fields
}
func New ¶
func New(url string, options ...ClientOption) *Client
func (*Client) Do ¶
Do triggers an HTTP request and returns an HTTP response, handling any context cancellations or timeouts.
func (*Client) NewRequest ¶
func (*Client) RefreshTestData ¶
Resets test data, only available if the SDK is run against the emulator
type ClientCredentialsEnv ¶
type ClientOption ¶
type ClientOption func(*Client)
func WithClient ¶
func WithClient(client *http.Client) ClientOption
WithClient configures the SDK to use the provided client.
func WithClientCredentials ¶
func WithClientCredentials(ctx context.Context, credEnv ClientCredentialsEnv, clientID, clientSecret string, scopes ...Scope) ClientOption
WithClientCredentials configures the SDK to authenticate using the client credentials authentication flow.
func WithEmulator ¶
func WithEmulator(ctx context.Context, credEnv ClientCredentialsEnv, scopes ...Scope) ClientOption
WithClientCredentials configures the SDK to authenticate using the client credentials authentication flow against the emulator.
func WithStaticToken ¶
func WithStaticToken(token string) ClientOption
WithClientCredentials configures the SDK to authenticate using the provided token
func WithTokenSource ¶
func WithTokenSource(tokenSource oauth2.TokenSource) ClientOption
WithClientCredentials configures the SDK to authenticate using the provided token source
type ErrorCode ¶
type ErrorCode string
const ( ErrorCodeNotFound ErrorCode = "not-found" ErrorCodeInvalidQuery ErrorCode = "invalid-query" ErrorCodeInvalidBody ErrorCode = "invalid-body" ErrorCodeInvalidKeyReference ErrorCode = "invalid-key-reference" ErrorCodeDuplicateUniqueKey ErrorCode = "duplicate-unique-key" ErrorCodeCannotParseToken ErrorCode = "cannot-parse-token" ErrorCodeInvalidToken ErrorCode = "invalid-token" ErrorCodeMissingScopes ErrorCode = "missing-scopes" ErrorCodeInternalError ErrorCode = "internal-error" ErrorCodeInvalidAppUID ErrorCode = "invalid-app-uid" ErrorCodeUnknownErrorResponse ErrorCode = "unknown-error-response" )
type ErrorResponse ¶
type ErrorResponse struct {
Error Error `json:"error"`
}
type GroupClient ¶
type GroupClient struct {
// contains filtered or unexported fields
}
func (*GroupClient) AddMember ¶
func (m *GroupClient) AddMember(ctx context.Context, groupUID strfmt.UUID, member models.GroupMemberWrite, opts ...RequestOption) (models.Wrapped[models.GroupMember], error)
func (*GroupClient) Find ¶
func (c *GroupClient) Find(ctx context.Context, opts ...RequestOption) (models.WrappedWithMeta[[]R], error)
func (*GroupClient) FindMembers ¶
func (m *GroupClient) FindMembers(ctx context.Context, groupUID strfmt.UUID, opts ...RequestOption) (models.WrappedWithMeta[[]models.GroupMember], error)
func (*GroupClient) GetMember ¶
func (m *GroupClient) GetMember(ctx context.Context, groupUID strfmt.UUID, memberUID strfmt.UUID, opts ...RequestOption) (models.Wrapped[models.GroupMember], error)
func (*GroupClient) RemoveMember ¶
func (m *GroupClient) RemoveMember(ctx context.Context, groupUID strfmt.UUID, memberUID strfmt.UUID, opts ...RequestOption) (models.Wrapped[models.GroupMember], error)
type RequestOption ¶
func Fields ¶
func Fields(fields ...string) RequestOption
func Filter ¶
func Filter(filter string) RequestOption
func Limit ¶
func Limit(n int) RequestOption
func Page ¶
func Page(n int) RequestOption
func QueryOptions ¶
func QueryOptions(q QueryOpts) RequestOption
func Search ¶
func Search(s string) RequestOption
func Skip ¶
func Skip(n int) RequestOption
func Sort ¶
func Sort(sortFields ...string) RequestOption
type Scope ¶
type Scope string
const ( ScopePersonsRead Scope = "persons#read" ScopePersonsNameRead Scope = "persons.name#read" ScopePersonsBirthDateRead Scope = "persons.birth_date#read" ScopePersonsDeceasedDateRead Scope = "persons.deceased_date#read" ScopePersonsNationalIdsRead Scope = "persons.national_ids#read" ScopePersonsGenderRead Scope = "persons.gender#read" ScopePersonsEmailRead Scope = "persons.email#read" ScopePersonsPhoneRead Scope = "persons.phone#read" ScopePersonsPreferencesRead Scope = "persons.preferences#read" ScopePersonsAddressRead Scope = "persons.address#read" ScopePersonsProfilePictureRead Scope = "persons.profile_picture#read" ScopePersonAffiliationsRead Scope = "persons.affiliations#read" ScopePersonRelationsRead Scope = "persons.relations#read" ScopePersonConsentsRead Scope = "persons.consents#read" ScopePersonRoleAssignmentsRead Scope = "persons.role_assignments#read" ScopePersonPersonIdRead Scope = "persons.person_id#read" ScopeOrgsRead Scope = "orgs#read" ScopeCountriesRead Scope = "countries#read" ScopeRolesRead Scope = "roles#read" ScopeGroupsRead Scope = "groups#read" ScopePersonsWrite Scope = "persons#write" ScopePersonAffiliationsWrite Scope = "persons.affiliations#write" ScopePersonRelationsWrite Scope = "persons.relations#write" ScopePersonConsentsWrite Scope = "persons.consents#write" ScopePersonRoleAssignmentsWrite Scope = "persons.role_assignments#write" ScopeOrgsWrite Scope = "orgs#write" ScopeCountriesWrite Scope = "countries#write" ScopeRolesWrite Scope = "roles#write" ScopeGroupsWrite Scope = "groups#write" )
Click to show internal directories.
Click to hide internal directories.