stardog

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2023 License: MIT Imports: 15 Imported by: 6

Documentation

Overview

Package stardog provides a client for using the Stardog API.

Usage:

import "github.com/noahgorstein/go-stardog/stardog"

Construct a new Stardog client, then use the various services on the client to access different parts of the Stardog API. For example:

ctx := context.Background()

basicAuthTransport := stardog.BasicAuthTransport{
  Username: "admin",
  Password: "admin",
}

client, _ := stardog.NewClient("http://localhost:5820", basicAuthTransport.Client())

// list all users in the server
users, _, err := client.User.List(ctx)

The services of a client divide the API into logical chunks and roughly correspond to structure of the Stardog HTTP API documentation at https://stardog-union.github.io/http-docs/

NOTE: Using the https://godoc.org/context package, one can easily pass cancelation signals and deadlines to various services of the client for handling a request. In case there is no context available, then context.Background() can be used as a starting point.

For more sample code snippets, head over to the https://github.com/noahgorstein/go-stardog/tree/main/examples directory.

Authentication

The go-stardog library does not directly handle authentication. Instead, when creating a new client, pass an http.Client that can handle authentication for you.

Basic Authentication

For users who wish to authenticate via username and password (HTTP Basic Authentication), use the BasicAuthTransport

func main() {

  ctx := context.Background()

  basicAuthTransport := stardog.BasicAuthTransport{
    Username: "admin",
    Password: "admin",
  }

  client, _ := stardog.NewClient("http://localhost:5820", basicAuthTransport.Client())

  // list all users in the server
  users, _, err := client.User.List(ctx)
}

Token Authentication

For users who wish to authenticate via an access token (Bearer Authentication), use the BearerAuthTransport

func main() {

  ctx := context.Background()

  bearerAuthTransport := stardog.BearerAuthTransport{
    BearerToken: "...token...",
  }

  client, _ := stardog.NewClient("http://localhost:5820", bearerAuthTransport.Client())

  // list all users in the server
  users, _, err := client.User.List(ctx)
}

Index

Constants

View Source
const (
	// Version of go-stardog
	Version = "v0.8.0"
)

Variables

This section is empty.

Functions

func CheckResponse added in v0.3.0

func CheckResponse(r *http.Response) error

CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. API error responses are expected to have response body, and a JSON response body that maps to ErrorResponse.

Types

type AskOptions added in v0.5.0

type AskOptions struct {
	// Enable reasoning
	Reasoning bool `url:"reasoning,omitempty"`
	// The name of the schema
	Schema string `url:"schema,omitempty"`
	// The transaction ID
	TxID string `url:"txid,omitempty"`
	// Base URI against which to resolve relative URIs
	BaseURI string `url:"baseURI,omitempty"`
	// The number of milliseconds after which the query should timeout
	Timeout int `url:"timeout,omitempty"`
	// URI(s) to be used as the default graph (equivalent to FROM)
	DefaultGraphURI string `url:"default-graph-uri,omitempty"`
	// URI(s) to be used as named graphs (equivalent to FROM NAMED)
	NamedGraphURI string `url:"named-graph-uri,omitempty"`
}

AskOptions specifies the optional parameters to the SPARQLService.Ask method

type BasicAuthTransport added in v0.3.0

type BasicAuthTransport struct {
	Username string
	Password string

	// Transport is the underlying HTTP transport to use when making requests.
	// It will default to http.DefaultTransport if nil.
	Transport http.RoundTripper
}

BasicAuthTransport is an http.RoundTripper that authenticates all requests using HTTP Basic Authentication with the provided username and password.

func (*BasicAuthTransport) Client added in v0.3.0

func (t *BasicAuthTransport) Client() *http.Client

Client returns an *http.Client that makes requests that are authenticated using HTTP Basic Authentication.

func (*BasicAuthTransport) RoundTrip added in v0.3.0

