client.Members
इस नेमस्पेस का हर मेथड: उसका सिग्नेचर, उसके पैरामीटर, वह क्या लौटाता है और एक उदाहरण।
मेथड
People who share the workspace, their role and the addresses they may use, and the invitations still waiting.
Members.ListAsyncMembers.ListAllAsyncMembers.IterateAsyncMembers.GetAsyncMembers.AddAsyncMembers.UpdateAsyncMembers.RemoveAsyncMembers.GrantAddressAsyncMembers.RevokeAddressAsyncMembers.GrantDomainAsyncMembers.RevokeDomainAsyncMembers.ListInvitationsAsyncMembers.ListAllInvitationsAsyncMembers.IterateInvitationsAsyncMembers.RevokeInvitationAsyncMembers.ResendInvitationAsync
Members.ListAsync
List everybody with access to the workspace
Task<Page> ListAsync( int? limit = null, string? cursor = null, string? apiKey = null, CancellationToken cancellationToken = default)Returns one page of the workspace's members, the owner first and the rest by email. Members.ListAllAsync collects every page and Members.IterateAsync walks them lazily. Each row carries two axes that a client must not merge: role and permissions say what the person may do, and addresses and domains say what they may do it to, each with its own access. A whole domain reaches every address on it, including ones made later. A send needs both axes, so emails:send with nothing granted sends from nothing.
The one exception is addresses:all. When permissions holds it, the person reaches every address on every domain of the workspace, including ones added later, and sends as any of them when permissions also holds emails:send. addresses and domains still list only the grants made to them directly, which they may have kept from before or been given since, or none at all. Read reach from permissions first, and from those two lists only when it lacks addresses:all.
The list is a union of people with a membership row and people who only hold address or domain grants and no membership row. The second group comes back with implied true, member["role"]["id"] null and createdAt null, and their role is inferred from their grants: Member if any grant has access set to member, Viewer otherwise. Until someone calls Members.UpdateAsync for them, widening their addresses silently widens what they may do.
The workspace owner is the FIRST row, marked with isOwner true, so an unshared workspace returns one member rather than an empty page. They hold every permission by definition, and Members.AddAsync, Members.UpdateAsync and Members.RemoveAsync refuse them with member_is_owner. Exclude isOwner when counting seats.
पैरामीटर
limitint?Page size, from 1 to 100. The server defaults to 25.
cursorstring?The
nextCursorof the previous page. Leave it out for the first page.apiKeystring?Overrides the client's API key for this call only.
cancellationTokenCancellationTokenCancels the request.
लौटाता है
A Page of member objects, with items, hasMore and nextCursor. Each item has userId, email, name, image, isOwner, role, implied, permissions, addresses, domains and createdAt.
उदाहरण
var page = await client.Members.ListAsync(); Console.WriteLine(page.Count);टिप्पणियाँ
Every other method here takes
userId, the account id, not the email address.accessset tovieweron an address blocks sending from it even when the role holdsemails:send, unless the role also holdsaddresses:all. Otherwise the two axes are ANDed, never added.The cursor is opaque and holds where the last row sat in this order, so a row deleted or edited between pages never breaks the walk: the next page starts at the first row that sorts after it. A cursor this list did not hand out is a 400
invalid_cursor.
इनमें भी उपलब्ध
- API
GET /members- TypeScript
members.list()- Python
members.list()- Ruby
members.list- PHP
members->list- Go
Members.List- Java
members().list- CLI
openemail members list
Members.ListAllAsync
Collect every member into one object
Task<IReadOnlyList<JsonObject>> ListAllAsync( int? limit = null, string? cursor = null, string? apiKey = null, CancellationToken cancellationToken = default)Walks every page of Members.ListAsync and returns all members in one object, the owner first and the rest by email. One request per page.
पैरामीटर
limitint?Page size for each request, from 1 to 100. The server defaults to 25.
cursorstring?Starts the walk after this cursor instead of the first page.
apiKeystring?Overrides the client's API key for every page of this walk.
cancellationTokenCancellationTokenCancels the request.
लौटाता है
A list of member objects holding every member.
उदाहरण
var members = await client.Members.ListAllAsync(limit: 100); Console.WriteLine(members.Count);टिप्पणियाँ
If any page fails, the exception is thrown and the members already fetched are discarded.
इनमें भी उपलब्ध
- API
GET /members- TypeScript
members.listAll()- Python
members.list_all()- Ruby
members.list_all- PHP
members->listAll- Go
Members.ListAll- Java
members().listAll
Members.IterateAsync
Stream the members one at a time
IAsyncEnumerable<JsonObject> IterateAsync( int? limit = null, string? cursor = null, string? apiKey = null, CancellationToken cancellationToken = default)Returns an IAsyncEnumerable<JsonObject> that yields members one at a time, the owner first and the rest by email, and requests the next page only once the current one is used up. Nothing is fetched until the loop starts, and breaking out of the await foreach stops the requests.
पैरामीटर
limitint?Page size for each request, from 1 to 100. The server defaults to 25.
cursorstring?Starts the walk after this cursor instead of the first page.
apiKeystring?Overrides the client's API key for every page of this walk.
cancellationTokenCancellationTokenCancels the request.
लौटाता है
An IAsyncEnumerable<JsonObject> that yields one member per step.
उदाहरण
await foreach (var member in client.Members.IterateAsync()){ if ((bool?)member["implied"] == true) { Console.WriteLine($"{member["email"]} has grants but no role yet"); }}टिप्पणियाँ
The generator is lazy, so an abandoned loop costs only the pages you consumed.
इनमें भी उपलब्ध
- API
GET /members- TypeScript
members.iterate()- Python
members.iterate()- Ruby
members.iterate- PHP
members->iterate- Go
Members.Iterate- Java
members().iterate
Members.GetAsync
Read one member by account id
Task<JsonObject> GetAsync( string userId, string? apiKey = null, CancellationToken cancellationToken = default)Returns a single member with their role, resolved permissions and address grants. The lookup runs over the same union as Members.ListAsync, so a legacy grant holder with no membership row is found here too, with implied true.
The path takes the account id from Members.ListAsync, not an email. An email can change on the account, and a stale one would point at the wrong person. The owner's account id returns the owner's row, with isOwner true, and an id that is not on the workspace answers 404.
पैरामीटर
userIdstringआवश्यकThe account id from
Members.ListAsync, not the email address.apiKeystring?Overrides the client's API key for this call only.
cancellationTokenCancellationTokenCancels the request.
लौटाता है
A JsonObject with userId, email, name, image, role (an object of id, name and builtin), isOwner, implied, the resolved permissions, addresses (each holding addressId, address and access), domains (each holding domainId, domain and access) and createdAt.
उदाहरण
var member = await client.Members.GetAsync("q7Vd3kX9mT2pLw8RzN4bYc6HfJ1sGa5E"); Console.WriteLine($"{member["email"]} is {member["role"]?["name"]}{((bool?)member["implied"] == true ? ", inferred from grants" : "")}"); foreach (var grant in member["addresses"]?.AsArray() ?? []){ Console.WriteLine($" {grant?["address"]} as {grant?["access"]}");}टिप्पणियाँ
A missing member is 404
resource_not_found.For an implied member,
permissionsare the Member or Viewer template permissions, not a stored role thatRoles.GetAsynccould read.
इनमें भी उपलब्ध
- API
GET /members/{userId}- TypeScript
members.get()- Python
members.get()- Ruby
members.get- PHP
members->get- Go
Members.Get- Java
members().get- CLI
openemail members get
Members.AddAsync
Invite somebody to the workspace with a role
Task<JsonObject> AddAsync( IReadOnlyDictionary<string, object?> body, string? apiKey = null, CancellationToken cancellationToken = default)Sends an invitation to join the workspace. Whether or not the address already has an OpenEmail account, the answer is an invitation rather than a member: nobody is put into a workspace without accepting, and this method is held to the same rule as the app.
The invitation carries the role, the addresses and the whole domains you name, and grants exactly those the moment it is accepted. Nothing is granted before that. Calling it again for the same address within ten minutes is refused with 409 invitation_too_soon. After that it refreshes the one outstanding invitation rather than sending a second.
Somebody already in the workspace is refused with 422 member_is_owner. Change what an existing member may do with Members.UpdateAsync, Members.GrantAddressAsync and Members.RevokeAddressAsync, which only work on people already in.
Role and grants are separate axes. access applies to every id in addressIds and domainIds, and it never widens the role: ["access"] = "member" under a role without emails:send still cannot send. A role holding addresses:all reaches every address without any ids, and no key or access token can invite with one, because none of them holds that console-only permission.
पैरामीटर
emailstringआवश्यकWho to invite. Trimmed and lowercased. It does not need to have an account yet.
roleIdstringआवश्यकRole id from
Roles.ListAsync. The owner role is refused with 409role_immutable, and a role holding more than the key itself holds is refused with 403insufficient_authority. That covers every role with a console-only permission in it, such asaddresses:all.addressIdsIEnumerable<string>Up to 64 address ids on this workspace the invitation carries, all at
access.domainIdsIEnumerable<string>Up to 64 domain ids on this workspace the invitation carries, all at
access. A whole domain covers every address on it, including ones made later.accessdictionarymemberreads and sends as the granted addresses,vieweronly reads them. Defaults tomember.apiKeystring?Overrides the client's API key for this call only.
cancellationTokenCancellationTokenCancels the request.
लौटाता है
A JsonObject for the invitation, answered with a 202: the invitation id, what it carries, when it expires, and delivered, which is false when the email did not leave the mail server.
उदाहरण
var invitation = await client.Members.AddAsync(new Body{ ["email"] = "[email protected]", ["roleId"] = "role_8b1f4c2e9a7d3b60e5f1a2c4", ["domainIds"] = new[] { "93542ff8-2baa-4f2f-841d-5ceaa074ab0d" }, ["access"] = "member",}); Console.WriteLine($"Invitation {invitation["id"]} expires {invitation["expiresAt"]}"); if ((bool?)invitation["delivered"] == false){ Console.WriteLine($"The email did not go out: {invitation["deliveryError"]}");}टिप्पणियाँ
An unknown
roleIdis 404role_not_foundwithparamset toroleId. An address or domain id that is not on this workspace is 422member_not_foundwithparamset toaddressIdordomainId.The workspace owner, and anybody already in the workspace, is refused with 422
member_is_owner.deliveredfalse means the invitation exists but the email did not go out. It can be sent again from the app once the ten minute cooldown has passed.Not retried automatically. Re-posting the same body inside ten minutes is 409 rather than a duplicate.
इनमें भी उपलब्ध
- API
POST /members- TypeScript
members.add()- Python
members.add()- Ruby
members.add- PHP
members->add- Go
Members.Add- Java
members().add- CLI
openemail members add
Members.UpdateAsync
Change the role a member holds
Task<JsonObject> UpdateAsync( string userId, IReadOnlyDictionary<string, object?> patch, string? apiKey = null, CancellationToken cancellationToken = default)Moves a member to a different role and changes nothing else, for somebody ALREADY in the workspace. Their address and domain grants are untouched, and grants cannot be patched here at all: Members.GrantAddressAsync and Members.RevokeAddressAsync change one grant at a time.
This is also how a legacy grant holder stops being implied. They have address or domain grants and no membership row, this writes one, and from then on implied is false and their permissions come from a role someone chose rather than from what their access implied.
Nobody joins through Members.UpdateAsync. An account that is not in the workspace is 422 member_not_found: invite them with Members.AddAsync and they are in once they accept. The owner role cannot be handed out, which is 409 role_immutable, and the workspace owner cannot be given a role, which is 422 member_is_owner.
पैरामीटर
userIdstringआवश्यकThe account id from
Members.ListAsync, not the email address.roleIdstringआवश्यकId of the role to move them to.
apiKeystring?Overrides the client's API key for this call only.
cancellationTokenCancellationTokenCancels the request.
लौटाता है
A JsonObject for the member with the new role and permissions, and implied set to false.
उदाहरण
var member = await client.Members.UpdateAsync("q7Vd3kX9mT2pLw8RzN4bYc6HfJ1sGa5E", new Body { ["roleId"] = "role_2c7e9a1f4b8d3e60c5a7f1b9" }); Console.WriteLine($"{member["email"]} is now {member["role"]?["name"]} with {member["permissions"]?.AsArray().Count} permissions");टिप्पणियाँ
The account has to be in the workspace already, by membership row or by a grant. Anybody else is 422
member_not_found. UseMembers.AddAsyncto invite them.An unknown
roleIdis 404role_not_found, and a user id with no OpenEmail account behind it is 404user_not_found.A role holding more than the key itself holds is 403
insufficient_authority. No key or access token holds a console-only permission, so a role withaddresses:all, billing orworkspace:managein it is handed out only in the app. That includes the seeded Admin, which holds billing.Retried automatically on network failure, since it names the role it wants and a replay lands on the same row.
इनमें भी उपलब्ध
- API
PATCH /members/{userId}- TypeScript
members.update()- Python
members.update()- Ruby
members.update- PHP
members->update- Go
Members.Update- Java
members().update- CLI
openemail members update
Members.RemoveAsync
Remove a member and every address and domain grant they hold
Task<JsonObject> RemoveAsync( string userId, string? apiKey = null, CancellationToken cancellationToken = default)Takes somebody out of the workspace entirely: the membership row and every address and domain grant they hold on it. Removing only the row would drop them from the list while they kept reading the mail, so both go together.
It does not 404 for somebody who is not a member. The people this most needs to reach are legacy grant holders with no membership row, so there is no existence check, and addressesRevoked reports what actually happened: the address and domain grants it revoked, counted together. Zero is the honest answer for a no-op.
Their account, their sent mail and anything they wrote are untouched. Only their access to this workspace ends.
पैरामीटर
userIdstringआवश्यकThe account id from
Members.ListAsync, not the email address.apiKeystring?Overrides the client's API key for this call only.
cancellationTokenCancellationTokenCancels the request.
लौटाता है
A JsonObject with object set to member, the userId, deleted set to true and addressesRevoked.
उदाहरण
var removed = await client.Members.RemoveAsync("q7Vd3kX9mT2pLw8RzN4bYc6HfJ1sGa5E"); Console.WriteLine($"Removed, {removed["addressesRevoked"]} grants revoked");टिप्पणियाँ
Idempotent on the server, but the SDK does not retry it automatically, so repeat it yourself after a network failure.
The workspace owner is refused with 422
member_is_owner, because their access never came from a membership.
इनमें भी उपलब्ध
- API
DELETE /members/{userId}- TypeScript
members.remove()- Python
members.remove()- Ruby
members.remove- PHP
members->remove- Go
Members.Remove- Java
members().remove- CLI
openemail members remove
Members.GrantAddressAsync
Grant a member one address or change their access to it
Task<JsonObject> GrantAddressAsync( string userId, IReadOnlyDictionary<string, object?> body, string? apiKey = null, CancellationToken cancellationToken = default)Gives one person one address on this workspace, or changes the access they already have to it. It is an upsert: there is one grant per person and address, so posting again with a different access turns a viewer into a member rather than adding a second grant.
This is the address axis and it cannot widen the role. ["access"] = "member" lets somebody send as the address only if their role also holds emails:send, and otherwise it lets them read.
Granting an address to an account with no membership row makes them appear in Members.ListAsync as an implied member whose role is inferred from their grants, so call Members.UpdateAsync as well if the role should be a decision. The whole member comes back, which lets a client redraw the row without another read.
पैरामीटर
userIdstringआवश्यकThe account id from
Members.ListAsync, not the email address.addressIdstringआवश्यकId of an address on this workspace.
accessdictionarymemberreads and sends as the address,vieweronly reads it. Defaults tomember.apiKeystring?Overrides the client's API key for this call only.
cancellationTokenCancellationTokenCancels the request.
लौटाता है
A JsonObject for the member with the grant applied, including the full addresses list.
उदाहरण
var member = await client.Members.GrantAddressAsync("q7Vd3kX9mT2pLw8RzN4bYc6HfJ1sGa5E", new Body { ["addressId"] = "4f0c1b6e-2d7a-4a9e-8c35-91b2e7d4f6a0", ["access"] = "viewer" }); foreach (var grant in member["addresses"]?.AsArray() ?? []){ Console.WriteLine($"{grant?["address"]} as {grant?["access"]}");}टिप्पणियाँ
An address id that is not on this workspace is 422 with code
member_not_foundandparamset toaddressId.The workspace owner is refused with 422
member_is_owner, since they already reach every address. A user id with no OpenEmail account behind it is 404user_not_found.Gated on
members:writerather than on owning the address, so an admin who owns nothing can still manage grants.Retried automatically on network failure, since replaying the same grant lands on the same row.
इनमें भी उपलब्ध
Members.RevokeAddressAsync
Take one address back from a member
Task<JsonObject> RevokeAddressAsync( string userId, string addressId, string? apiKey = null, CancellationToken cancellationToken = default)Removes one address grant and leaves the person in the workspace with their role and their other addresses. This is the narrow revocation to use when somebody changes team.
An address id that is not on this workspace is refused with 422 member_not_found rather than ignored, so a typo cannot report a revocation that never happened. An address that is on the workspace but was never granted to this person is a silent no-op, and the member comes back unchanged.
The member is returned rather than a tombstone, because the useful answer is what they can still reach.
पैरामीटर
userIdstringआवश्यकThe account id from
Members.ListAsync, not the email address.addressIdstringआवश्यकId of an address on this workspace.
apiKeystring?Overrides the client's API key for this call only.
cancellationTokenCancellationTokenCancels the request.
लौटाता है
A JsonObject for the member with the remaining addresses.
उदाहरण
var member = await client.Members.RevokeAddressAsync("q7Vd3kX9mT2pLw8RzN4bYc6HfJ1sGa5E", "4f0c1b6e-2d7a-4a9e-8c35-91b2e7d4f6a0"); Console.WriteLine($"{member["email"]} still reaches: {string.Join(", ", (member["addresses"]?.AsArray() ?? []).Select(row => row?["address"]))}");टिप्पणियाँ
Revoking the last grant of an implied member removes them from the workspace entirely. The call still succeeds and returns the member as they stood, without that address.
Somebody who is not a member of this workspace is a 404.
Not retried automatically by the SDK.
इनमें भी उपलब्ध
Members.GrantDomainAsync
Grant a member a whole domain or change their access to it
Task<JsonObject> GrantDomainAsync( string userId, IReadOnlyDictionary<string, object?> body, string? apiKey = null, CancellationToken cancellationToken = default)Gives one person every address on one domain of this workspace, including addresses added after the grant, or changes the access they already have to it. It is an upsert: there is one grant per person and domain, so calling it again with a different access turns a viewer into a member rather than adding a second grant.
This is the address axis and it cannot widen the role. ["access"] = "member" lets somebody send from the domain only if their role also holds emails:send, and otherwise it lets them read.
The person has to be in the workspace already, so invite them with Members.AddAsync first. The whole member comes back, with the grant in domains.
पैरामीटर
userIdstringआवश्यकThe account id from
Members.ListAsync, not the email address.domainIdstringआवश्यकId of a domain on this workspace, as
Domains.ListAsyncreturns it.accessdictionarymemberreads and sends from the domain,vieweronly reads it. Defaults tomember.apiKeystring?Overrides the client's API key for this call only.
cancellationTokenCancellationTokenCancels the request.
लौटाता है
A JsonObject for the member with the grant applied, including the full domains list.
उदाहरण
var member = await client.Members.GrantDomainAsync("q7Vd3kX9mT2pLw8RzN4bYc6HfJ1sGa5E", new Body { ["domainId"] = "7d2a9c41-5b3e-4f8a-9c06-1e2b3c4d5e6f", ["access"] = "member" }); foreach (var grant in member["domains"]?.AsArray() ?? []){ Console.WriteLine($"Every address on {grant?["domain"]} as {grant?["access"]}");}टिप्पणियाँ
A domain id that is not on this workspace is 422 with code
member_not_foundandparamset todomainId. Somebody who is not in the workspace yet is refused the same way withparamset touserId.The workspace owner is refused with 422
member_is_owner, since they already reach every domain. A user id with no OpenEmail account behind it is 404user_not_found.A workspace whose plan has no team access is refused with 403
plan_required. A key or an access token limited to particular addresses or domains is refused with 422capability_unsupported, and an access token acting for a member can only give a domain that member reaches, or it is refused with 403insufficient_authority.An OAuth access token needs a verification code for this call, and is refused with 403
step_up_requireduntil the app has verified one in the last 60 minutes.IsStepUpRequiredon the error says so. An API key is never asked for a code.Retried automatically on network failure, since replaying the same grant lands on the same row.
इनमें भी उपलब्ध
Members.RevokeDomainAsync
Take a whole domain back from a member
Task<JsonObject> RevokeDomainAsync( string userId, string domainId, string? apiKey = null, CancellationToken cancellationToken = default)Removes one domain grant and leaves the person in the workspace with their role and their other grants. Addresses on that domain that were granted to them one by one stay granted.
A domain id that is not on this workspace is refused with 422 member_not_found rather than ignored, so a typo cannot report a revocation that never happened. A domain that is on the workspace but was never granted to this person is a silent no-op, and the member comes back unchanged.
The member is returned rather than a tombstone, because the useful answer is what they can still reach.
पैरामीटर
userIdstringआवश्यकThe account id from
Members.ListAsync, not the email address.domainIdstringआवश्यकId of a domain on this workspace.
apiKeystring?Overrides the client's API key for this call only.
cancellationTokenCancellationTokenCancels the request.
लौटाता है
A JsonObject for the member with the remaining domains.
उदाहरण
try{ var member = await client.Members.RevokeDomainAsync("q7Vd3kX9mT2pLw8RzN4bYc6HfJ1sGa5E", "7d2a9c41-5b3e-4f8a-9c06-1e2b3c4d5e6f"); Console.WriteLine($"{member["email"]} keeps {member["domains"]?.AsArray().Count} domains and {member["addresses"]?.AsArray().Count} addresses");}catch (OpenEmailApiException error){ if (!error.IsStepUpRequired) { throw; } Console.WriteLine("Ask the person for a verification code first");}टिप्पणियाँ
Somebody who is not a member of this workspace is a 404.
A key or an access token limited to particular addresses or domains is refused with 422
capability_unsupported.An OAuth access token needs a verification code for this call, and is refused with 403
step_up_requireduntil the app has verified one in the last 60 minutes.IsStepUpRequiredon the error says so. An API key is never asked for a code.Not retried automatically by the SDK.
इनमें भी उपलब्ध
Members.ListInvitationsAsync
List the invitations nobody has accepted yet
Task<Page> ListInvitationsAsync( int? limit = null, string? cursor = null, string? apiKey = null, CancellationToken cancellationToken = default)Returns one page of the invitations to this workspace that are still waiting, by email: the role and the addresses and whole domains each one grants once accepted, when it expires, and whether the last email reached them. Members.ListAllInvitationsAsync collects every page and Members.IterateInvitationsAsync walks them lazily.
A waiting invitation grants nothing. It becomes access only at the moment somebody accepts it, which is why it is listed apart from Members.ListAsync. An expired one stays on the list with expired true until it is sent again or withdrawn.
पैरामीटर
limitint?Page size, from 1 to 100. The server defaults to 25.
cursorstring?The
nextCursorof the previous page. Leave it out for the first page.apiKeystring?Overrides the client's API key for this call only.
cancellationTokenCancellationTokenCancels the request.
लौटाता है
A Page of invitation objects, with items, hasMore and nextCursor. Each item has id, email, role, addresses, domains, expiresAt, expired, lastSentAt, delivered, deliveryError and createdAt.
उदाहरण
var page = await client.Members.ListInvitationsAsync(); Console.WriteLine(page.Count);टिप्पणियाँ
deliveredis null when no send outcome was recorded, false when the email did not leave the mail server, with the reason indeliveryError.A key limited to particular addresses or domains lists only the invitations that grant nothing outside them.
इनमें भी उपलब्ध
Members.ListAllInvitationsAsync
Collect every waiting invitation into one object
Task<IReadOnlyList<JsonObject>> ListAllInvitationsAsync( int? limit = null, string? cursor = null, string? apiKey = null, CancellationToken cancellationToken = default)Walks every page of Members.ListInvitationsAsync and returns every waiting invitation in one object, by email. One request per page, with the same filters on each.
पैरामीटर
limitint?Page size for each request, from 1 to 100. The server defaults to 25.
cursorstring?Starts the walk after this cursor instead of the first page.
apiKeystring?Overrides the client's API key for every page of this walk.
cancellationTokenCancellationTokenCancels the request.
लौटाता है
A list of invitation objects holding every waiting invitation.
उदाहरण
var invitations = await client.Members.ListAllInvitationsAsync(); Console.WriteLine(invitations.Count);टिप्पणियाँ
If any page fails, the exception is thrown and the rows already fetched are discarded.
इनमें भी उपलब्ध
Members.IterateInvitationsAsync
Stream the waiting invitations one at a time
IAsyncEnumerable<JsonObject> IterateInvitationsAsync( int? limit = null, string? cursor = null, string? apiKey = null, CancellationToken cancellationToken = default)Returns an IAsyncEnumerable<JsonObject> that yields one invitation at a time, by email, and requests the next page only once the current one is used up. Nothing is fetched until the loop starts, and breaking out of the await foreach stops the requests.
पैरामीटर
limitint?Page size for each request, from 1 to 100. The server defaults to 25.
cursorstring?Starts the walk after this cursor instead of the first page.
apiKeystring?Overrides the client's API key for every page of this walk.
cancellationTokenCancellationTokenCancels the request.
लौटाता है
An IAsyncEnumerable<JsonObject> that yields one invitation per step.
उदाहरण
await foreach (var invitation in client.Members.IterateInvitationsAsync()){ if ((bool?)invitation["expired"] == true) { Console.WriteLine($"{invitation["email"]} let the invitation run out"); }}टिप्पणियाँ
The generator is lazy, so an abandoned loop costs only the pages you consumed.
इनमें भी उपलब्ध
Members.RevokeInvitationAsync
Withdraw an invitation
Task<JsonObject> RevokeInvitationAsync( string invitationId, string? apiKey = null, CancellationToken cancellationToken = default)Withdraws an invitation nobody has accepted. Its link stops working at once and nothing it would have granted is granted. It is Withdraw on the members screen. Inviting the same address later with Members.AddAsync sends a new one.
पैरामीटर
invitationIdstringआवश्यकThe invitation id from
Members.ListInvitationsAsync.apiKeystring?Overrides the client's API key for this call only.
cancellationTokenCancellationTokenCancels the request.
लौटाता है
A JsonObject with object set to invitation, id, email and revoked set to true.
उदाहरण
try{ var revoked = await client.Members.RevokeInvitationAsync("winv_6bb640f5b99e47deb758f1f5"); Console.WriteLine($"Withdrew the invitation to {revoked["email"]}");}catch (OpenEmailApiException error) when (error.IsConflict){ Console.WriteLine("Already accepted, so remove the member instead");}टिप्पणियाँ
An invitation that was accepted first answers 409
invitation_accepted: remove the member instead. One that is unknown or already withdrawn answers 404.A key limited to particular addresses or domains can withdraw only an invitation that grants nothing outside them.
इनमें भी उपलब्ध
Members.ResendInvitationAsync
Send an invitation again
Task<JsonObject> ResendInvitationAsync( string invitationId, string? apiKey = null, CancellationToken cancellationToken = default)Sends a waiting invitation again: a new link, fourteen more days, and the old link retired, so only the newest email works. It is Send again on the members screen, and it renews an expired invitation too.
पैरामीटर
invitationIdstringआवश्यकThe invitation id from
Members.ListInvitationsAsync.apiKeystring?Overrides the client's API key for this call only.
cancellationTokenCancellationTokenCancels the request.
लौटाता है
A JsonObject for the invitation with the new expiresAt and lastSentAt, and delivered for this send.
उदाहरण
foreach (var invitation in (await client.Members.ListAllInvitationsAsync())){ if ((bool?)invitation["expired"] == true || (bool?)invitation["delivered"] == false) { var sent = await client.Members.ResendInvitationAsync(invitation["id"]!.GetValue<string>()); Console.WriteLine($"Sent again to {sent["email"]}, valid until {sent["expiresAt"]}"); }}टिप्पणियाँ
The same address cannot be sent to twice within ten minutes: that is 409
invitation_too_soon. The daily limit on invitations is 409invitation_limit_reached.The invitation's role cannot hold more than the key does, the rule
Members.AddAsyncapplies too: a role with a permission the key or access token lacks, any console-only one such asaddresses:allincluded, is 403insufficient_authority. An access token acting for a member is also refused with it when the invitation carries addresses or domains that member does not reach.The SDK does not retry it, because each call sends an email.