Documentation
¶
Index ¶
- Constants
- Variables
- type Address
- type Affiliation
- type AffiliationManager
- type AffiliationType
- 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 (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 ...string) ClientOption
- func WithStaticToken(token string) ClientOption
- func WithTokenSource(tokenSource oauth2.TokenSource) ClientOption
- type Consent
- type ConsentManager
- type ConsentPurpose
- type Country
- type CountryManager
- type Error
- type ErrorCode
- type ErrorResponse
- type Gender
- type Grant
- type Group
- type GroupManager
- func (m *GroupManager) Find(ctx context.Context, opts ...RequestOption) (ResponseWithMeta[[]Group], error)
- func (m *GroupManager) FindMembers(ctx context.Context, groupUid uuid.UUID, opts ...RequestOption) (ResponseWithMeta[[]GroupMember], error)
- func (m *GroupManager) Get(ctx context.Context, uid uuid.UUID, opts ...RequestOption) (Response[Group], error)
- func (m *GroupManager) GetMember(ctx context.Context, groupUid uuid.UUID, memberUid uuid.UUID, ...) (Response[GroupMember], error)
- type GroupMember
- type GroupType
- type MaritalStatus
- type Meta
- type NationalId
- type Org
- type OrgActiveStatus
- type OrgManager
- type OrgType
- type Person
- type PersonManager
- type PersonRelation
- type PersonRelationType
- type Preferences
- type QueryOpts
- type Relation
- type RelationManager
- type RelationType
- 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 Response
- type ResponseWithMeta
- type Role
- type RoleAssignment
- type RoleAssignmentManager
- type RoleManager
- type RoleScope
- type SearchVisibility
- type VisibilityPreferences
Constants ¶
const ( PersonsRead = "persons#read" PersonsNameRead = "persons.name#read" PersonsBirthDateRead = "persons.birth_date#read" PersonsDeceasedDateRead = "persons.deceased_date#read" PersonsNationalIdsRead = "persons.national_ids#read" PersonsGenderRead = "persons.gender#read" PersonsEmailRead = "persons.email#read" PersonsPhoneRead = "persons.phone#read" PersonsPreferencesRead = "persons.preferences#read" PersonsAddressRead = "persons.address#read" PersonsProfilePictureRead = "persons.profile_picture#read" PersonAffiliationsRead = "persons.affiliations#read" PersonRelationsRead = "persons.relations#read" PersonConsentsRead = "persons.consents#read" PersonRoleAssignmentsRead = "persons.role_assignments#read" PersonPersonIdRead = "persons.person_id#read" OrgsRead = "orgs#read" CountriesRead = "countries#read" RolesRead = "roles#read" GroupsRead = "groups#read" )
const UrlDev = "https://dev-api.bcc.no"
const UrlProd = "https://api.bcc.no"
const UrlSandbox = "https://sandbox-api.bcc.no"
Variables ¶
var AffiliationPath = "/affiliations"
var ConsentPath = "/consents"
var CountryPath = "/countries"
var CredEnvDev = ClientCredentialsEnv{
TokenUrl: "https://bcc-sso-dev.eu.auth0.com/oauth/token",
Audience: "dev-api.bcc.no",
}
var CredEnvProd = ClientCredentialsEnv{
TokenUrl: "https://bcc-sso.eu.auth0.com/oauth/token",
Audience: "api.bcc.no",
}
var CredEnvSandbox = ClientCredentialsEnv{
TokenUrl: "https://bcc-sso-sandbox.eu.auth0.com/oauth/token",
Audience: "sandbox-api.bcc.no",
}
var DefaultAgent = fmt.Sprintf("Go-Coreapi/%s", Version)
var GroupPath = "/groups"
var MemberPath = "/members"
var OrgPath = "/v2/orgs"
var PersonPath = "/v2/persons"
var RelationPath = "/relations"
var RoleAssignmentPath = "/roleAssignments"
var RolePath = "/roles"
var Version = "0.0.0-alpha.7"
Functions ¶
This section is empty.
Types ¶
type Affiliation ¶
type Affiliation struct {
Uid uuid.UUID `json:"uid"`
LastChangedDate time.Time `json:"lastChangedDate"`
Org *Org `json:"org"`
Person *Person `json:"person"`
PersonUid uuid.UUID `json:"personUid"`
OrgUid uuid.UUID `json:"orgUid"`
Type AffiliationType `json:"type"`
ValidFrom time.Time `json:"validFrom"`
ValidTo *time.Time `json:"validTo"`
}
type AffiliationManager ¶
type AffiliationManager managerBase
func (*AffiliationManager) Find ¶
func (m *AffiliationManager) Find(ctx context.Context, opts ...RequestOption) (ResponseWithMeta[[]Affiliation], error)
func (*AffiliationManager) Get ¶
func (m *AffiliationManager) Get(ctx context.Context, uid uuid.UUID, opts ...RequestOption) (Response[Affiliation], error)
type AffiliationType ¶
type AffiliationType string
const ( AffiliationTypeMember AffiliationType = "Member" AffiliationTypeAffiliate AffiliationType = "Affiliate" AffiliationTypeParticipant AffiliationType = "Participant" )
type Client ¶
type Client struct {
Affiliation *AffiliationManager
Consent *ConsentManager
Country *CountryManager
Group *GroupManager
Org *OrgManager
Person *PersonManager
Relation *RelationManager
RoleAssignment *RoleAssignmentManager
Role *RoleManager
// 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 ¶
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 ...string) ClientOption
WithClientCredentials configures the SDK to authenticate using the client credentials authentication flow.
func WithEmulator ¶
func WithEmulator(ctx context.Context, credEnv ClientCredentialsEnv, scopes ...string) 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 Consent ¶
type Consent struct {
Uid uuid.UUID `json:"uid"`
LastChangedDate time.Time `json:"lastChangedDate"`
Person *Person `json:"person"`
Org *Org `json:"org"`
PersonUid uuid.UUID `json:"personUid"`
OrgUid uuid.UUID `json:"orgUid"`
Purpose ConsentPurpose `json:"purpose"`
ValidFrom time.Time `json:"validFrom"`
ValidTo *time.Time `json:"validTo"`
}
type ConsentManager ¶
type ConsentManager managerBase
func (*ConsentManager) Find ¶
func (m *ConsentManager) Find(ctx context.Context, opts ...RequestOption) (ResponseWithMeta[[]Consent], error)
type ConsentPurpose ¶
type ConsentPurpose string
const ( ConsentPurposeDataSharing ConsentPurpose = "DataSharing" ConsentPurposeTracking ConsentPurpose = "Tracking" )
type CountryManager ¶
type CountryManager managerBase
func (*CountryManager) Find ¶
func (m *CountryManager) Find(ctx context.Context, opts ...RequestOption) (ResponseWithMeta[[]Country], error)
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 GroupManager ¶
type GroupManager managerBase
func (*GroupManager) Find ¶
func (m *GroupManager) Find(ctx context.Context, opts ...RequestOption) (ResponseWithMeta[[]Group], error)
func (*GroupManager) FindMembers ¶
func (m *GroupManager) FindMembers(ctx context.Context, groupUid uuid.UUID, opts ...RequestOption) (ResponseWithMeta[[]GroupMember], error)
func (*GroupManager) Get ¶
func (m *GroupManager) Get(ctx context.Context, uid uuid.UUID, opts ...RequestOption) (Response[Group], error)
func (*GroupManager) GetMember ¶
func (m *GroupManager) GetMember(ctx context.Context, groupUid uuid.UUID, memberUid uuid.UUID, opts ...RequestOption) (Response[GroupMember], error)
type GroupMember ¶
type MaritalStatus ¶
type MaritalStatus string
ENUM(Single, Married, Widowed, Separated, SingleParent, Unknown)
const ( MaritalStatusSingle MaritalStatus = "Single" MaritalStatusMarried MaritalStatus = "Married" MaritalStatusWidowed MaritalStatus = "Widowed" MaritalStatusSeparated MaritalStatus = "Separated" MaritalStatusSingleParent MaritalStatus = "SingleParent" MaritalStatusUnknown MaritalStatus = "Unknown" )
type NationalId ¶
type Org ¶
type Org struct {
Uid uuid.UUID `json:"uid"`
OrgID int `json:"orgID"`
LastChangedDate time.Time `json:"lastChangedDate"`
Name string `json:"name"`
DistrictName string `json:"districtName"`
Type OrgType `json:"type"`
ActiveStatus OrgActiveStatus `json:"activeStatus"`
PostalAddress Address `json:"postalAddress"`
BillingAddress Address `json:"billingAddress"`
VisitingAddress Address `json:"visitingAddress"`
}
type OrgActiveStatus ¶
type OrgActiveStatus string
const ( OrgActiveStatusActive OrgActiveStatus = "Active" OrgActiveStatusInactive OrgActiveStatus = "Inactive" )
type OrgManager ¶
type OrgManager managerBase
func (*OrgManager) Find ¶
func (m *OrgManager) Find(ctx context.Context, opts ...RequestOption) (ResponseWithMeta[[]Org], error)
type Person ¶
type Person struct {
Uid uuid.UUID `json:"uid"`
PersonID int `json:"personID"`
Affiliations []Affiliation `json:"affiliations"`
Relations []PersonRelation `json:"relations"`
Consents []Consent `json:"consents"`
RoleAssignments []RoleAssignment `json:"roleAssignments"`
LastChangedDate time.Time `json:"lastChangedDate"`
FirstName string `json:"firstName"`
MiddleName string `json:"middleName"`
LastName string `json:"lastName"`
DisplayName string `json:"displayName"`
BirthDate civil.Date `json:"birthDate"`
DeceasedDate civil.Date `json:"deceasedDate"`
Gender Gender `json:"gender"`
MaritalStatus MaritalStatus `json:"maritalStatus"`
Email string `json:"email"`
EmailVerified bool `json:"emailVerified"`
CellPhone string `json:"cellPhone"`
CellPhoneVerified bool `json:"cellPhoneVerified"`
HomePhone string `json:"homePhone"`
Preferences Preferences `json:"preferences"`
Address Address `json:"address"`
NationalIds []NationalId `json:"nationalIds"`
// URL of person's profile picture
ProfilePicture string `json:"profilePicture"`
}
type PersonManager ¶
type PersonManager managerBase
func (*PersonManager) Find ¶
func (m *PersonManager) Find(ctx context.Context, opts ...RequestOption) (ResponseWithMeta[[]Person], error)
type PersonRelation ¶
type PersonRelation struct {
TargetUid uuid.UUID `json:"targetUid"`
Target *Person `json:"target"`
// Permission of origin on target
GrantToTarget Grant `json:"grantToTarget"`
// Permission of target on origin
GrantToOrigin Grant `json:"grantToOrigin"`
// Type of relation, defined as {target} is {type} of {origin}
Type PersonRelationType `json:"type"`
ValidFrom time.Time `json:"validFrom"`
ValidTo *time.Time `json:"validTo"`
}
type PersonRelationType ¶
type PersonRelationType string
const ( PersonRelationTypeChild PersonRelationType = "Child" PersonRelationTypeParent PersonRelationType = "Parent" PersonRelationTypeSpouse PersonRelationType = "Spouse" PersonRelationTypeLegalDependent PersonRelationType = "LegalDependent" PersonRelationTypeLegalGuardian PersonRelationType = "LegalGuardian" PersonRelationTypeFosterChild PersonRelationType = "FosterChild" PersonRelationTypeFosterParent PersonRelationType = "FosterParent" PersonRelationTypeContactDependent PersonRelationType = "ContactDependent" PersonRelationTypeContactPerson PersonRelationType = "ContactPerson" )
type Preferences ¶
type Preferences struct {
ContentLanguages []string `json:"contentLanguages"`
UiLanguages []string `json:"uiLanguages"`
Visibility VisibilityPreferences `json:"visibility"`
}
type Relation ¶
type Relation struct {
Uid uuid.UUID `json:"uid"`
LastChangedDate time.Time `json:"lastChangedDate"`
Origin *Person `json:"origin"`
Target *Person `json:"target"`
OriginUid uuid.UUID `json:"originUid"`
TargetUid uuid.UUID `json:"targetUid"`
// Type of the relation, defined as {origin} is {type} (of) {target}
Type RelationType `json:"type"`
// Permission of origin on target
GrantToTarget Grant `json:"grantToTarget"`
// Permission of target on origin
GrantToOrigin Grant `json:"grantToOrigin"`
ValidFrom time.Time `json:"validFrom"`
ValidTo *time.Time `json:"validTo"`
}
type RelationManager ¶
type RelationManager managerBase
func (*RelationManager) Find ¶
func (m *RelationManager) Find(ctx context.Context, opts ...RequestOption) (ResponseWithMeta[[]Relation], error)
type RelationType ¶
type RelationType string
ENUM(ChildOf, SpouseOf, LegalDependentOf, FosterChildOf, ContactDependentOf)
const ( RelationTypeChildOf RelationType = "ChildOf" RelationTypeSpouseOf RelationType = "SpouseOf" RelationTypeLegalDependentOf RelationType = "LegalDependentOf" RelationTypeFosterChildOf RelationType = "FosterChildOf" RelationTypeContactDependentOf RelationType = "ContactDependentOf" )
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 ResponseWithMeta ¶
type RoleAssignment ¶
type RoleAssignment struct {
Uid uuid.UUID `json:"uid"`
LastChangedDate time.Time `json:"lastChangedDate"`
Person *Person `json:"person"`
Role *Role `json:"role"`
Org *Org `json:"org"`
PersonUid uuid.UUID `json:"personUid"`
RoleUid uuid.UUID `json:"roleUid"`
OrgUid *uuid.UUID `json:"orgUid"`
ValidFrom time.Time `json:"validFrom"`
ValidTo *time.Time `json:"validTo"`
}
type RoleAssignmentManager ¶
type RoleAssignmentManager managerBase
func (*RoleAssignmentManager) Find ¶
func (m *RoleAssignmentManager) Find(ctx context.Context, opts ...RequestOption) (ResponseWithMeta[[]RoleAssignment], error)
func (*RoleAssignmentManager) Get ¶
func (m *RoleAssignmentManager) Get(ctx context.Context, uid uuid.UUID, opts ...RequestOption) (Response[RoleAssignment], error)
type RoleManager ¶
type RoleManager managerBase
func (*RoleManager) Find ¶
func (m *RoleManager) Find(ctx context.Context, opts ...RequestOption) (ResponseWithMeta[[]Role], error)
type SearchVisibility ¶
type SearchVisibility string
ENUM(Global, District, Hidden)
const ( SearchVisibilityGlobal SearchVisibility = "Global" SearchVisibilityDistrict SearchVisibility = "District" SearchVisibilityHidden SearchVisibility = "Hidden" )
type VisibilityPreferences ¶
type VisibilityPreferences struct {
BirthdayList bool `json:"birthdayList"`
Search SearchVisibility `json:"search"`
}