twilio / twilio-go

A Go package for communicating with the Twilio API.
MIT License
272 stars 40 forks source link

Issue in go import #166

Closed Vikram-ksingh closed 1 year ago

Vikram-ksingh commented 2 years ago

I have integrated the package but getting following error on go get

twilioClient.ApiV2010 undefined (type *twilio.RestClient has no field or method ApiV2010)

Technical details:

avstrong commented 2 years ago

I have integrated the package but getting following error on go get

twilioClient.ApiV2010 undefined (type *twilio.RestClient has no field or method ApiV2010)

Technical details:

  • twilio-go version:
  • go version: 1.18.2

try to use Api instead of ApiV2010

client.Api.CreateMessage(params)

instead of

client.ApiV2010.CreateMessage(params)

beebzz commented 2 years ago

Hi @Vikram-ksingh, @avstrong is correct. We recently changed the prefix for V2010 APIs to Api from ApiV2010 in v0.26.0. Try that and let us know if you have any other questions.

encryptblockr commented 2 years ago

@beebzz

can you also please update "official" documentation guides? thanks

https://www.twilio.com/docs/libraries/go

https://www.twilio.com/blog/send-sms-30-seconds-golang

encryptblockr commented 2 years ago

@beebzz @Vikram-ksingh @avstrong

there is also this error undefined: twilio.RestClientParams how do we fix this also?

code (following this official guide https://www.twilio.com/docs/libraries/go)

import (
        ...
    twilio "github.com/twilio/twilio-go"
    openapi "github.com/twilio/twilio-go/rest/api/v2010"
)

...
    accountSid := os.Getenv("TWILIO_ACCOUNT_SID")
    authToken := os.Getenv("TWILIO_AUTH_TOKEN")
    client := twilio.NewRestClientWithParams(twilio.RestClientParams{
        Username: accountSid,
        Password: authToken,
    })

error

undefined: twilio.RestClientParams
encryptblockr commented 2 years ago

ok fixed..here are the following fix for the errors

error #1

twilioClient.ApiV2010 undefined (type *twilio.RestClient has no field or method ApiV2010)

fix for error #1

change ApiV2010 to Api

#####################

error #2

undefined: twilio.RestClientParams

fix for error #2

change twilio.RestClientParams to twilio.ClientParams

rakatyal commented 2 years ago

@encryptblockr: Thanks for bringing the docs to our attention. This issue has been added to our internal backlog to be prioritized. Pull requests and +1s on the issue summary will help it move up the backlog. Please let us know if we can help with anything else.

JenniferMah commented 2 years ago

This work is captured in the internal ticket DI-2157

rakatyal commented 1 year ago

The documentation should be updated now.