Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Releases: auth0-lab/fga-go-sdk

v0.7.0

23 Feb 19:39
v0.7.0
8416b2e
Compare
Choose a tag to compare

0.7.0 (2024-02-23)

[Breaking]

As of this point this SDK is deprecated and should no longer be used. Please use https://github.com/openfga/go-sdk instead.

We strongly recommend you use the OpenFGA Go SDK directly instead with the following configuration:

For US1 (Production US) environment, use the following values:

  • API URL: https://api.us1.fga.dev
  • Credential Method: ClientCredentials
  • API Token Issuer: fga.us.auth0.com
  • API Audience: https://api.us1.fga.dev/

You can get the rest of the necessary variables from the FGA Dashboard. See here.

package main

import (
 "os"

 . "github.com/openfga/go-sdk/client"
 "github.com/openfga/go-sdk/credentials"
)

func main() {
	fgaClient, err := NewSdkClient(&ClientConfiguration{
 ApiUrl: "https://api.us1.fga.dev",
 StoreId: os.Getenv("FGA_STORE_ID"),
 AuthorizationModelId: os.Getenv("FGA_MODEL_ID"),
 Credentials: &credentials.Credentials{
 Method: credentials.CredentialsMethodClientCredentials,
 Config: &credentials.Config{
 ClientCredentialsClientId: os.Getenv("FGA_CLIENT_ID"),
 ClientCredentialsClientSecret: os.Getenv("FGA_CLIENT_SECRET"),
 ClientCredentialsApiAudience: "https://api.us1.fga.dev/",
 ClientCredentialsApiTokenIssuer: "fga.us.auth0.com",
 },
 },
 })

 if err != nil {
 // .. Handle error
 }
}

v0.6.0

20 Dec 17:00
v0.6.0
8af084d
Compare
Choose a tag to compare

0.6.0 (2022-12-16)

Changes:

  • [BREAKING] feat(list-objects)!: response has been changed to include the object type e.g. response that was {"object_ids":["roadmap"]}, will now be {"objects":["document:roadmap"]}

Fixes:

  • [BREAKING] fix(models)!: update interfaces that had incorrectly optional fields to make them required

Chore:

  • chore(deps): update dependencies

v0.5.0

13 Oct 23:44
v0.5.0
0ee0cf1
Compare
Choose a tag to compare

0.5.0 (2022-10-13)

  • BREAKING: exported type TypeDefinitions is now WriteAuthorizationModelRequest Note: This is only a breaking change on the SDK, not the API.
  • feat: Support for ListObjects API

You call the API and receive the list of object ids from a particular type that the user has a certain relation with.

For example, to find the list of documents that Anne can read:

body := auth0fga.ListObjectsRequest{
    AuthorizationModelId: PtrString(""),
    User: PtrString("user:anne"),
    Relation: PtrString("can_view"),
    Type: PtrString("document"),
}
data, response, err := apiClient.Auth0FgaApi.ListObjects(context.Background()).Body(body).Execute()

// response.object_ids = ["roadmap"]
  • chore: Use govulncheck in CI to check for issues
  • chore(deps): upgrade dependencies
  • chore: Target go 1.19

v0.4.0

07 Jun 20:41
v0.4.0
a7dfb50
Compare
Choose a tag to compare

0.4.0 (2022-06-07)

Changes

The response will become similar to:

{
  "authorization_models":  [
    {
      "id": (string),
      "type_definitions": [...]
    }
  ]
}
  • feat!: drop support for all settings endpoints [BREAKING CHANGE]

  • feat!: Simplify error prefix to Fga [BREAKING CHANGE]

Possible Errors:

  • FgaApiError: All errors returned by the API extend this error

  • FgaApiValidationError: 400 and 422 Validation Errors returned by the API

  • FgaApiNotFoundError: 404 errors returned by the API

  • FgaApiRateLimitExceededError: 429 errors returned by the API

  • FgaApiInternalError: 5xx errors returned by the API

  • FgaApiAuthenticationError: Error during authentication

  • feat!: drop Params postfix from the name of the request interface [BREAKING CHANGE]

e.g. ReadRequestParams will become ReadRequest

You can call them like so:

body := fgaSdk.CheckRequest{
    TupleKey: &fgaSdk.TupleKey{
        User: fgaSdk.PtrString("anne"),
        Relation: fgaSdk.PtrString("can_view"),
        Object: fgaSdk.PtrString("transaction:A"),
    },
    ContextualTuples: &fgaSdk.ContextualTuples{
        TupleKeys: []fgaSdk.TupleKey{
            {
                User: fgaSdk.PtrString("anne"),
                Relation: fgaSdk.PtrString("user"),
                Object: fgaSdk.PtrString("ip-address-range:10.0.0.0/16"),
            },
           {
                User: fgaSdk.PtrString("anne"),
                Relation: fgaSdk.PtrString("user"),
                Object: fgaSdk.PtrString("timeslot:18_19"),
            }
        }
    }
}
data, response, err := fgaClient.Auth0FgaApi.Check(context.Background()).Body(body).Execute()
  • chore: upgrade dependencies

  • chore: internal refactor

v0.3.0

17 Mar 18:21
v0.3.0
380cadb
Compare
Choose a tag to compare

0.3.0 (2022-03-17)

Changes

  • chore!: change method names used to set request body (BREAKING CHANGE)
  • chore: fix user agent header format
  • feat: add support for the Watch API

v0.2.2

17 Mar 18:21
v0.2.2
a663e77
Compare
Choose a tag to compare

0.2.2 (2022-03-09)

Changes

  • fix: fix for return types on 204 no content

v0.2.1

08 Mar 01:25
v0.2.1
c59916d
Compare
Choose a tag to compare

0.2.1 (2022-03-07)

feat(error-handling): expose new api error codes

v0.2.0

09 Feb 20:23
v0.2.0
a4895b2
Compare
Choose a tag to compare

0.2.0 (2022-02-09)

  • feat: update interfaces for latest api breaking changes
  • chore(deps): update dependencies