Coder Social home page Coder Social logo

cios-golang-sdk's Introduction

OPTiM Cloud IoT OS Golang SDK (0.4.2)

It is a convenient SDK to use OPTiM Cloud IoT OS(CIOS) in Go language.

This SDK uses OpenAPI and is generated in code. OpenAPI will be split at a later date, but is now included in the code. It is imperfect.

Instration

go get -u github.com/optim-corp/cios-golang-sdk

Usage

Initialization

  • If you want to use Prod Client
client = ciossdk.NewCiosClient(ciossdk.CiosClientConfig{
    Debug:             true,
    AutoRefresh:       true,
    Urls:              sdkmodel.ProdUrls(),
})
  • If you want to use Pre Client
client = ciossdk.NewCiosClient(ciossdk.CiosClientConfig{
    Debug:             true,
    AutoRefresh:       true,
    Urls:              sdkmodel.PreUrls(),
})
  • If you want to use Custom URL
client = ciossdk.NewCiosClient(ciossdk.CiosClientConfig{
    Debug:             true,
    AutoRefresh:       true,
    Urls: ciossdk.CIOSUrl{
        MessagingUrl:             " https://",
        LocationUrl:              " https://",
        AccountsUrl:              " https://",
        StorageUrl:               " https://",
        IamUrl:                   " https://",
        AuthUrl:                  " https://",
        VideoStreamingUrl:        " https://",
        DeviceManagementUrl:      " https://",
        DeviceMonitoringUrl:      " https://",
        DeviceAssetManagementUrl: " https://",
    },
})

Authentication

OAuthClientType is Suppoted
Web
Client
Device
Native
  • Client Auth
    • client id
    • client secret
    • request scope
client = ciossdk.NewCiosClient(ciossdk.CiosClientConfig{
    AuthConfig: ClientAuthConf(
           "clientID",
           "clientSecret",
           "scope",
   ),
})
  • Refresh Token Auth
    • client id
    • client secret
    • refresh token
    • request scope
client = ciossdk.NewCiosClient(ciossdk.CiosClientConfig{
    AuthConfig: RefreshTokenAuth(
           "clientID",
           "clientSecret",
           "refreshToken",
           "scope",
   ),
})
  • Device Auth
    • client id
    • client secret
    • assertion
    • request scope
client = ciossdk.NewCiosClient(ciossdk.CiosClientConfig{
    AuthConfig: DeviceAuthConf(
           "clientID",
           "clientSecret",
           "assertion",
           "scope",
   ),
})

The refresh token will only be executed once if the request fails.

Document

How to test client

package ciossdk_mock has mock interface

Usage

var client = ciossdk.NewCiosClient()
type MockBucket struct {
	ciossdk_mock.NoImplementFileStorage
}

func (*MockBucket) GetBuckets(ctx ciosctx.RequestCtx, request cios.ApiGetBucketsRequest) (cios.MultipleBucket, *_nethttp.Response, error) {
    return cios.MultipleBucket{}, nil, nil
}
func Test_sampleGetBucket(t *testing.T) {
    mock := &ciossdk_mock.MockClient{}
    mock.SetFileStorage(&MockBucket{})
    client = mock
    ....
}

How to Support

If you have any issues or questions, please raise them on Github issues.

LICENSE

The Apache-2.0 License

Copyright (c) 2021 OPTiM Corporation https://www.optim.co.jp/

cios-golang-sdk's People

Contributors

optim-kazuhiro-seida avatar optim-yusuke-aoki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cios-golang-sdk's Issues

Datastore API ListObjectのQuery Parameterに「stored_timestamp_range」を追加

内容

CIOSのVersion Upにより、Pub/sub datastore ListObjectのQuery Parameterに「stored_timestamp_range」を追加されている
https://cios.gitlab.tokyo.optim.co.jp/developer-portal/cios-internal/md/api_v2/pubsub_datastore/#list-objects

cios-gokang-sdkでもstored_timestamp_rangeをパラメータとして指定できるように改修を実施したい。

期待するゴール

  • GetDataStoreObjectsにおいてstored_timestamp_rangeをオプションとして追加できるようにする

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.