sdk-generator icon indicating copy to clipboard operation
sdk-generator copied to clipboard

Update go client

Open Suven-p opened this issue 2 years ago • 4 comments

What does this PR do?

Adding chunking support to go SDK

Fixes #8

Test Plan

Test storage.CreateFile and functions.CreateDeployment endpoints

Related PRs and Issues

  • #8
  • https://github.com/appwrite/sdk-generator/pull/16

Have you read the Contributing Guidelines on issues?

Yes

Suven-p avatar Apr 18 '23 04:04 Suven-p

@lohanidamodar This isn't complete but before I complete this could you check https://github.com/Suven-p/sdk-for-go/blob/7123c8348cb6360a0db1dfa6ba5831c5c8435579/databases/databases.go#L31 to see if it is a good idea. The usage for optional parameters is database.List(databases.WithListQuery([queries]), databases.WithListSearch("Search term"). This gets very verbose with

WithCreateCollectionPermissions([]interface{}{
    appwrite.NewPermission().Read(appwrite.NewRole().any()),
    appwrite.NewPermission().Write(appwrite.NewRole().any())
})

and this is a single argument to CreateCollection endpoint.

Suven-p avatar Apr 27 '23 02:04 Suven-p

@lohanidamodar This isn't complete but before I complete this could you check Suven-p/sdk-for-go@7123c83/databases/databases.go#L31 to see if it is a good idea. The usage for optional parameters is database.List(databases.WithListQuery([queries]), databases.WithListSearch("Search term"). This gets very verbose with

WithCreateCollectionPermissions([]interface{}{
    appwrite.NewPermission().Read(appwrite.NewRole().any()),
    appwrite.NewPermission().Write(appwrite.NewRole().any())
})

and this is a single argument to CreateCollection endpoint.

@Suven-p I'm completely new to Go ecosystem and don't completely understand what do you mean. Can you share some perspective. Also we would love to keep syntax close to Platform (i.e GO lang) standards and possibly consistent with existing SDKs whenever possible. Share some more perspective and what's the common standards of Golang, and let me know how I can help.

lohanidamodar avatar May 10 '23 07:05 lohanidamodar

@lohanidamodar This should be done now. I am not sure how to test this since there are a lot of routes. Are the default tests sufficient?

For the directory structure, I am following the standard library@https://cs.opensource.google/go/go/+/refs/tags/go1.20.4:src/go.mod ie one module with many packages organized by directory.

For optional parameters, I am following this article.

Suven-p avatar May 16 '23 13:05 Suven-p

The test case for last commit fails due to https://github.com/appwrite/appwrite/issues/5392 Should the end byte be set to the correct value (size -1)?

Suven-p avatar May 16 '23 19:05 Suven-p