func (t *BasicAuthTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements the RoundTripper interface.

type BearerAuthTransport added in v0.3.0

type BearerAuthTransport struct {
	BearerToken string

	// Transport is the underlying HTTP transport to use when making requests.
	// It will default to http.DefaultTransport if nil.
	Transport http.RoundTripper
}

BearerAuthTransport is an http.RoundTripper that authenticates all requests using Bearer Authentication with the provided bearer token.

func (*BearerAuthTransport) Client added in v0.3.0

func (t *BearerAuthTransport) Client() *http.Client

Client returns an *http.Client that makes requests that are authenticated using Bearer Authentication.

func (*BearerAuthTransport) RoundTrip added in v0.3.0

func (t *BearerAuthTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements the RoundTripper interface.

type Client

type Client struct {
	UserAgent string

	// Services for talking to different parts of the Stardog API
	DataSource    *DataSourceService
	DatabaseAdmin *DatabaseAdminService
	Role          *RoleService
	ServerAdmin   *ServerAdminService
	Sparql        *SPARQLService
	Transaction   *TransactionService
	User          *UserService
	// contains filtered or unexported fields
}

Client manages communications with the Stardog API

func NewClient

func NewClient(serverURL string, httpClient *http.Client) (*Client, error)

NewClient returns a new Stardog API client. If a nil httpClient is provided, a new http.Client will be used. To make authenticated API calls, provide an http.Client that will perform the authentication for you.

func (*Client) BareDo added in v0.3.0

func (c *Client) BareDo(ctx context.Context, req *http.Request) (*Response, error)

BareDo sends an API request and lets you handle the api response. If an error or API Error occurs, the error will contain more information. Otherwise you are supposed to read and close the response's Body.

The provided ctx must be non-nil, if it is nil an error is returned. If it is canceled or times out, ctx.Err() will be returned.

func (*Client) Client added in v0.3.0

func (c *Client) Client() *http.Client

Client returns the http.Client used by this Stardog client.

func (*Client) Do added in v0.3.0

func (c *Client) Do(ctx context.Context, req *http.Request, v any) (*Response, error)

Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it. If v is nil, and no error hapens, the response is returned as is.

The provided ctx must be non-nil, if it is nil an error is returned. If it is canceled or times out, ctx.Err() will be returned.

func (*Client) NewMultipartFormDataRequest added in v0.4.0

func (c *Client) NewMultipartFormDataRequest(method string, urlStr string, headerOpts *requestHeaderOptions, body any) (*http.Request, error)

func (*Client) NewRequest added in v0.3.0

func (c *Client) NewRequest(method string, urlStr string, headerOpts *requestHeaderOptions, body any) (*http.Request, error)

type Compression added in v0.4.0

type Compression int

Data compression formats available in Stardog. The zero-value for Compression is CompressionUnknown

const (
	CompressionUnknown Compression = iota
	CompressionBZ2
	CompressionZIP
	CompressionGZIP
)

All available compression formats in Stardog.

func (Compression) String added in v0.5.0

func (c Compression) String() string

func (Compression) Valid added in v0.5.0

func (c Compression) Valid() bool

Valid returns if a Compression is known (valid) or not.

type ConstructOptions added in v0.5.0

type ConstructOptions struct {
	// Enable reasoning
	Reasoning bool `url:"reasoning,omitempty"`
	// The name of the schema
	Schema string `url:"schema,omitempty"`
	// The transaction ID
	TxID string `url:"txid,omitempty"`
	// Base URI against which to resolve relative URIs
	BaseURI string `url:"baseURI,omitempty"`
	// The number of milliseconds after which the query should timeout
	Timeout int `url:"timeout,omitempty"`
	// The maximum number of results to return
	Limit int `url:"limit,omitempty"`
	// How far into the result set to offset
	Offset int `url:"offset,omitempty"`
	// Request query results with namespace substitution/prefix lines
	UseNamespaces bool `url:"useNamespaces,omitempty"`
	// URI(s) to be used as the default graph (equivalent to FROM)
	DefaultGraphURI string `url:"default-graph-uri,omitempty"`
	// URI(s) to be used as named graphs (equivalent to FROM NAMED)
	NamedGraphURI string `url:"named-graph-uri,omitempty"`

	// RDF Serialization Format for results
	ResultFormat RDFFormat `url:"-"`
}

ConstructOptions specifies the optional parameters to the SPARQLService.Construct method

type CreateDatabaseOptions added in v0.5.0

type CreateDatabaseOptions struct {
	// The data to be bulk-loaded to the database at creation time
	Datasets []Dataset
	// Database configuration options
	DatabaseOptions map[string]any
	// Whether to send the file contents to the server. Use if data exists client-side.
	CopyToServer bool
}

CreateDatabaseOptions specifies the optional parameters to the [DatabaseAdminService.CreateDatabase] method.

type DataModelFormat added in v0.5.0

type DataModelFormat int

DataModelFormat represents an output format for DatabaseAdminService.DataModel. The zero value for a DataModelFormat is DataModelFormatUnknown

const (
	DataModelFormatUnknown DataModelFormat = iota
	DataModelFormatText
	DataModelFormatOWL
	DataModelFormatSHACL
	DataModelFormatSQL
	DataModelFormatGraphQL
)

All available DataModelFormats

func (DataModelFormat) String added in v0.5.0

func (f DataModelFormat) String() string

String will return the string representation of the DataModelFormat

func (DataModelFormat) Valid added in v0.5.0

func (f DataModelFormat) Valid() bool

Valid returns if the DataModelFormat is known (valid) or not.

type DataModelOptions added in v0.6.0

type DataModelOptions struct {
	// Enable reasoning
	Reasoning bool `url:"reasoning,omitempty"`

	// Desired output format
	OutputFormat DataModelFormat `url:"output,omitempty"`
}

DataModelOptions are options for the DatabaseAdminService.DataModel method

type DataSource added in v0.3.0

type DataSource struct {
	// Name of data source
	Name string `json:"entityName"`
	// Whether the data source can be shared amongst virtual graphs
	Shareable bool `json:"sharable"`
	// Whether the data source is available or not
	Available bool `json:"available"`
}

type DataSourceService added in v0.7.0

type DataSourceService service

DataSourceService handles communication with the data source related methods of the Stardog API.

func (*DataSourceService) Add added in v0.7.0

func (s *DataSourceService) Add(ctx context.Context, name string, opts map[string]any) (*Response, error)

Add adds a new data source to the system

Stardog API: https://stardog-union.github.io/http-docs/#tag/Data-Sources/operation/addDataSource

func (*DataSourceService) Delete added in v0.7.0

func (s *DataSourceService) Delete(ctx context.Context, datasource string, opts *DeleteDataSourceOptions) (*Response, error)

Delete deletes a registered data source.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Data-Sources/operation/deleteDataSource

func (*DataSourceService) IsAvailable added in v0.7.0

func (s *DataSourceService) IsAvailable(ctx context.Context, datasource string) (*bool, *Response, error)

IsAvailable checks if a given data data source is available

Stardog API: https://stardog-union.github.io/http-docs/#tag/Data-Sources/operation/availableDataSource

func (*DataSourceService) List added in v0.7.0

List returns the all DataSources registered in the system

Stardog API: https://stardog-union.github.io/http-docs/#tag/Data-Sources/operation/dataSourceInfos

func (*DataSourceService) ListNames added in v0.7.0

func (s *DataSourceService) ListNames(ctx context.Context) ([]string, *Response, error)

ListNames returns the names of all data sources registered in the system

Stardog API: https://stardog-union.github.io/http-docs/#tag/Data-Sources/operation/listDataSources

func (*DataSourceService) Online added in v0.7.0

func (s *DataSourceService) Online(ctx context.Context, datasource string) (*Response, error)

Online attempts to bring an existing data source connection online. When Stardog restarts, data sources that cannot be loaded will be listed as offline. If Online is successful, all virtual graphs that use the data source will be brought online as well.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Data-Sources/operation/onlineDataSource

func (*DataSourceService) Options added in v0.7.0

func (s *DataSourceService) Options(ctx context.Context, datasource string) (map[string]any, *Response, error)

Options returns the all set options for the given data source

Stardog API: https://stardog-union.github.io/http-docs/#tag/Data-Sources/operation/getDataSourceOptions

func (*DataSourceService) Query added in v0.7.0

func (s *DataSourceService) Query(ctx context.Context, datasource string, query string, opts map[string]any) (*map[string]any, *Response, error)

Query queries the data source directly with optional data source options.

The result format from the endpoint is JSON but its structure is not well defined enough to return a struct since the fields are variable depending on what is being queried.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Data-Sources/operation/testDataSource

func (*DataSourceService) RefreshCounts added in v0.7.0

func (s *DataSourceService) RefreshCounts(ctx context.Context, datasource string, opts *RefreshDataSourceCountsOptions) (*Response, error)

RefreshCounts refreshes the row-count estimates for one or all tables that are accessible to a data source. When a virtual graph is loaded, it queries the data source for approximate table and index sizes. If the size of one or more tables change after the virtual graph is loaded, these estimates become stale, potentially leading to suboptimal query plans.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Data-Sources/operation/refreshMetadata

func (*DataSourceService) RefreshMetadata added in v0.7.0

func (s *DataSourceService) RefreshMetadata(ctx context.Context, datasource string, opts *RefreshDataSourceMetadataOptions) (*Response, error)

RefreshMetadata clears the saved metadata for a Data Source and reloads all its dependent Virtual Graphs with fresh metadata.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Data-Sources/operation/refreshMetadata

func (*DataSourceService) Share added in v0.7.0

func (s *DataSourceService) Share(ctx context.Context, datasource string) (*Response, error)

Shares shares a private data source. When a virtual graph is created without specifying a data source name, a private data source is created for that, and only that virtual graph. This command makes such a data source available to other virtual graphs, as well as decouples the data source life cycle from the original virtual graph.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Data-Sources/operation/shareDataSource

func (*DataSourceService) TestExisting added in v0.7.0

func (s *DataSourceService) TestExisting(ctx context.Context, datasource string) (*Response, error)

TestExisting tests an existing data source connection.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Data-Sources/operation/testDataSource

func (*DataSourceService) TestNew added in v0.7.0

func (s *DataSourceService) TestNew(ctx context.Context, opts map[string]any) (*Response, error)

TestNew tests a connection to a new data source.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Data-Sources/operation/testDataSource

func (*DataSourceService) Update added in v0.7.0

func (s *DataSourceService) Update(ctx context.Context, datasource string, opts map[string]any) (*Response, error)

Update updates an existing data source.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Data-Sources/operation/updateDataSource

type DatabaseAdminService added in v0.4.0

type DatabaseAdminService service

DatabaseAdminService handles communication with the database admin related methods of the Stardog API.

func (*DatabaseAdminService) AllMetadata added in v0.6.0

func (s *DatabaseAdminService) AllMetadata(ctx context.Context, database string) (map[string]any, *Response, error)

AllMetadata returns all the database configuration options (a.k.a. metadata) and their set values for a database.

Stardog API: https://stardog-union.github.io/http-docs/#tag/DB-Admin/operation/getAllDatabaseOptions

func (*DatabaseAdminService) Create added in v0.6.0

Create creates a database, optionally with RDF and database options. Create assumes that the Paths in the Dataset(s) provided for CreateDatabaseOptions.Datasets exist on the server. If they are client side, provide a value of true for CreateDatabaseOptions.CopyToServer

If the database creation is successful a *string containing details about the database creation will be returned such as:

Bulk loading data to new database db1.
Loaded 41,099 triples to db1 from 1 file(s) in 00:00:00.487 @ 84.4K triples/sec.
Successfully created database 'db1'.

Stardog API: https://stardog-union.github.io/http-docs/#tag/DB-Admin/operation/createNewDatabase

func (*DatabaseAdminService) DataModel added in v0.6.0

func (s *DatabaseAdminService) DataModel(ctx context.Context, database string, opts *DataModelOptions) (*bytes.Buffer, *Response, error)

DataModel generates the reasoning model used by this database in various formats

Stardog API: https://stardog-union.github.io/http-docs/#tag/DB-Admin/operation/generateModel

func (*DatabaseAdminService) Drop added in v0.6.0

func (s *DatabaseAdminService) Drop(ctx context.Context, database string) (*Response, error)

Drop deletes a database

Stardog API: https://stardog-union.github.io/http-docs/#tag/DB-Admin/operation/dropDatabase

func (*DatabaseAdminService) ExportData added in v0.4.0

func (s *DatabaseAdminService) ExportData(ctx context.Context, database string, opts *ExportDataOptions) (*bytes.Buffer, *Response, error)

ExportData exports RDF data from the database. If ExportDataOptions.ServerSide=true, the RDF using the specified format will be saved in the export directory for the server. The default server export directory is ‘.exports’ in the $STARDOG_HOME but can be changed via ‘export.dir’ in the stardog.properties file. In this case, some information will be returned about the export instead of the RDF such as:

Exported 28 statements from db1 to /stardog-home/.exports/db1-2023-01-15.trig in 2.551 ms

Starodg API: https://stardog-union.github.io/http-docs/#tag/DB-Admin/operation/exportDatabase

func (*DatabaseAdminService) ExportObfuscatedData added in v0.4.0

func (s *DatabaseAdminService) ExportObfuscatedData(ctx context.Context, database string, opts *ExportObfuscatedDataOptions) (*bytes.Buffer, *Response, error)

ExportObfuscatedData exports obfuscated RDF data from the database.

If nil is provided for ExportObfuscatedDataOptions.ObfuscationConfig, Stardog will use its default obfuscation configuration. All URIs, bnodes, and string literals in the database will be obfuscated using the SHA256 message digest algorithm. Non-string typed literals (numbers, dates, etc.) are left unchanged as well as URIs from built-in namespaces (e.g. RDF, RDFS, OWL, etc.)

If ExportObfuscatedDataOptions.ServerSide=true, the RDF using the specified format will be saved in the export directory for the server. The default server export directory is ‘.exports’ in the $STARDOG_HOME but can be changed via ‘export.dir’ in the stardog.properties file. In this case, some information will be returned about the export instead of the RDF such as:

Exported 28 statements from db1 to /stardog-home/.exports/db1-2023-01-15.trig in 2.551 ms

Stardog API: https://stardog-union.github.io/http-docs/#tag/DB-Admin/operation/exportDatabaseObfuscated

func (*DatabaseAdminService) ImportNamespaces added in v0.4.0

func (s *DatabaseAdminService) ImportNamespaces(ctx context.Context, database string, file *os.File) (*ImportNamespacesResponse, *Response, error)

ImportNamespaces adds namespaces to the database that are declared in the RDF file.

Stardog API: https://stardog-union.github.io/http-docs/#tag/DB-Admin/operation/getNamespaces

func (*DatabaseAdminService) ListDatabases added in v0.6.0

func (s *DatabaseAdminService) ListDatabases(ctx context.Context) ([]string, *Response, error)

ListDatabases returns the names of all databases in the server.

Stardog API: https://stardog-union.github.io/http-docs/#tag/DB-Admin/operation/listDatabases

func (*DatabaseAdminService) ListWithMetadata added in v0.6.0

func (s *DatabaseAdminService) ListWithMetadata(ctx context.Context) ([]map[string]any, *Response, error)

ListWithMetadata returns all databases with their database configuration options (a.k.a. metadata)

Stardog API: https://stardog-union.github.io/http-docs/#tag/DB-Admin/operation/listDatabasesWithOptions

func (*DatabaseAdminService) Metadata added in v0.6.0

func (s *DatabaseAdminService) Metadata(ctx context.Context, database string, opts []string) (map[string]any, *Response, error)

Metadata returns the value of specific metadata options for a database.

Stardog API: https://stardog-union.github.io/http-docs/#tag/DB-Admin/operation/getDatabaseOptions

func (*DatabaseAdminService) MetadataDocumentation added in v0.6.0

func (s *DatabaseAdminService) MetadataDocumentation(ctx context.Context) (map[string]DatabaseOptionDetails, *Response, error)

MetadataDocumentation returns information about all available database configuration options (a.k.a. metadata) including description and example values.

Stardog API: https://stardog-union.github.io/http-docs/#tag/DB-Admin/operation/getAllMetaProperties

func (*DatabaseAdminService) Namespaces added in v0.6.0

func (s *DatabaseAdminService) Namespaces(ctx context.Context, database string) ([]Namespace, *Response, error)

Namespaces retrieves the namespaces stored in the database.

Stardog API: https://stardog-union.github.io/http-docs/#tag/DB-Admin/operation/getNamespaces

func (*DatabaseAdminService) Offline added in v0.6.0

func (s *DatabaseAdminService) Offline(ctx context.Context, database string) (*Response, error)

Offline onlines a database.

Stardog API: https://stardog-union.github.io/http-docs/#tag/DB-Admin/operation/offlineDatabase

func (*DatabaseAdminService) Online added in v0.6.0

func (s *DatabaseAdminService) Online(ctx context.Context, database string) (*Response, error)

Online onlines a database.

Stardog API: https://stardog-union.github.io/http-docs/#tag/DB-Admin/operation/onlineDatabase

func (*DatabaseAdminService) Optimize added in v0.6.0

func (s *DatabaseAdminService) Optimize(ctx context.Context, database string) (*Response, error)

Optimize optimizes a database

Stardog API: https://stardog-union.github.io/http-docs/#tag/DB-Admin/operation/optimizeDatabase

func (*DatabaseAdminService) Repair added in v0.6.0

func (s *DatabaseAdminService) Repair(ctx context.Context, database string) (*Response, error)

Repair attempts to recover a corrupted database.

Stardog API: https://stardog-union.github.io/http-docs/#tag/DB-Admin/operation/repairDatabase

func (*DatabaseAdminService) Restore added in v0.6.0

Restore restores a database backup located at the path on the server

Stardog API: https://stardog-union.github.io/http-docs/#tag/DB-Admin/operation/restoreDatabase

func (*DatabaseAdminService) SetMetadata added in v0.6.0

func (s *DatabaseAdminService) SetMetadata(ctx context.Context, database string, opts map[string]any) (*Response, error)

SetMetadata sets the value of specific configuration options (a.k.a. metadata) for a database.

Stardog API: https://stardog-union.github.io/http-docs/#tag/DB-Admin/operation/setDatabaseOption

func (*DatabaseAdminService) Size added in v0.6.0

func (s *DatabaseAdminService) Size(ctx context.Context, database string, opts *DatabaseSizeOptions) (*int, *Response, error)

Size returns the size of the database. Size is approximate unless the GetDatabaseSizeOptions.Exact field is set to true.

Stardog API: https://stardog-union.github.io/http-docs/#tag/DB-Admin/operation/listDatabases

type DatabaseOptionDetails added in v0.4.0

type DatabaseOptionDetails struct {
	Name              string `json:"name"`
	Type              string `json:"type"`
	Server            bool   `json:"server"`
	Mutable           bool   `json:"mutable"`
	MutableWhenOnline bool   `json:"mutableWhenOnline"`
	Category          string `json:"category"`
	Label             string `json:"label"`
	Description       string `json:"description"`
	DefaultValue      any    `json:"defaultValue"`
}

DatabaseOptionDetails represents a database configuration option's details.

type DatabaseSizeOptions added in v0.6.0

type DatabaseSizeOptions struct {
	Exact bool `url:"exact"`
}

DatabaseSizeOptions specifies the optional parameters to the DatabaseAdminService.Size method.

type Dataset added in v0.4.0

type Dataset struct {
	// Path to the file to be uploaded to the server
	Path string
	// The optional named-graph (A.K.A context) for the data contained in the file to be added to.
	NamedGraph string
}

Dataset is used to specify a dataset (filepath and named graph to add data into) to be added to a Stardog database.

type DeleteDataSourceOptions added in v0.7.0

type DeleteDataSourceOptions struct {
	// Whether to remove any virtual graphs that use the data source
	Force bool `url:"force,omitempty"`
}

DeleteDataSourceOptions are optional parameters to the DataSourceService.Delete method

type DeleteRoleOptions added in v0.3.0

type DeleteRoleOptions struct {
	// remove the role if currently assigned to users
	Force bool `url:"force"`
}

DeleteRoleOptions specifies the optional parameters to the RoleService.Delete method.

type EffectivePermission added in v0.5.0

type EffectivePermission struct {
	Permission
	// whether the permission is explictly assigned to user or implicitly via role assignment
	Explicit bool `json:"explicit"`
}

EffectivePermission represents a permission assigned implicitly via role assignment or explicitly.

type ErrorResponse added in v0.3.0

type ErrorResponse struct {
	Response *http.Response // HTTP response that caused this error
	Message  string         `json:"message"` // error message
	Code     string         `json:"code"`    // Stardog error code
}

An ErrorResponse reports an error caused by an API request.

Stardog API docs: https://stardog-union.github.io/http-docs/#section/Error-Codes

func (*ErrorResponse) Error added in v0.3.0

func (r *ErrorResponse) Error() string

func (*ErrorResponse) Is added in v0.3.0

func (r *ErrorResponse) Is(target error) bool

Is returns whether the provided error equals this error.

type ExplainOptions added in v0.5.0

type ExplainOptions struct {
	// Enable reasoning
	Reasoning bool `url:"reasoning,omitempty"`
	// Run the query profiler
	Profile bool `url:"profile,omitempty"`

	// Format to return query plan in ([QueryPlanFormatText] is the default)
	QueryPlanFormat QueryPlanFormat `url:"-"`
}

ExplainOptions specifies the optional parameters to the SPARQLService.Explain method

type ExportDataOptions added in v0.4.0

type ExportDataOptions struct {
	// The named graph(s) to export from the dataset
	NamedGraph []string `url:"named-graph-uri,omitempty"`

	// The RDF format for the exported data
	Format RDFFormat `url:"-"`

	// Compression format for the exported data. **Only applicable if data is exported ServerSide**
	Compression Compression `url:"compression,omitempty"`

	// Export the data to the server
	ServerSide bool `url:"server-side,omitempty"`
}

ExportDataOptions specifies the optional parameters to the DatabaseAdminService.ExportData method.

type ExportObfuscatedDataOptions added in v0.4.0

type ExportObfuscatedDataOptions struct {
	// The named graph(s) to export from the dataset
	NamedGraph []string `url:"named-graph-uri,omitempty"`

	// The RDF format for the exported data
	Format RDFFormat `url:"-"`

	// Compression format for the exported data. **Only applicable if data is exported ServerSide**
	Compression Compression `url:"compression,omitempty"`

	// Export the data to Stardog's export dir ($STARDOG_HOME/.exports by default)
	ServerSide bool `url:"server-side,omitempty"`

	// Configuration file for obfuscation.
	// See https://github.com/stardog-union/stardog-examples/blob/master/config/obfuscation.ttl for an example configuration file.
	ObfuscationConfig *os.File `url:"-"`
}

ExportObfuscatedDataOptions specifies the optional parameters to the DatabaseAdminService.ExportObfuscatedData method.

type ImportNamespacesResponse added in v0.4.0

type ImportNamespacesResponse struct {
	NumberImportedNamespaces int      `json:"numImportedNamespaces"`
	UpdatedNamespaces        []string `json:"namespaces"`
}

ImportNamespacesResponse contains information returned after DatabaseAdminService.ImportNamespaces completed successfully.

type Namespace added in v0.4.0

type Namespace struct {
	Prefix string `json:"prefix"`
	Name   string `json:"name"`
}

Namespace represents a Stardog database namespace.

type Permission

type Permission struct {
	// the access level (e.g. PermissionActionRead)
	Action PermissionAction `json:"action"`
	// the type of resource (e.g. PermissionResourceTypeDatabase)
	ResourceType PermissionResourceType `json:"resource_type"`
	// the resource identifier (e.g. myDatabase)
	Resource []string `json:"resource"`
}

Permission represents a user/role permission.

Stardog security model states that a user/role can be perform an action (e.g. read) over a resource (e.g. db:myDatabase).

type PermissionAction added in v0.5.0

type PermissionAction int

PermissionAction represents the action in a Stardog permission. The zero value for a PermissionAction is PermissionActionUnknown

const (
	PermissionActionUnknown PermissionAction = iota
	PermissionActionRead
	PermissionActionWrite
	PermissionActionCreate
	PermissionActionDelete
	PermissionActionGrant
	PermissionActionRevoke
	PermissionActionExecute
	PermissionActionAll
)

All available actions for a permission

func (PermissionAction) MarshalText added in v0.5.0

func (p PermissionAction) MarshalText() ([]byte, error)

MarshalText implements TextMarshaler and is invoked when encoding the PermissionAction to JSON.

func (PermissionAction) String added in v0.5.0

func (p PermissionAction) String() string

String will return the string representation of the PermissionAction

func (*PermissionAction) UnmarshalText added in v0.5.0

func (p *PermissionAction) UnmarshalText(text []byte) error

UnmarshalText implements TextUnmarshaler and is invoked when decoding JSON to PermissionAction.

func (PermissionAction) Valid added in v0.5.0

func (p PermissionAction) Valid() bool

Valid returns if a given PermissionAction is known (valid) or not.

type PermissionResourceType added in v0.5.0

type PermissionResourceType int

PermissionResourceType represents the resource type in a Stardog permission. The zero value for a PermissionResourceType is PermissionResourceTypeUnknown

const (
	PermissionResourceTypeUnknown PermissionResourceType = iota
	PermissionResourceTypeDatabase
	PermissionResourceTypeMetadata
	PermissionResourceTypeUser
	PermissionResourceTypeRole
	PermissionResourceTypeNamedGraph
	PermissionResourceTypeVirtualGraph
	PermissionResourceTypeDataSource
	PermissionResourceTypeServeradmin
	PermissionResourceTypeDatabaseAdmin
	PermissionResourceTypeSensitiveProperty
	PermissionResourceTypeStoredQuery
	PermissionResourceTypeAll
)

All available resource types for a permission

func (PermissionResourceType) MarshalText added in v0.5.0

func (p PermissionResourceType) MarshalText() ([]byte, error)

MarshalText implements TextMarshaler and is invoked when encoding the PermissionResourceType to JSON.

func (PermissionResourceType) String added in v0.5.0

func (p PermissionResourceType) String() string

String will return the string representation of the PermissionResourceType

func (*PermissionResourceType) UnmarshalText added in v0.5.0

func (p *PermissionResourceType) UnmarshalText(text []byte) error

UnmarshalText implements TextUnmarshaler and is invoked when decoding JSON to PermissionResourceType.

func (PermissionResourceType) Valid added in v0.5.0

func (p PermissionResourceType) Valid() bool

Valid returns if a given PermissionResourceType is known (valid) or not.

type Process added in v0.2.2

type Process struct {
	Type      string          `json:"type"`
	KernelID  string          `json:"kernelId"`
	ID        string          `json:"id"`
	Db        string          `json:"db"`
	User      string          `json:"user"`
	StartTime int64           `json:"startTime"`
	Status    string          `json:"status"`
	Progress  ProcessProgress `json:"progress"`
}

Process represent a Stardog server process

type ProcessProgress added in v0.3.0

type ProcessProgress struct {
	Max     int    `json:"max"`
	Current int    `json:"current"`
	Stage   string `json:"stage"`
}

ProcessProgress represents a Process's progress

type QueryPlanFormat added in v0.5.0

type QueryPlanFormat int

QueryPlanFormat determines the format of the Stardog query plan. The zero value for a QueryPlanFormat is QueryPlanFormatUnknown

const (
	QueryPlanFormatUnknown QueryPlanFormat = iota
	QueryPlanFormatText
	QueryPlanFormatJSON
)

All available values for QueryPlanFormat

func (QueryPlanFormat) String added in v0.5.0

func (q QueryPlanFormat) String() string

String will return the string representation of the QueryPlanFormat, which is the MIME-type

func (QueryPlanFormat) Valid added in v0.5.0

func (q QueryPlanFormat) Valid() bool

Valid returns if a given QueryPlanFormat is known (valid) or not.

type QueryResultFormat added in v0.5.0

type QueryResultFormat int

QueryResultFormat is the format of the Stardog query results. The zero value for a QueryResultFormat is QueryResultFormatUnknown

const (
	QueryResultFormatUnknown QueryResultFormat = iota
	QueryResultFormatTrig
	QueryResultFormatTurtle
	QueryResultFormatRDFXML
	QueryResultFormatNTriples
	QueryResultFormatNQuads
	QueryResultFormatJSONLD
	QueryResultFormatSparqlResultsJSON
	QueryResultFormatSparqlResultsXML
	QueryResultFormatCSV
	QueryResultFormatTSV
)

All available values for QueryResultFormat

func (QueryResultFormat) String added in v0.5.0

func (q QueryResultFormat) String() string

String will return the string representation of the QueryResultFormat, which is the MIME-type

func (QueryResultFormat) Valid added in v0.5.0

func (q QueryResultFormat) Valid() bool

Valid returns if a given QueryResultFormat is known (valid) or not.

type RDFFormat added in v0.4.0

type RDFFormat int

RDFFormat represents an RDF Serialization Format. The zero value for an RDFFormat is RDFFormatUnknown

const (
	RDFFormatUnknown RDFFormat = iota
	RDFFormatTrig
	RDFFormatTurtle
	RDFFormatRDFXML
	RDFFormatNTriples
	RDFFormatNQuads
	RDFFormatJSONLD
)

All available RDF Formats in Stardog.

func GetRDFFormatFromExtension added in v0.4.0

func GetRDFFormatFromExtension(path string) (RDFFormat, error)

GetRDFFormatFromExtension attempts to determine the RDFFormat from a given filepath.

func (RDFFormat) String added in v0.5.0

func (r RDFFormat) String() string

String will return the string representation of the RDFFormat, which is the MIME-type

func (RDFFormat) Valid added in v0.5.0

func (r RDFFormat) Valid() bool

Valid returns if a given RDFFormat is known (valid) or not.

type RefreshDataSourceCountsOptions added in v0.7.0

type RefreshDataSourceCountsOptions struct {
	// Optional table to refresh. Example formats (case-sensitive): catalog.schema.table, schema.table, table
	Table string `json:"name,omitempty"`
}

RefreshDataSourceCountsOptions are optional parameters to the DataSourceService.RefreshCounts method

type RefreshDataSourceMetadataOptions added in v0.7.0

type RefreshDataSourceMetadataOptions struct {
	// Optional table to refresh. Example formats (case-sensitive): catalog.schema.table, schema.table, table
	Table string `json:"name,omitempty"`
}

RefreshDataSourceMetadataOptions are optional parameters to the DataSourceService.RefreshMetadata method

type Response added in v0.3.0

type Response struct {
	*http.Response
}

Response is a Stardog API response. This wraps the standard http.Response

type RestoreDatabaseOptions added in v0.4.0

type RestoreDatabaseOptions struct {
	// Whether or not to overwrite an existing database with this backup
	Force bool `url:"force,omitempty"`

	// The name of the restored database, if different than the name of the backup being restored
	Name string `url:"name,omitempty"`
}

RestoreDatabaseOptions are options for the DatabaseAdminService.Restore method

type Role added in v0.3.0

type Role struct {
	// name of the role
	Name string `json:"rolename"`
	// permissions assigned to the role
	Permissions []Permission `json:"permissions"`
}

Role represents a a Stardog role that can be assigned to a user to implicitly assign permissions

type RoleService added in v0.6.0

type RoleService service

RoleService handles communication with the role related methods of the Stardog API.

func (*RoleService) Create added in v0.6.0

func (s *RoleService) Create(ctx context.Context, rolename string) (*Response, error)

Create adds a role to the system.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Roles/operation/addRole

func (*RoleService) Delete added in v0.6.0

func (s *RoleService) Delete(ctx context.Context, rolename string, opts *DeleteRoleOptions) (*Response, error)

Delete deletes the role from the system.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Roles/operation/deleteRole

func (*RoleService) GrantPermission added in v0.6.0

func (s *RoleService) GrantPermission(ctx context.Context, rolename string, permission Permission) (*Response, error)

GrantPermission grants a permission to a role.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Permissions/operation/addUserPermission

func (*RoleService) List added in v0.6.0

func (s *RoleService) List(ctx context.Context) ([]Role, *Response, error)

List returns all Roles in the system

Stardog API: https://stardog-union.github.io/http-docs/#tag/Roles/operation/listRolesDetailed

func (*RoleService) ListNames added in v0.6.0

func (s *RoleService) ListNames(ctx context.Context) ([]string, *Response, error)

ListNames returns the names of all roles in the system

Stardog API: https://stardog-union.github.io/http-docs/#tag/GetRoles/operation/listRoles

func (*RoleService) Permissions added in v0.6.0

func (s *RoleService) Permissions(ctx context.Context, rolename string) ([]Permission, *Response, error)

Permissions returns the permissions assigned to a role.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Permissions/operation/getRolePermissions

func (*RoleService) RevokePermission added in v0.6.0

func (s *RoleService) RevokePermission(ctx context.Context, rolename string, permission Permission) (*Response, error)

RevokePermission revokes a permission from a role.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Permissions/operation/deleteRolePermission

type SPARQLService added in v0.5.0

type SPARQLService service

SPARQLService handles communication with the SPARQL methods of the Stardog API.

func (*SPARQLService) Ask added in v0.5.0

func (s *SPARQLService) Ask(ctx context.Context, database string, query string, opts *AskOptions) (*bool, *Response, error)

Ask performs a SPARQL ASK query

Stardog API: https://stardog-union.github.io/http-docs/#tag/SPARQL/operation/getSparqlQuery

func (*SPARQLService) Construct added in v0.5.0

func (s *SPARQLService) Construct(ctx context.Context, database string, query string, opts *ConstructOptions) (*bytes.Buffer, *Response, error)

Construct performs a SPARQL CONSTRUCT query.

If ConstructOptions.ResultFormat is not specified or is not valid, results from the query will be returned as Trig.

Stardog API: https://stardog-union.github.io/http-docs/#tag/SPARQL/operation/getSparqlQuery

func (*SPARQLService) Explain added in v0.5.0

func (s *SPARQLService) Explain(ctx context.Context, database string, query string, opts *ExplainOptions) (*bytes.Buffer, *Response, error)

Retrieves a query plan for a given query.

By default, if ExplainOptions.QueryPlanFormat is not specified, the text version of the plan will be returned.

Stardog API: https://stardog-union.github.io/http-docs/#tag/SPARQL/operation/explainQueryGet

func (*SPARQLService) Select added in v0.5.0

func (s *SPARQLService) Select(ctx context.Context, database string, query string, opts *SelectOptions) (*bytes.Buffer, *Response, error)

Select performs a SPARQL SELECT query

Stardog API: https://stardog-union.github.io/http-docs/#tag/SPARQL/operation/getSparqlQuery

func (*SPARQLService) Update added in v0.5.0

func (s *SPARQLService) Update(ctx context.Context, database string, query string, opts *UpdateOptions) (*Response, error)

Update performs a SPARQL UPDATE query

Stardog API: https://stardog-union.github.io/http-docs/#tag/SPARQL/operation/updateGet

type SelectOptions added in v0.5.0

type SelectOptions struct {
	// Enable reasoning
	Reasoning bool `url:"reasoning,omitempty"`
	// The name of the schema
	Schema string `url:"schema,omitempty"`
	// The transaction ID
	TxID string `url:"txid,omitempty"`
	// Base URI against which to resolve relative URIs
	BaseURI string `url:"baseURI,omitempty"`
	// The number of milliseconds after which the query should timeout
	Timeout int `url:"timeout,omitempty"`
	// The maximum number of results to return
	Limit int `url:"limit,omitempty"`
	// How far into the result set to offset
	Offset int `url:"offset,omitempty"`
	// Request query results with namespace substitution/prefix lines
	UseNamespaces bool `url:"useNamespaces,omitempty"`
	// URI(s) to be used as the default graph (equivalent to FROM)
	DefaultGraphURI string `url:"default-graph-uri,omitempty"`
	// URI(s) to be used as named graphs (equivalent to FROM NAMED)
	NamedGraphURI string `url:"named-graph-uri,omitempty"`

	// Result format of the query results
	ResultFormat QueryResultFormat `url:"-"`
}

SelectOptions specifies the optional parameters to the SPARQLService.Select method

type ServerAdminService

type ServerAdminService service

ServerAdminService provides access to the server admin related functions in the Stardog API.

func (*ServerAdminService) GetProcess added in v0.2.2

func (s *ServerAdminService) GetProcess(ctx context.Context, processID string) (*Process, *Response, error)

GetProcess returns details for a server process.

func (*ServerAdminService) GetProcesses added in v0.2.2

func (s *ServerAdminService) GetProcesses(ctx context.Context) (*[]Process, *Response, error)

GetProcesses returns all server processes.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Monitoring/operation/listProcesses

func (*ServerAdminService) IsAlive added in v0.3.0

func (s *ServerAdminService) IsAlive(ctx context.Context) (*bool, *Response, error)

IsAlive returns whether the server is accepting traffic or not.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Server-Admin/operation/aliveCheck

func (*ServerAdminService) KillProcess added in v0.2.2

func (s *ServerAdminService) KillProcess(ctx context.Context, processID string) (*Response, error)

KillProcess kills a server process.

type TransactionService added in v0.3.0

type TransactionService service

TransactionService provides access to the transaction related functions in the Stardog API.

func (*TransactionService) Begin added in v0.3.0

func (s *TransactionService) Begin(ctx context.Context, database string) (string, *Response, error)

Begin creates a transaction. The transaction ID returned can be passed into other methods/functions that accept a transaction ID.

Stardog API docs: https://stardog-union.github.io/http-docs/#tag/Transactions/operation/beginTransaction

type UpdateOptions added in v0.5.0

type UpdateOptions struct {
	// Enable reasoning
	Reasoning bool `url:"reasoning,omitempty"`
	// The name of the schema
	Schema string `url:"schema,omitempty"`
	// The transaction ID
	TxID string `url:"txid,omitempty"`
	// Base URI against which to resolve relative URIs
	BaseURI string `url:"baseURI,omitempty"`
	// The number of milliseconds after which the query should timeout
	Timeout int `url:"timeout,omitempty"`
	// The maximum number of results to return
	Limit int `url:"limit,omitempty"`
	// How far into the result set to offset
	Offset int `url:"offset,omitempty"`
	// Request query results with namespace substitution/prefix lines
	UseNamespaces bool `url:"useNamespaces,omitempty"`
	// URI(s) to be used as the default graph (equivalent to FROM)
	DefaultGraphURI string `url:"default-graph-uri,omitempty"`
	// URI(s) to be used as named graphs (equivalent to FROM NAMED)
	NamedGraphURI string `url:"named-graph-uri,omitempty"`
	// URI(s) to be used as default graph (equivalent to USING)
	UsingGraphURI string `url:"using-graph-uri,omitempty"`
	// URI(s) to be used as named graphs (equivalent to USING NAMED)
	UsingNamedGraphURI string `url:"using-named-graph-uri,omitempty"`
	// URI of the graph to be inserted into
	InsertGraphURI string `url:"insert-graph-uri,omitempty"`
	// URI of the graph to be removed from
	RemoveGraphURI string `url:"remove-graph-uri,omitempty"`
}

UpdateOptions specifies the optional parameters to the SPARQLService.Update method

type User added in v0.3.0

type User struct {
	Username             *string               `json:"username,omitempty"`
	Enabled              bool                  `json:"enabled"`
	Superuser            bool                  `json:"superuser"`
	Roles                []string              `json:"roles"`
	EffectivePermissions []EffectivePermission `json:"permissions"`
}

Represents a Stardog user

type UserService added in v0.6.0

type UserService service

UserService handles communication with the user related methods of the Stardog API.

func (*UserService) AssignRole added in v0.6.0

func (s *UserService) AssignRole(ctx context.Context, username string, rolename string) (*Response, error)

AssignRole assigns a role to a user.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Users/operation/addUserRole

func (*UserService) ChangePassword added in v0.6.0

func (s *UserService) ChangePassword(ctx context.Context, username string, password string) (*Response, error)

ChangePassword changes a user's password.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Users/operation/changePassword

func (*UserService) Create added in v0.6.0

func (s *UserService) Create(ctx context.Context, username string, password string) (*Response, error)

Create adds a user to the system.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Users/operation/addUser

func (*UserService) Delete added in v0.6.0

func (s *UserService) Delete(ctx context.Context, username string) (*Response, error)

Delete deletes a user from the system

Stardog API: https://stardog-union.github.io/http-docs/#tag/Users/operation/deleteUser

func (*UserService) Disable added in v0.6.0

func (s *UserService) Disable(ctx context.Context, username string) (*Response, error)

Disable disables a user.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Users/operation/setUserEnabled

func (*UserService) EffectivePermissions added in v0.6.0

func (s *UserService) EffectivePermissions(ctx context.Context, username string) ([]EffectivePermission, *Response, error)

EffectivePermissions returns permissions explicitly assigned to a user and via role assignment.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Permissions/operation/getEffectiveUserPermissions

func (*UserService) Enable added in v0.6.0

func (s *UserService) Enable(ctx context.Context, username string) (*Response, error)

Enable enables a user.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Users/operation/setUserEnabled

func (*UserService) Get added in v0.6.0

func (s *UserService) Get(ctx context.Context, username string) (*User, *Response, error)

Get returns a User in the system

Stardog API: https://stardog-union.github.io/http-docs/#tag/Users/operation/getUser

func (*UserService) GrantPermission added in v0.6.0

func (s *UserService) GrantPermission(ctx context.Context, username string, permission Permission) (*Response, error)

GrantPermission grants a permission a user.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Permissions/operation/addUserPermission

func (*UserService) IsEnabled added in v0.6.0

func (s *UserService) IsEnabled(ctx context.Context, username string) (*bool, *Response, error)

IsEnabled returns whether the user is enabled or not. Stardog API: https://stardog-union.github.io/http-docs/#tag/Users/operation/userEnabled

func (*UserService) IsSuperuser added in v0.6.0

func (s *UserService) IsSuperuser(ctx context.Context, username string) (*bool, *Response, error)

IsSuperuser returns whether the user is a superuser or not

Stardog API: https://stardog-union.github.io/http-docs/#tag/Users/operation/isSuper

func (*UserService) List added in v0.6.0

func (s *UserService) List(ctx context.Context) ([]User, *Response, error)

List returns all Users in the system

Stardog API: https://stardog-union.github.io/http-docs/#tag/Users/operation/listUsersDetailed

func (*UserService) ListNames added in v0.6.0

func (s *UserService) ListNames(ctx context.Context) ([]string, *Response, error)

ListNames returns the name of all users in the system

Stardog API: https://stardog-union.github.io/http-docs/#tag/GetUsers/operation/listUsers

func (*UserService) ListNamesAssignedRole added in v0.6.0

func (s *UserService) ListNamesAssignedRole(ctx context.Context, rolename string) ([]string, *Response, error)

ListNamesAssignedRole returns all the names of users assigned a given role.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Roles/operation/getUsersWithRole

func (*UserService) OverwriteRoles added in v0.6.0

func (s *UserService) OverwriteRoles(ctx context.Context, username string, roles []string) (*Response, error)

OverwriteRoles overwrites the the list roles assigned to a user.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Users/operation/setUserRoles

func (*UserService) Permissions added in v0.6.0

func (s *UserService) Permissions(ctx context.Context, username string) ([]Permission, *Response, error)

Permissions returns the permissions explicitly assigned to user. Permissions granted to a user via role assignment will not be contained in the response. Use [UserService.UserEffectivePermissions] for that.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Permissions/operation/getUserPermissions

func (*UserService) RevokePermission added in v0.6.0

func (s *UserService) RevokePermission(ctx context.Context, username string, permission Permission) (*Response, error)

RevokePermission revokes a permission from a user.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Permissions/operation/deleteUserPermission

func (*UserService) Roles added in v0.6.0

func (s *UserService) Roles(ctx context.Context, username string) ([]string, *Response, error)

Roles returns the names of all roles assigned to a user.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Users/operation/getUserRoles

func (*UserService) UnassignRole added in v0.6.0

func (s *UserService) UnassignRole(ctx context.Context, username string, rolename string) (*Response, error)

UnassignRole unassigns a role from a user.

Stardog API: https://stardog-union.github.io/http-docs/#tag/Users/operation/removeUserRole

func (*UserService) WhoAmI added in v0.8.0

func (s *UserService) WhoAmI(ctx context.Context) (*string, *Response, error)

WhoAmI returns the authenticated user's username

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL